Skip to content

Commit

Permalink
Add tests for flux field override.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Sep 20, 2023
1 parent 8f4d9f9 commit df1de8c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/test_PsfexPsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def tearDown(self):
del self.schema
del self.measureSources

def setupDeterminer(self, exposure):
def setupDeterminer(self, exposure, fluxField=None):
"""Setup the starSelector and psfDeterminer"""
starSelectorClass = measAlg.sourceSelectorRegistry["objectSize"]
starSelectorConfig = starSelectorClass.ConfigClass()
Expand All @@ -221,6 +221,8 @@ def setupDeterminer(self, exposure):
psfDeterminerConfig.sizeCellX = width
psfDeterminerConfig.sizeCellY = height//3
psfDeterminerConfig.spatialOrder = 1
if fluxField is not None:
psfDeterminerConfig.photometricFluxField = fluxField

self.psfDeterminer = psfDeterminerClass(psfDeterminerConfig)

Expand Down Expand Up @@ -284,6 +286,21 @@ def testPsfexDeterminerTooFewStars(self):
with self.assertRaisesRegex(RuntimeError, "Failed to determine"):
psf, cellSet = self.psfDeterminer.determinePsf(self.exposure, psfCandidateListShort, metadata)

def testPsfDeterminerChangeFluxField(self):
"""Test the psfDeterminer with a different flux normalization field."""
# We test here with an aperture that we would be unlikely to ever use
# as a default.
self.setupDeterminer(self.exposure, fluxField="base_CircularApertureFlux_6_0_instFlux")
metadata = dafBase.PropertyList()

stars = self.starSelector.run(self.catalog, exposure=self.exposure)
psfCandidateList = self.makePsfCandidates.run(stars.sourceCat, exposure=self.exposure).psfCandidates
psf, cellSet = self.psfDeterminer.determinePsf(self.exposure, psfCandidateList, metadata)
self.exposure.setPsf(psf)

# Test how well we can subtract the PSF model
self.subtractStars(self.exposure, self.catalog, chi_lim=5.6)


class TestMemory(lsst.utils.tests.MemoryTestCase):
pass
Expand Down

0 comments on commit df1de8c

Please sign in to comment.