22__all__ = [
"MatcherSourceSelectorConfig",
"MatcherSourceSelectorTask"]
24from deprecated.sphinx
import deprecated
29from .sourceSelector
import BaseSourceSelectorConfig, BaseSourceSelectorTask, sourceSelectorRegistry
34 sourceFluxType = pexConfig.Field(
35 doc=
"Type of source flux; typically one of Ap or Psf",
39 minSnr = pexConfig.Field(
41 doc=
"Minimum allowed signal-to-noise ratio for sources used for matching "
42 "(in the flux specified by sourceFluxType); <= 0 for no limit",
45 excludePixelFlags = pexConfig.Field(
47 doc=
"Exclude objects that have saturated, interpolated, or edge "
48 "pixels using PixelFlags. For matchOptimisticB set this to False "
49 "to recover previous matcher selector behavior.",
55@deprecated(reason=(
"This Task has been replaced by an appropriately configured ScienceSourceSelector."
56 " Will be removed after v27."),
57 version=
"v27.0", category=FutureWarning)
58@pexConfig.registerConfigurable("matcher", sourceSelectorRegistry)
60 """Select sources that are useful for matching.
62 Good matching sources have high signal/noise, are non-blended. They need not
63 be PSF sources, just have reliable centroids.
65 Distinguished from astrometrySourceSelector because it is more lenient
66 (i.e. not checking footprints or bad flags).
68 ConfigClass = MatcherSourceSelectorConfig
71 BaseSourceSelectorTask.__init__(self, *args, **kwargs)
74 """Return a selection of sources that are useful for matching.
78 sourceCat : `lsst.afw.table.SourceCatalog`
79 Catalog of sources to select from.
80 This catalog must be contiguous in memory.
81 matches : `list` of `lsst.afw.table.ReferenceMatch` or None
82 Ignored in this SourceSelector.
83 exposure : `lsst.afw.image.Exposure` or None
84 The exposure the catalog was built from; used for debug display.
88 struct : `lsst.pipe.base.Struct`
89 The struct contains the following data:
92 Boolean array of sources that were selected, same length as
93 sourceCat. (`numpy.ndarray` of `bool`)
98 if self.config.excludePixelFlags:
99 good = good & self.
_isGood(sourceCat)
100 return Struct(selected=good)
103 """Extract and save the necessary keys from schema with asKey.
110 fluxPrefix =
"slot_%sFlux_" % (self.config.sourceFluxType,)
112 self.
fluxKey = schema[fluxPrefix +
"instFlux"].asKey()
116 self.
edgeKey = schema[
"base_PixelFlags_flag_edge"].asKey()
121 """Return True for each source that is the parent source.
127 """Return True for each source that has a valid centroid
134 """Return True for each source that has Signal/Noise > config.minSnr.
136 if self.config.minSnr <= 0:
139 with np.errstate(invalid=
"ignore"):
144 Return True for each source that is usable for matching, even if it may
145 have a poor centroid.
147 For a source to be usable it must:
149 - have a valid centroid
151 - have a valid instFlux (of the type specified in this object's constructor)
152 - have adequate signal-to-noise
161 Return True for each source that is usable for matching, even if it may
162 have a poor centroid.
164 For a source to be usable it must:
166 - Not be on a CCD edge.
167 - Not have an interpolated pixel within 3x3 around their centroid.
168 - Not have a saturated pixel in their footprint.
170 return ~sourceCat[self.
edgeKey] & \
_hasCentroid(self, sourceCat)
selectSources(self, sourceCat, matches=None, exposure=None)
_isUsable(self, sourceCat)
_getSchemaKeys(self, schema)
_isParent(self, sourceCat)
__init__(self, *args, **kwargs)