LSST Applications g0d97872fb5+4fd969bb9d,g1653933729+34a971ddd9,g28da252d5a+072f89fe25,g2bbee38e9b+a99b0ab4cd,g2bc492864f+a99b0ab4cd,g2ca4be77d2+c0e3b27cd8,g2cdde0e794+704103fe75,g3156d2b45e+6e87dc994a,g347aa1857d+a99b0ab4cd,g35bb328faa+34a971ddd9,g3a166c0a6a+a99b0ab4cd,g3e281a1b8c+8ec26ec694,g4005a62e65+ba0306790b,g414038480c+9ed5ed841a,g569e0e2b34+cb4faa46ad,g5a97de2502+520531a62c,g717e5f8c0f+29153700a5,g7ede599f99+367733290c,g80478fca09+17051a22cc,g82479be7b0+f2f1ea0a87,g858d7b2824+29153700a5,g8b782ad322+29153700a5,g8cd86fa7b1+05420e7f7d,g9125e01d80+34a971ddd9,ga5288a1d22+e7f674aaf3,gae0086650b+34a971ddd9,gae74b0b5c6+45ef5cdc51,gb58c049af0+ace264a4f2,gc28159a63d+a99b0ab4cd,gcf0d15dbbd+8051a81198,gda6a2b7d83+8051a81198,gdaeeff99f8+7774323b41,gdf4d240d4a+34a971ddd9,ge2409df99d+cb167bac99,ge33fd446bb+29153700a5,ge79ae78c31+a99b0ab4cd,gf0baf85859+890af219f9,gf5289d68f6+9faa5c5784,w.2024.36
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask Class Reference
Inheritance diagram for lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask:
lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 selectSources (self, sourceCat, matches=None, exposure=None)
 

Public Attributes

 parentKey
 
 nChildKey
 
 centroidXKey
 
 centroidYKey
 
 centroidXErrKey
 
 centroidYErrKey
 
 centroidFlagKey
 
 primaryKey
 
 edgeKey
 
 interpolatedCenterKey
 
 saturatedKey
 
 instFluxKey
 
 fluxFlagKey
 
 instFluxErrKey
 

Static Public Attributes

 ConfigClass = AstrometrySourceSelectorConfig
 

Protected Member Functions

 _getSchemaKeys (self, schema)
 
 _isMultiple (self, sourceCat)
 
 _hasCentroid (self, sourceCat)
 
 _goodSN (self, sourceCat)
 
 _isUsable (self, sourceCat)
 
 _isPrimary (self, sourceCat)
 
 _isGood (self, sourceCat)
 
 _isBadFlagged (self, source)
 

Detailed Description

Select sources that are useful for astrometry.

Good astrometry sources have high signal/noise, are non-blended, and
did not have certain "bad" flags set during source extraction. They need not
be PSF sources, just have reliable centroids.

Definition at line 72 of file astrometrySourceSelector.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.__init__ ( self,
* args,
** kwargs )

Reimplemented from lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask.

Definition at line 81 of file astrometrySourceSelector.py.

81 def __init__(self, *args, **kwargs):
82 BaseSourceSelectorTask.__init__(self, *args, **kwargs)
83

Member Function Documentation

◆ _getSchemaKeys()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._getSchemaKeys ( self,
schema )
protected
Extract and save the necessary keys from schema with asKey.

Definition at line 112 of file astrometrySourceSelector.py.

112 def _getSchemaKeys(self, schema):
113 """Extract and save the necessary keys from schema with asKey.
114 """
115 self.parentKey = schema["parent"].asKey()
116 self.nChildKey = schema["deblend_nChild"].asKey()
117 self.centroidXKey = schema["slot_Centroid_x"].asKey()
118 self.centroidYKey = schema["slot_Centroid_y"].asKey()
119 self.centroidXErrKey = schema["slot_Centroid_xErr"].asKey()
120 self.centroidYErrKey = schema["slot_Centroid_yErr"].asKey()
121 self.centroidFlagKey = schema["slot_Centroid_flag"].asKey()
122 try:
123 self.primaryKey = schema["detect_isPrimary"].asKey()
124 except NotFoundError:
125 self.primaryKey = None
126
127 self.edgeKey = schema["base_PixelFlags_flag_edge"].asKey()
128 self.interpolatedCenterKey = schema["base_PixelFlags_flag_interpolatedCenter"].asKey()
129 self.saturatedKey = schema["base_PixelFlags_flag_saturated"].asKey()
130
131 fluxPrefix = "slot_%sFlux_" % (self.config.sourceFluxType,)
132 self.instFluxKey = schema[fluxPrefix + "instFlux"].asKey()
133 self.fluxFlagKey = schema[fluxPrefix + "flag"].asKey()
134 self.instFluxErrKey = schema[fluxPrefix + "instFluxErr"].asKey()
135

