Skip to content

Commit

Permalink
Do not reject saturated sources in SourceSelector.
Browse files Browse the repository at this point in the history
Per discussion on Slack of 2018-02-05:

> `interpolated`... now effectively means "this pixel was interpolated in one
> of the inputs and that's okay because we think the interpolation was good".

(Jim Bosch, in #subaru-hsc)

We should therefore not reject sources flagged as such in the source selector.
  • Loading branch information
jdswinbank committed Feb 6, 2018
1 parent d384ecf commit 209e0b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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 @@ -404,8 +403,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
9 changes: 7 additions & 2 deletions tests/test_astrometrySourceSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 209e0b0

Please sign in to comment.