LSST Applications 24.1.5,g02d81e74bb+fa3a7a026e,g180d380827+a53a32eff8,g2079a07aa2+86d27d4dc4,g2305ad1205+c0501b3732,g295015adf3+7d3e92f0ec,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+5dd1654d75,g48712c4677+3bf1020dcb,g487adcacf7+065c13d9cf,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+d7ac436cfb,g5a732f18d5+53520f316c,g64a986408d+fa3a7a026e,g858d7b2824+fa3a7a026e,g8a8a8dda67+585e252eca,g99cad8db69+a5a909b84f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+4cf350ccb2,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+f991a0b59f,gc120e1dc64+9ccbfdb8be,gc28159a63d+0e5473021a,gcf0d15dbbd+5dd1654d75,gd96a1ce819+42fd0ee607,gdaeeff99f8+f9a426f77a,ge6526c86ff+0d71447b4b,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+fa3a7a026e
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Attributes | List of all members
lsst.meas.astrom.ref_match.RefMatchTask Class Reference
Inheritance diagram for lsst.meas.astrom.ref_match.RefMatchTask:
lsst.meas.astrom.astrometry.AstrometryTask

Public Member Functions

 __init__ (self, refObjLoader=None, **kwargs)
 
 setRefObjLoader (self, refObjLoader)
 
 loadAndMatch (self, exposure, sourceCat)
 

Public Attributes

 refObjLoader
 

Static Public Attributes

 ConfigClass = RefMatchConfig
 

Protected Member Functions

 _computeMatchStatsOnSky (self, matchList)
 

Static Protected Attributes

str _DefaultName = "calibrationBaseClass"
 

Detailed Description

Match an input source catalog with objects from a reference catalog.

Parameters
----------
refObjLoader : `lsst.meas.algorithms.ReferenceLoader`
    A reference object loader object; gen3 pipeline tasks will pass `None`
    and call `setRefObjLoader` in `runQuantum`.
**kwargs
    Additional keyword arguments for pipe_base `lsst.pipe.base.Task`.

Definition at line 72 of file ref_match.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.astrom.ref_match.RefMatchTask.__init__ ( self,
refObjLoader = None,
** kwargs )

Reimplemented in lsst.meas.astrom.astrometry.AstrometryTask.

Definition at line 86 of file ref_match.py.

86 def __init__(self, refObjLoader=None, **kwargs):
87 pipeBase.Task.__init__(self, **kwargs)
88 if refObjLoader:
89 self.refObjLoader = refObjLoader
90 else:
91 self.refObjLoader = None
92
93 if self.config.sourceSelector.name == 'matcher':
94 if self.config.sourceSelector['matcher'].sourceFluxType != self.config.sourceFluxType:
95 raise RuntimeError("The sourceFluxType in the sourceSelector['matcher'] must match "
96 "the configured sourceFluxType")
97
98 self.makeSubtask("matcher")
99 self.makeSubtask("sourceSelector")
100 self.makeSubtask("referenceSelector")
101

Member Function Documentation

◆ _computeMatchStatsOnSky()

lsst.meas.astrom.ref_match.RefMatchTask._computeMatchStatsOnSky ( self,
matchList )
protected
Compute on-sky radial distance statistics for a match list

Parameters
----------
matchList : `list` of `lsst.afw.table.ReferenceMatch`
    list of matches between reference object and sources;
    the distance field is the only field read and it must be set to distance in radians

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with components:

    - ``distMean`` : clipped mean of on-sky radial separation (`float`)
    - ``distStdDev`` : clipped standard deviation of on-sky radial
      separation (`float`)
    - ``maxMatchDist`` : distMean + self.config.matchDistanceSigma *
      distStdDev (`float`)

Definition at line 202 of file ref_match.py.

202 def _computeMatchStatsOnSky(self, matchList):
203 """Compute on-sky radial distance statistics for a match list
204
205 Parameters
206 ----------
207 matchList : `list` of `lsst.afw.table.ReferenceMatch`
208 list of matches between reference object and sources;
209 the distance field is the only field read and it must be set to distance in radians
210
211 Returns
212 -------
213 result : `lsst.pipe.base.Struct`
214 Result struct with components:
215
216 - ``distMean`` : clipped mean of on-sky radial separation (`float`)
217 - ``distStdDev`` : clipped standard deviation of on-sky radial
218 separation (`float`)
219 - ``maxMatchDist`` : distMean + self.config.matchDistanceSigma *
220 distStdDev (`float`)
221 """
222 distStatsInRadians = makeMatchStatistics(matchList, afwMath.MEANCLIP | afwMath.STDEVCLIP)
223 distMean = distStatsInRadians.getValue(afwMath.MEANCLIP)*lsst.geom.radians
224 distStdDev = distStatsInRadians.getValue(afwMath.STDEVCLIP)*lsst.geom.radians
225 return pipeBase.Struct(
226 distMean=distMean,
227 distStdDev=distStdDev,
228 maxMatchDist=distMean + self.config.matchDistanceSigma * distStdDev,
229 )

◆ loadAndMatch()