◆ _goodSN()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._goodSN ( self,
sourceCat )
protected
Return True for each source that has Signal/Noise > config.minSnr.

Definition at line 160 of file astrometrySourceSelector.py.

160 def _goodSN(self, sourceCat):
161 """Return True for each source that has Signal/Noise > config.minSnr.
162 """
163 if self.config.minSnr <= 0:
164 return True
165 else:
166 with np.errstate(invalid="ignore"): # suppress NAN warnings
167 return sourceCat[self.instFluxKey]/sourceCat[self.instFluxErrKey] > self.config.minSnr
168

◆ _hasCentroid()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._hasCentroid ( self,
sourceCat )
protected
Return True for each source that has a valid centroid

Definition at line 146 of file astrometrySourceSelector.py.

146 def _hasCentroid(self, sourceCat):
147 """Return True for each source that has a valid centroid
148 """
149 def checkNonfiniteCentroid():
150 """Return True for sources with non-finite centroids.
151 """
152 return ~np.isfinite(sourceCat[self.centroidXKey]) | \
153 ~np.isfinite(sourceCat[self.centroidYKey])
154 assert ~checkNonfiniteCentroid().any(), \
155 "Centroids not finite for %d unflagged sources." % (checkNonfiniteCentroid().sum())
156 return np.isfinite(sourceCat[self.centroidXErrKey]) \
157 & np.isfinite(sourceCat[self.centroidYErrKey]) \
158 & ~sourceCat[self.centroidFlagKey]
159

◆ _isBadFlagged()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._isBadFlagged ( self,
source )
protected
Return True if any of config.badFlags are set for this source.

Definition at line 209 of file astrometrySourceSelector.py.

209 def _isBadFlagged(self, source):
210 """Return True if any of config.badFlags are set for this source.
211 """
212 return any(source[flag] for flag in self.config.badFlags)

◆ _isGood()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._isGood ( self,
sourceCat )
protected
Return True for each source that is usable for matching and likely has a
good centroid.

The additional tests for a good centroid, beyond isUsable, are:
- not interpolated in the center
- not saturated
- not near the edge

Definition at line 193 of file astrometrySourceSelector.py.

193 def _isGood(self, sourceCat):
194 """Return True for each source that is usable for matching and likely has a
195 good centroid.
196
197 The additional tests for a good centroid, beyond isUsable, are:
198 - not interpolated in the center
199 - not saturated
200 - not near the edge
201 """
202
203 return self._isUsable(sourceCat) \
204 & self._isPrimary(sourceCat) \
205 & ~sourceCat[self.saturatedKey] \
206 & ~sourceCat[self.interpolatedCenterKey] \
207 & ~sourceCat[self.edgeKey]
208

◆ _isMultiple()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._isMultiple ( self,
sourceCat )
protected
Return True for each source that is likely multiple sources.

Definition at line 136 of file astrometrySourceSelector.py.

136 def _isMultiple(self, sourceCat):
137 """Return True for each source that is likely multiple sources.
138 """
139 test = (sourceCat[self.parentKey] != 0) | (sourceCat[self.nChildKey] != 0)
140 # have to currently manage footprints on a source-by-source basis.
141 for i, cat in enumerate(sourceCat):
142 footprint = cat.getFootprint()
143 test[i] |= (footprint is not None) and (len(footprint.getPeaks()) > 1)
144 return test
145

◆ _isPrimary()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._isPrimary ( self,
sourceCat )
protected
Return True if this is a primary source.

Definition at line 185 of file astrometrySourceSelector.py.

185 def _isPrimary(self, sourceCat):
186 """Return True if this is a primary source.
187 """
188 if self.primaryKey:
189 return sourceCat[self.primaryKey]
190 else:
191 return np.ones(len(sourceCat), dtype=bool)
192

◆ _isUsable()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask._isUsable ( self,
sourceCat )
protected
Return True for each source that is usable for matching, even if it may
have a poor centroid.

