Skip to content

Commit

Permalink
Add downselection of stars for PsfexPsfDeterminer.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Apr 12, 2024
1 parent beb006f commit dceabe7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/lsst/meas/extensions/psfex/psfexPsfDeterminer.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def determinePsf(self, exposure, psfCandidateList, metadata=None, flagKey=None):
psf: `lsst.meas.extensions.psfex.PsfexPsf`
The determined PSF.
"""
psfCandidateList = self.downsampleCandidates(psfCandidateList)

import lsstDebug
display = lsstDebug.Info(__name__).display
Expand Down
17 changes: 17 additions & 0 deletions tests/test_PsfexPsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,23 @@ def testPsfDeterminerChangeFluxField(self):
# Test how well we can subtract the PSF model
self.subtractStars(self.exposure, self.catalog, chi_lim=5.6)

def testPsfDeterminerDownsample(self):
"""Test the psfDeterminer with downsampling."""
self.setupDeterminer(self.exposure)
metadata = dafBase.PropertyList()

# Decrease the maximum number of stars.
# Without more changes to the test harness, we do not have access
# to which psf stars were used. With only 3 stars we fail below
# so we use this to confirm that the selection code is
# triggering.
self.psfDeterminer.config.maxCandidates = 3

stars = self.starSelector.run(self.catalog, exposure=self.exposure)
psfCandidateList = self.makePsfCandidates.run(stars.sourceCat, exposure=self.exposure).psfCandidates
with self.assertRaisesRegex(RuntimeError, "Failed to determine"):
psf, cellSet = self.psfDeterminer.determinePsf(self.exposure, psfCandidateList, metadata)


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

0 comments on commit dceabe7

Please sign in to comment.