diff --git a/python/lsst/meas/algorithms/pcaPsfDeterminer.py b/python/lsst/meas/algorithms/pcaPsfDeterminer.py index f90c33319..6c957b5aa 100644 --- a/python/lsst/meas/algorithms/pcaPsfDeterminer.py +++ b/python/lsst/meas/algorithms/pcaPsfDeterminer.py @@ -211,6 +211,8 @@ def determinePsf(self, exposure, psfCandidateList, metadata=None, flagKey=None): psfCellSet : `lsst.afw.math.SpatialCellSet` The PSF candidates. """ + psfCandidateList = self.downsampleCandidates(psfCandidateList) + import lsstDebug display = lsstDebug.Info(__name__).display displayExposure = lsstDebug.Info(__name__).displayExposure # display the Exposure + spatialCells diff --git a/tests/test_psfDetermination.py b/tests/test_psfDetermination.py index 6b9e2be31..2179b8929 100755 --- a/tests/test_psfDetermination.py +++ b/tests/test_psfDetermination.py @@ -457,6 +457,22 @@ def testDownsamplePca(self): """Test PCA determiner with downsampling. """ self.setupDeterminer() + metadata = dafBase.PropertyList() + + # Decrease the maximum number of stars. + self.psfDeterminer.config.maxCandidates = 10 + + stars = self.starSelector.run(self.catalog, exposure=self.exposure) + psfCandidateList = self.makePsfCandidates.run(stars.sourceCat, self.exposure).psfCandidates + psf, cellSet = self.psfDeterminer.determinePsf(self.exposure, psfCandidateList, metadata) + + # Confirm that only 10 candidates have valid chi2 values. + nGoodChi2 = 0 + for cand in psfCandidateList: + if cand.getChi2() < 1e10: + nGoodChi2 += 1 + + self.assertEqual(nGoodChi2, 10) class PsfCandidateTestCase(lsst.utils.tests.TestCase):