Skip to content

Commit

Permalink
Respond to review comments
Browse files Browse the repository at this point in the history
Will be rebased after review
  • Loading branch information
abudlong committed Nov 1, 2024
1 parent 8edee25 commit 224260c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/calibrateImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ def setDefaults(self):
self.star_selector["science"].doUnresolved = True
self.star_selector["science"].doSignalToNoise = True
self.star_selector["science"].signalToNoise.minimum = 10.0
self.star_selector["science"].signalToNoise.fluxField = "slot_CalibFlux_instFlux"
self.star_selector["science"].signalToNoise.errField = "slot_CalibFlux_instFluxErr"
# Keep sky sources in the output catalog, even though they aren't
# wanted for calibration.
self.star_selector["science"].doSkySources = True
Expand Down
10 changes: 10 additions & 0 deletions python/lsst/pipe/tasks/photoCal.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def validate(self):
raise RuntimeError("applyColorTerms=True requires photoCatName is non-None")
if self.applyColorTerms and len(self.colorterms.data) == 0:
raise RuntimeError("applyColorTerms=True requires colorterms be provided")
if self.fluxField != self.match.sourceSelection.signalToNoise.fluxField:
raise RuntimeError("Configured flux field %s does not match source selector field %s",
self.fluxField, self.match.sourceSelection.signalToNoise.fluxField)
if self.fluxField + "Err" != self.match.sourceSelection.signalToNoise.errField:
raise RuntimeError("Configured flux field %sErr does not match source selector error field %s",
self.fluxField, self.match.sourceSelection.signalToNoise.errField)

def setDefaults(self):
pexConf.Config.setDefaults(self)
Expand All @@ -114,6 +120,10 @@ def setDefaults(self):
"base_PixelFlags_flag_saturated",
]
self.match.sourceSelection.doUnresolved = True
self.match.sourceSelection.doSignalToNoise = True
self.match.sourceSelection.signalToNoise.minimum = 10.0
self.match.sourceSelection.signalToNoise.fluxField = self.fluxField
self.match.sourceSelection.signalToNoise.errField = self.fluxField + "Err"


class PhotoCalTask(pipeBase.Task):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_calibrateImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def _check_run(self, calibrate, result):
self.assertEqual(result.stars["slot_PsfFlux_mag"].unit, u.ABmag)

# Should have detected all S/N >= 10 sources plus 2 sky sources, whether 1 or 2 snaps.
self.assertEqual(len(result.stars), 6)
self.assertEqual(len(result.stars), 7)
# Did the psf flags get propagated from the psf_stars catalog?
self.assertEqual(result.stars["calib_psf_used"].sum(), 3)

Expand Down Expand Up @@ -299,7 +299,7 @@ def test_find_stars(self):

# Only 5 psf-like sources with S/N>10 should be in the output catalog,
# plus two sky sources.
self.assertEqual(len(stars), 6)
self.assertEqual(len(stars), 7)
self.assertTrue(stars.isContiguous())
# Sort in order of brightness, to easily compare with expected positions.
stars.sort(stars.getPsfFluxSlot().getMeasKey())
Expand Down Expand Up @@ -399,8 +399,8 @@ def test_match_psf_stars(self):
# sort() above leaves the catalog non-contiguous.
stars = stars.copy(deep=True)
np.testing.assert_array_equal(stars["calib_psf_candidate"],
[False, False, False, True, True, True])
np.testing.assert_array_equal(stars["calib_psf_used"], [False, False, False, True, True, True])
[False, False, False, False, True, True, True])
np.testing.assert_array_equal(stars["calib_psf_used"], [False, False, False, False, True, True, True])
# Too few sources to reserve any in these tests.
self.assertEqual(stars["calib_psf_reserved"].sum(), 0)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_photoCal.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def setUp(self):
# The test and associated data have been prepared on the basis that we
# use the PsfFlux to perform photometry.
self.config.fluxField = "base_PsfFlux_instFlux"
self.config.match.sourceSelection.signalToNoise.fluxField = "base_PsfFlux_instFlux"
self.config.match.sourceSelection.signalToNoise.errField = "base_PsfFlux_instFluxErr"

def tearDown(self):
del self.srcCat
Expand Down

0 comments on commit 224260c

Please sign in to comment.