lsst.meas.astrom.ref_match.RefMatchTask.loadAndMatch ( self,
exposure,
sourceCat )
Load reference objects overlapping an exposure and match to sources
detected on that exposure.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    exposure that the sources overlap
sourceCat : `lsst.afw.table.SourceCatalog.`
    catalog of sources detected on the exposure

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with Components:

    - ``refCat`` : reference object catalog of objects that overlap the
      exposure (`lsst.afw.table.SimpleCatalog`)
    - ``matches`` :  Matched sources and references
      (`list` of `lsst.afw.table.ReferenceMatch`)
    - ``matchMeta`` : metadata needed to unpersist matches
      (`lsst.daf.base.PropertyList`)

Notes
-----
ignores config.matchDistanceSigma

Definition at line 113 of file ref_match.py.

113 def loadAndMatch(self, exposure, sourceCat):
114 """Load reference objects overlapping an exposure and match to sources
115 detected on that exposure.
116
117 Parameters
118 ----------
119 exposure : `lsst.afw.image.Exposure`
120 exposure that the sources overlap
121 sourceCat : `lsst.afw.table.SourceCatalog.`
122 catalog of sources detected on the exposure
123
124 Returns
125 -------
126 result : `lsst.pipe.base.Struct`
127 Result struct with Components:
128
129 - ``refCat`` : reference object catalog of objects that overlap the
130 exposure (`lsst.afw.table.SimpleCatalog`)
131 - ``matches`` : Matched sources and references
132 (`list` of `lsst.afw.table.ReferenceMatch`)
133 - ``matchMeta`` : metadata needed to unpersist matches
134 (`lsst.daf.base.PropertyList`)
135
136 Notes
137 -----
138 ignores config.matchDistanceSigma
139 """
140 if self.refObjLoader is None:
141 raise RuntimeError("Running matcher task with no refObjLoader set in __ini__ or setRefObjLoader")
142 import lsstDebug
143 debug = lsstDebug.Info(__name__)
144
145 epoch = exposure.visitInfo.date.toAstropy()
146
147 sourceSelection = self.sourceSelector.run(sourceCat)
148
149 sourceFluxField = "slot_%sFlux_instFlux" % (self.config.sourceFluxType)
150
151 loadRes = self.refObjLoader.loadPixelBox(
152 bbox=exposure.getBBox(),
153 wcs=exposure.wcs,
154 filterName=exposure.filter.bandLabel,
155 epoch=epoch,
156 )
157
158 refSelection = self.referenceSelector.run(loadRes.refCat)
159
160 matchMeta = self.refObjLoader.getMetadataBox(
161 bbox=exposure.getBBox(),
162 wcs=exposure.wcs,
163 filterName=exposure.filter.bandLabel,
164 epoch=epoch,
165 )
166
167 matchRes = self.matcher.matchObjectsToSources(
168 refCat=refSelection.sourceCat,
169 sourceCat=sourceSelection.sourceCat,
170 wcs=exposure.wcs,
171 sourceFluxField=sourceFluxField,
172 refFluxField=loadRes.fluxField,
173 matchTolerance=None,
174 )
175
176 distStats = self._computeMatchStatsOnSky(matchRes.matches)
177 self.log.info(
178 "Found %d matches with scatter = %0.3f +- %0.3f arcsec; ",
179 len(matchRes.matches), distStats.distMean.asArcseconds(), distStats.distStdDev.asArcseconds()
180 )
181
182 if debug.display:
183 frame = int(debug.frame)
184 displayAstrometry(
185 refCat=refSelection.sourceCat,
186 sourceCat=sourceSelection.sourceCat,
187 matches=matchRes.matches,
188 exposure=exposure,
189 bbox=exposure.getBBox(),
190 frame=frame,
191 title="Matches",
192 )
193
194 return pipeBase.Struct(
195 refCat=loadRes.refCat,
196 refSelection=refSelection,
197 sourceSelection=sourceSelection,
198 matches=matchRes.matches,
199 matchMeta=matchMeta,
200 )
201

◆ setRefObjLoader()

lsst.meas.astrom.ref_match.RefMatchTask.setRefObjLoader ( self,
refObjLoader )
Sets the reference object loader for the task.

Parameters
----------
refObjLoader
    An instance of a reference object loader task or class.

Definition at line 102 of file ref_match.py.

102 def setRefObjLoader(self, refObjLoader):
103 """Sets the reference object loader for the task.
104
105 Parameters
106 ----------
107 refObjLoader
108 An instance of a reference object loader task or class.
109 """
110 self.refObjLoader = refObjLoader
111

Member Data Documentation

◆ _DefaultName

str lsst.meas.astrom.ref_match.RefMatchTask._DefaultName = "calibrationBaseClass"
staticprotected

Definition at line 84 of file ref_match.py.

◆ ConfigClass

lsst.meas.astrom.ref_match.RefMatchTask.ConfigClass = RefMatchConfig
static

Definition at line 83 of file ref_match.py.

◆ refObjLoader

lsst.meas.astrom.ref_match.RefMatchTask.refObjLoader

Definition at line 89 of file ref_match.py.


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