Skip to content

Commit

Permalink
Set flux and error fields to use CalibFlux and update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abudlong committed Dec 18, 2024
1 parent 7b1fe5c commit 7662a48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions python/lsst/pipe/tasks/calibrateImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ def setDefaults(self):
# Keep sky sources in the output catalog, even though they aren't
# wanted for calibration.
self.star_selector["science"].doSkySources = True
# Set the flux and error fields
self.star_selector["science"].signalToNoise.fluxField = "slot_CalibFlux_instFlux"
self.star_selector["science"].signalToNoise.errField = "slot_CalibFlux_instFluxErr"

# Use the affine WCS fitter (assumes we have a good camera geometry).
self.astrometry.wcsFitter.retarget(lsst.meas.astrom.FitAffineWcsTask)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_calibrateImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _check_run(self, calibrate, result, expect_calibrated_pixels: bool = True):
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), 7)
self.assertEqual(len(result.stars), 6)
# Did the psf flags get propagated from the psf_stars catalog?
self.assertEqual(result.stars["calib_psf_used"].sum(), 3)

Expand Down Expand Up @@ -319,7 +319,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), 7)
self.assertEqual(len(stars), 6)
self.assertTrue(stars.isContiguous())
# Sort in order of brightness, to easily compare with expected positions.
stars.sort(stars.getPsfFluxSlot().getMeasKey())
Expand Down Expand Up @@ -420,8 +420,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, False, True, True, True])
np.testing.assert_array_equal(stars["calib_psf_used"], [False, False, False, False, True, True, True])
[False, False, False, True, True, True])
np.testing.assert_array_equal(stars["calib_psf_used"], [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

0 comments on commit 7662a48

Please sign in to comment.