Skip to content

Commit

Permalink
Add doRequireFiniteRaDec to ReferenceSourceSelectorTask.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Jan 18, 2024
1 parent 19b87e8 commit 96bfa61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/lsst/meas/algorithms/sourceSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={},
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions tests/test_sourceSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 96bfa61

Please sign in to comment.