22__all__ = [
"MatcherSourceSelectorConfig",
"MatcherSourceSelectorTask"]
27from .sourceSelector
import BaseSourceSelectorConfig, BaseSourceSelectorTask, sourceSelectorRegistry
32 sourceFluxType = pexConfig.Field(
33 doc=
"Type of source flux; typically one of Ap or Psf",
37 minSnr = pexConfig.Field(
39 doc=
"Minimum allowed signal-to-noise ratio for sources used for matching "
40 "(in the flux specified by sourceFluxType); <= 0 for no limit",
43 excludePixelFlags = pexConfig.Field(
45 doc=
"Exclude objects that have saturated, interpolated, or edge "
46 "pixels using PixelFlags. For matchOptimisticB set this to False "
47 "to recover previous matcher selector behavior.",
52@pexConfig.registerConfigurable("matcher", sourceSelectorRegistry)
54 """Select sources that are useful for matching.
56 Good matching sources have high signal/noise, are non-blended. They need not
57 be PSF sources, just have reliable centroids.
59 Distinguished
from astrometrySourceSelector because it
is more lenient
60 (i.e.
not checking footprints
or bad flags).
62 ConfigClass = MatcherSourceSelectorConfig
65 BaseSourceSelectorTask.__init__(self, *args, **kwargs)
68 """Return a selection of sources that are useful for matching.
73 Catalog of sources to select from.
74 This catalog must be contiguous
in memory.
76 Ignored
in this SourceSelector.
78 The exposure the catalog was built
from; used
for debug display.
82 struct : `lsst.pipe.base.Struct`
83 The struct contains the following data:
86 Boolean array of sources that were selected, same length
as
87 sourceCat. (`numpy.ndarray` of `bool`)
92 if self.config.excludePixelFlags:
93 good = good & self.
_isGood(sourceCat)
94 return Struct(selected=good)
97 """Extract and save the necessary keys from schema with asKey.
104 fluxPrefix =
"slot_%sFlux_" % (self.config.sourceFluxType,)
106 self.
fluxKey = schema[fluxPrefix +
"instFlux"].asKey()
110 self.
edgeKey = schema[
"base_PixelFlags_flag_edge"].asKey()
115 """Return True for each source that is the parent source.
121 """Return True for each source that has a valid centroid
128 """Return True for each source that has Signal/Noise > config.minSnr.
130 if self.config.minSnr <= 0:
133 with np.errstate(invalid=
"ignore"):
138 Return True for each source that
is usable
for matching, even
if it may
139 have a poor centroid.
141 For a source to be usable it must:
143 - have a valid centroid
145 - have a valid instFlux (of the type specified
in this object
's constructor)
146 - have adequate signal-to-noise
155 Return True for each source that
is usable
for matching, even
if it may
156 have a poor centroid.
158 For a source to be usable it must:
160 - Not be on a CCD edge.
161 - Not have an interpolated pixel within 3x3 around their centroid.
162 - Not have a saturated pixel
in their footprint.
164 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)