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 13, 2024
1 parent beb006f commit 08aca30
Show file tree
Hide file tree
Showing 2 changed files with 20 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
19 changes: 19 additions & 0 deletions tests/test_PsfexPsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,25 @@ 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 = 10

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.assertEqual(metadata['numAvailStars'], self.psfDeterminer.config.maxCandidates)
self.assertEqual(metadata['numGoodStars'], self.psfDeterminer.config.maxCandidates)


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

0 comments on commit 08aca30

Please sign in to comment.