Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-16299: Create placeholder AP DPDDifying task #31

Merged
merged 4 commits into from Nov 2, 2018
Merged

Conversation

morriscb
Copy link
Contributor

No description provided.

Add first tests for apDataProduct

Fix bugs and run first apDataProduct unittest.
Debug all unittests for apDataProduct

Add midPointTai value to minimal DiaSource schema.

Add docs

Move duplicated flux tests.
----------
inputCatalog: `lsst.afw.table.SourceCatalog`
Input catalog with data to be copied into new output catalog.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add optional exposure to doc

Output catalog with data copied from input and new column names.
"""
outputCatalog = afwTable.SourceCatalog(self.outputSchema)
outputCatalog.preallocate(len(inputCatalog))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like the right way to do this. Have you seen:
https://github.com/lsst-dm/Oct15_bootcamp/blob/measurement/measurement/measurement.pdf?raw=true

Jim says: extend is more efficient than preallocate + for loop. (Also, in cases where the for loop is necessary, reserve is better than preallocate)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the first Task to the extend method and the DiaSource task to reserve. Thanks for sending this. Finding examples of how to use mappers within the python side of the stack is rather difficult.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learnt things!

(Not least that finding good documentation on afw::table is hard... :))

@@ -0,0 +1,196 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forget to rename the module? Typically we name the files something similar to the Task it contains so that it's easy to find. I wouldn't necessarily know that apDataProductMaker.py contains APDataMapperTask. We also usually name our tasks with the verb first: so MapAPDataTask and the module mapApData.py

outputRecord = outputCatalog.addNew()
outputRecord.assign(inputRecord, self.mapper)

if outputCatalog.isContiguous():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your testing, have you found that this is needed?

Jim says: "I also think the isContiguous check should be unnecessary; maybe best to turn that into an assert to make sure I'm not wrong about that and document-in-code that it's guaranteed."

Reviewer's personal preference is throwing exceptions instead of asserts, but coder's choice.

import numpy as np
import unittest

from lsst.ap.association import \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discourage \ over

from lsst.ap.association import (APDataMapperConfig,
    APDataMapperTask, 
    DiaSourceMapperConfig, 
    DiaSourceMapperTask)

https://developer.lsst.io/python/style.html#python-s-implied-continuation-inside-parens-brackets-and-braces-should-be-used-for-wrapped-lines

@@ -0,0 +1,234 @@
# This file is part of ap_association.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hurray! Unit test! 🥇

self.exposure.getInfo().getVisitInfo().getDate().get(
system=dafBase.DateTime.MJD))
for inputName, outputName in apDMapConfig.copyColumns.items():
if inputName[:4] == "slot":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see python's inputName.startswith("slot")

photoCalib = afwImage.PhotoCalib(1 / flux0, flux0Err / flux0 ** 2)

outputCatalog = afwTable.SourceCatalog(self.outputSchema)
outputCatalog.preallocate(len(inputCatalog))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see reserve suggestion above.

Fix linting errors.

Fix linting errors

Add midPointTai to DiaSource value copies.

Add exposure to run docstring.

Rename files and tasks.

Fix missed class renaming.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants