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 | 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 78 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 92 of file ref_match.py.

92 def __init__(self, refObjLoader=None, **kwargs):
93 pipeBase.Task.__init__(self, **kwargs)
94 if refObjLoader:
95 self.refObjLoader = refObjLoader
96 else:
97 self.refObjLoader = None
98
99 if self.config.sourceSelector.name == 'matcher':
100 if self.config.sourceSelector['matcher'].sourceFluxType != self.config.sourceFluxType:
101 raise RuntimeError("The sourceFluxType in the sourceSelector['matcher'] must match "
102 "the configured sourceFluxType")
103
104 self.makeSubtask("matcher")
105 self.makeSubtask("sourceSelector")
106 self.makeSubtask("referenceSelector")
107

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 209 of file ref_match.py.

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

◆ 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 119 of file ref_match.py.

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

◆ 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 108 of file ref_match.py.

108 def setRefObjLoader(self, refObjLoader):
109 """Sets the reference object loader for the task.
110
111 Parameters
112 ----------
113 refObjLoader
114 An instance of a reference object loader task or class.
115 """
116 self.refObjLoader = refObjLoader
117

Member Data Documentation

◆ _DefaultName

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

Definition at line 90 of file ref_match.py.

◆ ConfigClass

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

Definition at line 89 of file ref_match.py.

◆ refObjLoader

lsst.meas.astrom.ref_match.RefMatchTask.refObjLoader

Definition at line 95 of file ref_match.py.


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