For a source to be usable it must:
- have a valid centroid
- not be deblended
- have a valid flux (of the type specified in this object's constructor)
- have adequate signal-to-noise

Definition at line 169 of file astrometrySourceSelector.py.

169 def _isUsable(self, sourceCat):
170 """Return True for each source that is usable for matching, even if it may
171 have a poor centroid.
172
173 For a source to be usable it must:
174 - have a valid centroid
175 - not be deblended
176 - have a valid flux (of the type specified in this object's constructor)
177 - have adequate signal-to-noise
178 """
179
180 return self._hasCentroid(sourceCat) \
181 & ~self._isMultiple(sourceCat) \
182 & self._goodSN(sourceCat) \
183 & ~sourceCat[self.fluxFlagKey]
184

◆ selectSources()

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.selectSources ( self,
sourceCat,
matches = None,
exposure = None )
Return a selection of sources that are useful for astrometry.

Parameters
----------
sourceCat : `lsst.afw.table.SourceCatalog`
    Catalog of sources to select from.
    This catalog must be contiguous in memory.
matches : `list` of `lsst.afw.table.ReferenceMatch` or None
    Ignored in this SourceSelector.
exposure : `lsst.afw.image.Exposure` or None
    The exposure the catalog was built from; used for debug display.

Returns
-------
struct : `lsst.pipe.base.Struct`
    The struct contains the following data:

    ``selected``
        Boolean array of sources that were selected, same length as
        sourceCat. (`numpy.ndarray` of `bool`)

Reimplemented from lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask.

Definition at line 84 of file astrometrySourceSelector.py.

84 def selectSources(self, sourceCat, matches=None, exposure=None):
85 """Return a selection of sources that are useful for astrometry.
86
87 Parameters
88 ----------
89 sourceCat : `lsst.afw.table.SourceCatalog`
90 Catalog of sources to select from.
91 This catalog must be contiguous in memory.
92 matches : `list` of `lsst.afw.table.ReferenceMatch` or None
93 Ignored in this SourceSelector.
94 exposure : `lsst.afw.image.Exposure` or None
95 The exposure the catalog was built from; used for debug display.
96
97 Returns
98 -------
99 struct : `lsst.pipe.base.Struct`
100 The struct contains the following data:
101
102 ``selected``
103 Boolean array of sources that were selected, same length as
104 sourceCat. (`numpy.ndarray` of `bool`)
105 """
106 self._getSchemaKeys(sourceCat.schema)
107
108 bad = reduce(lambda x, y: np.logical_or(x, sourceCat[y]), self.config.badFlags, False)
109 good = self._isGood(sourceCat)
110 return Struct(selected=good & ~bad)
111

Member Data Documentation

◆ centroidFlagKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.centroidFlagKey

Definition at line 121 of file astrometrySourceSelector.py.

◆ centroidXErrKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.centroidXErrKey

Definition at line 119 of file astrometrySourceSelector.py.

◆ centroidXKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.centroidXKey

Definition at line 117 of file astrometrySourceSelector.py.

◆ centroidYErrKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.centroidYErrKey

Definition at line 120 of file astrometrySourceSelector.py.

◆ centroidYKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.centroidYKey

Definition at line 118 of file astrometrySourceSelector.py.

◆ ConfigClass

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.ConfigClass = AstrometrySourceSelectorConfig
static

Definition at line 79 of file astrometrySourceSelector.py.

◆ edgeKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.edgeKey

Definition at line 127 of file astrometrySourceSelector.py.

◆ fluxFlagKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.fluxFlagKey

Definition at line 133 of file astrometrySourceSelector.py.

◆ instFluxErrKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.instFluxErrKey

Definition at line 134 of file astrometrySourceSelector.py.

◆ instFluxKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.instFluxKey

Definition at line 132 of file astrometrySourceSelector.py.

◆ interpolatedCenterKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.interpolatedCenterKey

Definition at line 128 of file astrometrySourceSelector.py.

◆ nChildKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.nChildKey

Definition at line 116 of file astrometrySourceSelector.py.

◆ parentKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.parentKey

Definition at line 115 of file astrometrySourceSelector.py.

◆ primaryKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.primaryKey

Definition at line 123 of file astrometrySourceSelector.py.

◆ saturatedKey

lsst.meas.algorithms.astrometrySourceSelector.AstrometrySourceSelectorTask.saturatedKey

Definition at line 129 of file astrometrySourceSelector.py.


The documentation for this class was generated from the following file: