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

Add calib_astrometryUsed field to record sources used #67

Merged
merged 1 commit into from
May 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions python/lsst/meas/astrom/astrometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from __future__ import absolute_import, division, print_function
from builtins import range

import random

Copy link
Contributor

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.

import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
from .ref_match import RefMatchTask, RefMatchConfig
Expand Down Expand Up @@ -55,6 +57,11 @@ class AstrometryConfig(RefMatchConfig):
default=0.001,
min=0,
)
doWriteOutput = pexConfig.Field(
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like a better name for this config parameter would be doOutputUsedFlag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to leave this consistent with the other calib modules.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this should be changed. This Task does not do any writing, so the name is misleading.

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
Expand Down Expand Up @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

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

schema is not None

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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")
Copy link
Contributor

Choose a reason for hiding this comment

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

funky indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

else:
self.usedKey = None

self.makeSubtask("wcsFitter")

@pipeBase.timeMethod
Expand Down Expand Up @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

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

probably should be explicit here: if self.usedKey is not None

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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(
Expand Down