From 96bfa61e74ee0fc7cfcf00631d7d4212e6f66cca Mon Sep 17 00:00:00 2001 From: Eli Rykoff Date: Thu, 18 Jan 2024 10:25:19 -0800 Subject: [PATCH] Add doRequireFiniteRaDec to ReferenceSourceSelectorTask. --- python/lsst/meas/algorithms/sourceSelector.py | 6 ++++++ tests/test_sourceSelector.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/python/lsst/meas/algorithms/sourceSelector.py b/python/lsst/meas/algorithms/sourceSelector.py index b35ce74e8..3000540d0 100644 --- a/python/lsst/meas/algorithms/sourceSelector.py +++ b/python/lsst/meas/algorithms/sourceSelector.py @@ -646,9 +646,13 @@ class ReferenceSourceSelectorConfig(pexConfig.Config): doUnresolved = pexConfig.Field(dtype=bool, default=False, doc="Apply unresolved limitation?") doSignalToNoise = pexConfig.Field(dtype=bool, default=False, doc="Apply signal-to-noise limit?") doMagError = pexConfig.Field(dtype=bool, default=False, doc="Apply magnitude error limit?") + doRequireFiniteRaDec = pexConfig.Field(dtype=bool, default=True, + doc="Apply finite sky coordinate check?") magLimit = pexConfig.ConfigField(dtype=MagnitudeLimit, doc="Magnitude limit to apply") flags = pexConfig.ConfigField(dtype=RequireFlags, doc="Flags to require") unresolved = pexConfig.ConfigField(dtype=RequireUnresolved, doc="Star/galaxy separation to apply") + requireFiniteRaDec = pexConfig.ConfigField(dtype=RequireFiniteRaDec, + doc="Finite sky coordinate criteria to apply") signalToNoise = pexConfig.ConfigField(dtype=SignalToNoiseLimit, doc="Signal-to-noise limit to apply") magError = pexConfig.ConfigField(dtype=MagnitudeErrorLimit, doc="Magnitude error limit to apply") colorLimits = pexConfig.ConfigDictField(keytype=str, itemtype=ColorLimit, default={}, @@ -698,6 +702,8 @@ def selectSources(self, sourceCat, matches=None, exposure=None): selected &= self.config.signalToNoise.apply(sourceCat) if self.config.doMagError: selected &= self.config.magError.apply(sourceCat) + if self.config.doRequireFiniteRaDec: + selected &= self.config.requireFiniteRaDec.apply(sourceCat) for limit in self.config.colorLimits.values(): selected &= limit.apply(sourceCat) diff --git a/tests/test_sourceSelector.py b/tests/test_sourceSelector.py index 620121453..089c90675 100644 --- a/tests/test_sourceSelector.py +++ b/tests/test_sourceSelector.py @@ -225,6 +225,7 @@ def setUp(self): self.config.doMagLimit = True self.config.doFlags = True self.config.doUnresolved = False + self.config.doRequireFiniteRaDec = False def testMagnitudeLimit(self): tooBright = self.catalog.addNew() @@ -329,6 +330,11 @@ def testUnresolved(self): self.config.unresolved.maximum = None self.check((starGalaxy > minimum).tolist()) + def testFiniteRaDec(self): + num = 5 + for _ in range(num): + self.catalog.addNew() + class TestBaseSourceSelector(lsst.utils.tests.TestCase): """Test the API of the Abstract Base Class with a trivial example."""