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-16392: Ensure ApCorr fields are added in a deterministic order. #134

Merged
merged 1 commit into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion python/lsst/meas/base/applyApCorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __init__(self, schema, **kwds):
if missingNameSet:
self.log.warn("Fields in ignoreList that are not in fluxCorrectList: %s",
sorted(list(missingNameSet)))
for name in apCorrNameSet - ignoreSet:
for name in sorted(list(apCorrNameSet - ignoreSet)):
if name + "_instFlux" not in schema:
# if a field in the registry is missing from the schema, silently ignore it.
continue
Expand Down
21 changes: 12 additions & 9 deletions tests/test_ApplyApCorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ class ApplyApCorrTestCase(lsst.meas.base.tests.AlgorithmTestCase, lsst.utils.tes

def setUp(self):
schema = afwTable.SourceTable.makeMinimalSchema()
name = "test"
addApCorrName(name)
schema.addField(name + "_instFlux", type=np.float64)
schema.addField(name + "_instFluxErr", type=np.float64)
schema.addField(name + "_flag", type=np.float64)
schema.addField(name + "_Centroid_x", type=np.float64)
schema.addField(name + "_Centroid_y", type=np.float64)
schema.getAliasMap().set('slot_Centroid', name + '_Centroid')
names = ["test2", "test"]
for name in names:
addApCorrName(name)
schema.addField(name + "_instFlux", type=np.float64)
schema.addField(name + "_instFluxErr", type=np.float64)
schema.addField(name + "_flag", type=np.float64)
schema.addField(name + "_Centroid_x", type=np.float64)
schema.addField(name + "_Centroid_y", type=np.float64)
schema.getAliasMap().set('slot_Centroid', name + '_Centroid')
self.ap_corr_task = applyApCorr.ApplyApCorrTask(schema=schema)
self.name = name
self.name = name # just use 'test' prefix for most of the tests
self.schema = schema

def tearDown(self):
Expand All @@ -72,6 +73,8 @@ def testAddFields(self):
self.assertIn(self.name + "_apCorr", self.schema.getNames())
self.assertIn(self.name + "_apCorrErr", self.schema.getNames())
self.assertIn(self.name + "_flag_apCorr", self.schema.getNames())
self.assertLess(self.schema.find("test_apCorr").key.getOffset(),
self.schema.find("test2_apCorr").key.getOffset())

def testSuccessUnflagged(self):
# Check that the aperture correction flag is set to False if aperture correction was successfully run
Expand Down