Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-13493: SourceSelector should accept saturated sources. #103

Merged
merged 2 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions python/lsst/meas/algorithms/sourceSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class BaseSourceSelectorConfig(pexConfig.Config):
"base_PixelFlags_flag_saturatedCenter",
"base_PixelFlags_flag_crCenter",
"base_PixelFlags_flag_bad",
"base_PixelFlags_flag_interpolated",
],
)

Expand Down Expand Up @@ -439,8 +438,7 @@ class ScienceSourceSelectorConfig(pexConfig.Config):

def setDefaults(self):
pexConfig.Config.setDefaults(self)
self.flags.bad = ["base_PixelFlags_flag_edge", "base_PixelFlags_flag_interpolated",
"base_PixelFlags_flag_saturated", "base_PsfFlux_flags"]
self.flags.bad = ["base_PixelFlags_flag_edge", "base_PixelFlags_flag_saturated", "base_PsfFlux_flags"]
self.signalToNoise.fluxField = "base_PsfFlux_flux"
self.signalToNoise.errField = "base_PsfFlux_fluxSigma"

Expand Down
13 changes: 9 additions & 4 deletions tests/test_astrometrySourceSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import lsst.meas.base.tests
import lsst.utils.tests

# badFlags are flags that, if the bad flag is set the objecct should be
# imediately thrown out. This is as opposed to combinations of flags
# badFlags are flags that, if the bad flag is set the object should be
# immediately thrown out. This is as opposed to combinations of flags
# signifying good or bad data. Such flags should then be a part of the
# isGood test.
badFlags = ["base_PixelFlags_flag_edge",
Expand All @@ -42,11 +42,14 @@
"base_PixelFlags_flag_saturatedCenter",
"base_PixelFlags_flag_crCenter",
"base_PixelFlags_flag_bad",
"base_PixelFlags_flag_interpolated",
"slot_Centroid_flag",
"slot_ApFlux_flag",
]

# goodFlags are flags that should NOT cause the object to be immediately
# thrown out, despite their possibly ominous-sounding names.
goodFlags = ["base_PixelFlags_flag_interpolated"]


def add_good_source(src, num=0):
"""Insert a likely-good source into the catalog."""
Expand All @@ -71,7 +74,7 @@ def setUp(self):
schema = lsst.meas.base.tests.TestDataset.makeMinimalSchema()
schema.addField("slot_ApFlux_flux", type=np.float64)
schema.addField("slot_ApFlux_fluxSigma", type=np.float64)
for flag in badFlags:
for flag in badFlags + goodFlags:
schema.addField(flag, type="Flag")

self.src = afwTable.SourceCatalog(schema)
Expand All @@ -84,6 +87,8 @@ def tearDown(self):
def testSelectSources_good(self):
for i in range(5):
add_good_source(self.src, i)
for flag in goodFlags:
self.src[i].set(flag, True)
result = self.sourceSelector.selectSources(self.src)
# TODO: assertEqual doesn't work correctly on source catalogs.
# self.assertEqual(result.sourceCat, self.src)
Expand Down