-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add calib_astrometryUsed field to record sources used #67
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
from __future__ import absolute_import, division, print_function | ||
from builtins import range | ||
|
||
import random | ||
|
||
import lsst.pex.config as pexConfig | ||
import lsst.pipe.base as pipeBase | ||
from .ref_match import RefMatchTask, RefMatchConfig | ||
|
@@ -55,6 +57,11 @@ class AstrometryConfig(RefMatchConfig): | |
default=0.001, | ||
min=0, | ||
) | ||
doWriteOutput = pexConfig.Field( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like a better name for this config parameter would be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to leave this consistent with the other calib modules. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that this should be changed. This |
||
dtype=bool, | ||
default=True, | ||
doc="Write used flag to the schema", | ||
) | ||
|
||
# The following block adds links to this task from the Task Documentation page. | ||
## \addtogroup LSST_task_documentation | ||
|
@@ -147,6 +154,13 @@ def __init__(self, refObjLoader, schema=None, **kwargs): | |
@param[in] kwargs additional keyword arguments for pipe_base Task.\_\_init\_\_ | ||
""" | ||
RefMatchTask.__init__(self, refObjLoader, schema=schema, **kwargs) | ||
|
||
if self.config.doWriteOutput and not schema is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a fan of this code standard, but OK. |
||
self.usedKey = schema.addField("calib_astrometryUsed", type="Flag", | ||
doc="set if source was used in astrometric calibration") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. funky indentation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
else: | ||
self.usedKey = None | ||
|
||
self.makeSubtask("wcsFitter") | ||
|
||
@pipeBase.timeMethod | ||
|
@@ -269,6 +283,9 @@ def solve(self, exposure, sourceCat): | |
(iterNum, len(tryRes.matches), tryMatchDist.distMean.asArcseconds(), | ||
tryMatchDist.distStdDev.asArcseconds())) | ||
|
||
for m in res.matches: | ||
if self.usedKey: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably should be explicit here: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
m.second.set(self.usedKey, True) | ||
exposure.setWcs(res.wcs) | ||
|
||
return pipeBase.Struct( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this is used.