LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
lsst.meas.astrom.anetAstrometry.ANetAstrometryTask Class Reference

Use astrometry.net to match input sources with a reference catalog and solve for the Wcs. More...

Inheritance diagram for lsst.meas.astrom.anetAstrometry.ANetAstrometryTask:

Public Member Functions

def __init__
 Create the astrometric calibration task. More...
 
def run
 Load reference objects, match sources and optionally fit a WCS. More...
 
def solve
 Match with reference sources and calculate an astrometric solution. More...
 
def distort
 Calculate distorted source positions. More...
 
def distortionContext
 Context manager that applies and removes distortion. More...
 
def loadAndMatch
 Load reference objects overlapping an exposure and match to sources detected on that exposure. More...
 
def refitWcs
 A final Wcs solution after matching and removing distortion. More...
 

Public Attributes

 distortedName
 
 centroidXKey
 
 centroidYKey
 
 centroidXErrKey
 
 centroidYErrKey
 
 centroidFlagKey
 
 centroidKey
 
 centroidErrKey
 
 solver
 

Static Public Attributes

 ConfigClass = ANetAstrometryConfig
 

Private Member Functions

def _astrometry
 Solve astrometry to produce WCS. More...
 

Detailed Description

Use astrometry.net to match input sources with a reference catalog and solve for the Wcs.

The actual matching and solving is done by the 'solver'; this Task serves as a wrapper for taking into account the known optical distortion.

Contents

Description

Use astrometry.net to match input sources with a reference catalog and solve for the Wcs.

Task initialisation

Create the astrometric calibration task. Most arguments are simply passed onto pipe.base.Task.

Parameters
schemaAn lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
**kwdskeyword arguments to be passed to the lsst.pipe.base.task.Task constructor

A centroid field "centroid.distorted" (used internally during the Task's operation) will be added to the schema.

Invoking the Task

Load reference objects, match sources and optionally fit a WCS. This is a thin layer around solve or loadAndMatch, depending on config.forceKnownWcs

Parameters
[in,out]exposureexposure whose WCS is to be fit The following are read only:
  • bbox
  • calib (may be absent)
  • filter (may be unset)
  • detector (if wcs is pure tangent; may be absent) The following are updated:
  • wcs (the initial value is used as an initial guess, and is required)
[in]sourceCatcatalog of sourceCat detected on the exposure (an lsst.afw.table.SourceCatalog)
Returns
an lsst.pipe.base.Struct with these fields:
  • refCat reference object catalog of objects that overlap the exposure (with some margin) (an lsst::afw::table::SimpleCatalog)
  • matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
  • matchMeta metadata about the field (an lsst.daf.base.PropertyList)

Configuration parameters

See ANetAstrometryConfig

Debug variables

The command line task interface supports a flag -d to import debug.py from your PYTHONPATH; see Using lsstDebug to control debugging output for more about debug.py files.

The available variables in ANetAstrometryTask are:

display
If True call showAstrometry while iterating ANetAstrometryConfig.rejectIter times, and also after converging; and call displayAstrometry after applying the distortion correction.
frame
ds9 frame to use in showAstrometry and displayAstrometry
pause
Pause after showAstrometry and displayAstrometry?

A complete example of using ANetAstrometryTask

See meas_photocal_photocal_Example.

To investigate the Debug variables, put something like

1 import lsstDebug
2 def DebugInfo(name):
3  di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
4  if name in ("lsst.pipe.tasks.anetAstrometry", "lsst.pipe.tasks.anetBasicAstrometry"):
5  di.display = 1
6  di.frame = 1
7  di.pause = True
8 
9  return di
10 
11 lsstDebug.Info = DebugInfo

into your debug.py file and run photoCalTask.py with the –debug flag.

Definition at line 58 of file anetAstrometry.py.

Constructor & Destructor Documentation

def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.__init__ (   self,
  schema,
  kwds 
)

Create the astrometric calibration task.

Most arguments are simply passed onto pipe.base.Task.

Parameters
schemaAn lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
**kwdskeyword arguments to be passed to the lsst.pipe.base.task.Task constructor

A centroid field "centroid.distorted" (used internally during the Task's operation) will be added to the schema.

Definition at line 129 of file anetAstrometry.py.

130  def __init__(self, schema, **kwds):
131  """!Create the astrometric calibration task. Most arguments are simply passed onto pipe.base.Task.
132 
133  \param schema An lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
134  \param **kwds keyword arguments to be passed to the lsst.pipe.base.task.Task constructor
135 
136  A centroid field "centroid.distorted" (used internally during the Task's operation)
137  will be added to the schema.
138  """
139  pipeBase.Task.__init__(self, **kwds)
140  self.distortedName = "astrom_distorted"
141  self.centroidXKey = schema.addField(self.distortedName + "_x", type="D",
142  doc="centroid distorted for astrometry solver")
143  self.centroidYKey = schema.addField(self.distortedName + "_y", type="D",
144  doc="centroid distorted for astrometry solver")
145  self.centroidXErrKey = schema.addField(self.distortedName + "_xSigma", type="F",
146  doc="centroid distorted err for astrometry solver")
147  self.centroidYErrKey = schema.addField(self.distortedName + "_ySigma", type="F",
148  doc="centroid distorted err for astrometry solver")
149  self.centroidFlagKey = schema.addField(self.distortedName + "_flag", type="Flag",
150  doc="centroid distorted flag astrometry solver")
152  self.centroidErrKey = CovarianceMatrix2fKey((self.centroidXErrKey, self.centroidYErrKey))
153  # postpone making the solver subtask because it may not be needed and is expensive to create
154  self.solver = None
def __init__
Create the astrometric calibration task.
PointKey< double > Point2DKey
Definition: aggregates.h:111

Member Function Documentation

def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask._astrometry (   self,
  sourceCat,
  exposure,
  bbox = None 
)
private

Solve astrometry to produce WCS.

Parameters
[in]sourceCatSources on exposure, an lsst.afw.table.SourceCatalog
[in,out]exposureExposure to process, an lsst.afw.image.ExposureF or D; wcs is updated
[in]bboxBounding box, or None to use exposure
Returns
a pipe.base.Struct with fields:
  • refCat reference object catalog of objects that overlap the exposure (with some margin) (an lsst::afw::table::SimpleCatalog)
  • matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
  • matchMeta metadata about the field (an lsst.daf.base.PropertyList)

Definition at line 354 of file anetAstrometry.py.

355  def _astrometry(self, sourceCat, exposure, bbox=None):
356  """!Solve astrometry to produce WCS
357 
358  \param[in] sourceCat Sources on exposure, an lsst.afw.table.SourceCatalog
359  \param[in,out] exposure Exposure to process, an lsst.afw.image.ExposureF or D; wcs is updated
360  \param[in] bbox Bounding box, or None to use exposure
361  \return a pipe.base.Struct with fields:
362  - refCat reference object catalog of objects that overlap the exposure (with some margin)
363  (an lsst::afw::table::SimpleCatalog)
364  - matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
365  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
366  """
367  self.log.info("Solving astrometry")
368  if bbox is None:
369  bbox = exposure.getBBox()
370 
371  if not self.solver:
372  self.makeSubtask("solver")
373 
374  astrom = self.solver.determineWcs(sourceCat=sourceCat, exposure=exposure, bbox=bbox)
375 
376  if astrom is None or astrom.getWcs() is None:
377  raise RuntimeError("Unable to solve astrometry")
378 
379  matches = astrom.getMatches()
380  matchMeta = astrom.getMatchMetadata()
381  if matches is None or len(matches) == 0:
382  raise RuntimeError("No astrometric matches")
383  self.log.info("%d astrometric matches" % (len(matches)))
384 
385  # Note that this is the Wcs for the provided positions, which may be distorted
386  exposure.setWcs(astrom.getWcs())
387 
388  self.display('astrometry', exposure=exposure, sources=sourceCat, matches=matches)
389 
390  return pipeBase.Struct(
391  refCat = astrom.refCat,
392  matches = matches,
393  matchMeta = matchMeta,
394  )
def _astrometry
Solve astrometry to produce WCS.
def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.distort (   self,
  sourceCat,
  exposure 
)

Calculate distorted source positions.

CCD images are often affected by optical distortion that makes the astrometric solution higher order than linear. Unfortunately, most (all?) matching algorithms require that the distortion be small or zero, and so it must be removed. We do this by calculating (un-)distorted positions, based on a known optical distortion model in the Ccd.

The distortion correction moves sources, so we return the distorted bounding box.

Parameters
[in]exposureExposure to process
[in,out]sourceCatSourceCatalog; getX() and getY() will be used as inputs, with distorted points in "centroid.distorted" field.
Returns
bounding box of distorted exposure

Definition at line 218 of file anetAstrometry.py.

219  def distort(self, sourceCat, exposure):
220  """!Calculate distorted source positions
221 
222  CCD images are often affected by optical distortion that makes
223  the astrometric solution higher order than linear. Unfortunately,
224  most (all?) matching algorithms require that the distortion be
225  small or zero, and so it must be removed. We do this by calculating
226  (un-)distorted positions, based on a known optical distortion model
227  in the Ccd.
228 
229  The distortion correction moves sources, so we return the distorted bounding box.
230 
231  \param[in] exposure Exposure to process
232  \param[in,out] sourceCat SourceCatalog; getX() and getY() will be used as inputs,
233  with distorted points in "centroid.distorted" field.
234  \return bounding box of distorted exposure
235  """
236  detector = exposure.getDetector()
237  pixToTanXYTransform = None
238  if detector is None:
239  self.log.warn("No detector associated with exposure; assuming null distortion")
240  else:
241  tanSys = detector.makeCameraSys(TAN_PIXELS)
242  pixToTanXYTransform = detector.getTransformMap().get(tanSys)
243 
244  if pixToTanXYTransform is None:
245  self.log.info("Null distortion correction")
246  for s in sourceCat:
247  s.set(self.centroidKey, s.getCentroid())
248  s.set(self.centroidErrKey, s.getCentroidErr())
249  s.set(self.centroidFlagKey, s.getCentroidFlag())
250  return exposure.getBBox()
251 
252  # Distort source positions
253  self.log.info("Applying distortion correction")
254  for s in sourceCat:
255  centroid = pixToTanXYTransform.forwardTransform(s.getCentroid())
256  s.set(self.centroidKey, centroid)
257  s.set(self.centroidErrKey, s.getCentroidErr())
258  s.set(self.centroidFlagKey, s.getCentroidFlag())
259 
260  # Get distorted image size so that astrometry_net does not clip.
261  bboxD = afwGeom.Box2D()
262  for corner in detector.getCorners(TAN_PIXELS):
263  bboxD.include(corner)
264 
265  import lsstDebug
266  if lsstDebug.Info(__name__).display:
267  frame = lsstDebug.Info(__name__).frame
268  pause = lsstDebug.Info(__name__).pause
269  displayAstrometry(sourceCat=sourceCat, distortedCentroidKey=self.centroidKey,
270  exposure=exposure, frame=frame, pause=pause)
271 
272  return afwGeom.Box2I(bboxD)
An integer coordinate rectangle.
Definition: Box.h:53
A floating-point coordinate rectangle geometry.
Definition: Box.h:271
def distort
Calculate distorted source positions.
def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.distortionContext (   self,
  sourceCat,
  exposure 
)

Context manager that applies and removes distortion.

We move the "centroid" definition in the catalog table to point to the distorted positions. This is undone on exit from the context.

The input Wcs is taken to refer to the coordinate system with the distortion correction applied, and hence no shift is required when the sources are distorted. However, after Wcs fitting, the Wcs is in the distorted frame so when the distortion correction is removed, the Wcs needs to be shifted to compensate.

Parameters
sourceCatSources on exposure, an lsst.afw.table.SourceCatalog
exposureExposure holding Wcs, an lsst.afw.image.ExposureF or D
Returns
bounding box of distorted exposure

Definition at line 274 of file anetAstrometry.py.

275  def distortionContext(self, sourceCat, exposure):
276  """!Context manager that applies and removes distortion
277 
278  We move the "centroid" definition in the catalog table to
279  point to the distorted positions. This is undone on exit
280  from the context.
281 
282  The input Wcs is taken to refer to the coordinate system
283  with the distortion correction applied, and hence no shift
284  is required when the sources are distorted. However, after
285  Wcs fitting, the Wcs is in the distorted frame so when the
286  distortion correction is removed, the Wcs needs to be
287  shifted to compensate.
288 
289  \param sourceCat Sources on exposure, an lsst.afw.table.SourceCatalog
290  \param exposure Exposure holding Wcs, an lsst.afw.image.ExposureF or D
291  \return bounding box of distorted exposure
292  """
293  # Apply distortion, if not already present in the exposure's WCS
294  if exposure.getWcs().hasDistortion():
295  yield exposure.getBBox()
296  else:
297  bbox = self.distort(sourceCat=sourceCat, exposure=exposure)
298  oldCentroidName = sourceCat.table.getCentroidDefinition()
299  sourceCat.table.defineCentroid(self.distortedName)
300  try:
301  yield bbox # Execute 'with' block, providing bbox to 'as' variable
302  finally:
303  # Un-apply distortion
304  sourceCat.table.defineCentroid(oldCentroidName)
305  x0, y0 = exposure.getXY0()
306  wcs = exposure.getWcs()
307  if wcs:
308  wcs.shiftReferencePixel(-bbox.getMinX() + x0, -bbox.getMinY() + y0)
def distortionContext
Context manager that applies and removes distortion.
def distort
Calculate distorted source positions.
def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.loadAndMatch (   self,
  exposure,
  sourceCat,
  bbox = None 
)

Load reference objects overlapping an exposure and match to sources detected on that exposure.

Parameters
[in]exposureexposure whose WCS is to be fit
[in]sourceCatcatalog of sourceCat detected on the exposure (an lsst.afw.table.SourceCatalog)
[in]bboxbounding box go use for finding reference objects; if None, use exposure's bbox
Returns
an lsst.pipe.base.Struct with these fields:
  • refCat reference object catalog of objects that overlap the exposure (with some margin) (an lsst::afw::table::SimpleCatalog)
  • matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
  • matchMeta metadata about the field (an lsst.daf.base.PropertyList)
Note
ignores config.forceKnownWcs

Definition at line 310 of file anetAstrometry.py.

311  def loadAndMatch(self, exposure, sourceCat, bbox=None):
312  """!Load reference objects overlapping an exposure and match to sources detected on that exposure
313 
314  @param[in] exposure exposure whose WCS is to be fit
315  @param[in] sourceCat catalog of sourceCat detected on the exposure (an lsst.afw.table.SourceCatalog)
316  @param[in] bbox bounding box go use for finding reference objects; if None, use exposure's bbox
317 
318  @return an lsst.pipe.base.Struct with these fields:
319  - refCat reference object catalog of objects that overlap the exposure (with some margin)
320  (an lsst::afw::table::SimpleCatalog)
321  - matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
322  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
323 
324  @note ignores config.forceKnownWcs
325  """
326  with self.distortionContext(sourceCat=sourceCat, exposure=exposure) as bbox:
327  if not self.solver:
328  self.makeSubtask("solver")
329 
330  astrom = self.solver.useKnownWcs(
331  sourceCat = sourceCat,
332  exposure = exposure,
333  bbox = bbox,
334  calculateSip = False,
335  )
336 
337  if astrom is None or astrom.getWcs() is None:
338  raise RuntimeError("Unable to solve astrometry")
339 
340  matches = astrom.getMatches()
341  matchMeta = astrom.getMatchMetadata()
342  if matches is None or len(matches) == 0:
343  raise RuntimeError("No astrometric matches")
344  self.log.info("%d astrometric matches" % (len(matches)))
345 
346  self.display('astrometry', exposure=exposure, sources=sourceCat, matches=matches)
347 
348  return pipeBase.Struct(
349  refCat = astrom.refCat,
350  matches = matches,
351  matchMeta = matchMeta,
352  )
def distortionContext
Context manager that applies and removes distortion.
def loadAndMatch
Load reference objects overlapping an exposure and match to sources detected on that exposure...
def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.refitWcs (   self,
  sourceCat,
  exposure,
  matches 
)

A final Wcs solution after matching and removing distortion.

Specifically, fitting the non-linear part, since the linear part has been provided by the matching engine.

Parameters
sourceCatSources on exposure, an lsst.afw.table.SourceCatalog
exposureExposure of interest, an lsst.afw.image.ExposureF or D
matchesAstrometric matches, as an lsst.afw.table.ReferenceMatchVector
Returns
the resolved-Wcs object, or None if config.solver.calculateSip is False.

Definition at line 396 of file anetAstrometry.py.

397  def refitWcs(self, sourceCat, exposure, matches):
398  """!A final Wcs solution after matching and removing distortion
399 
400  Specifically, fitting the non-linear part, since the linear
401  part has been provided by the matching engine.
402 
403  \param sourceCat Sources on exposure, an lsst.afw.table.SourceCatalog
404  \param exposure Exposure of interest, an lsst.afw.image.ExposureF or D
405  \param matches Astrometric matches, as an lsst.afw.table.ReferenceMatchVector
406 
407  \return the resolved-Wcs object, or None if config.solver.calculateSip is False.
408  """
409  sip = None
410  if self.config.solver.calculateSip:
411  self.log.info("Refitting WCS")
412  origMatches = matches
413  wcs = exposure.getWcs()
414 
415  import lsstDebug
416  display = lsstDebug.Info(__name__).display
417  frame = lsstDebug.Info(__name__).frame
418  pause = lsstDebug.Info(__name__).pause
419 
420  def fitWcs(initialWcs, title=None):
421  """!Do the WCS fitting and display of the results"""
422  sip = makeCreateWcsWithSip(matches, initialWcs, self.config.solver.sipOrder)
423  resultWcs = sip.getNewWcs()
424  if display:
425  showAstrometry(exposure, resultWcs, origMatches, matches, frame=frame,
426  title=title, pause=pause)
427  return resultWcs, sip.getScatterOnSky()
428 
429  numRejected = 0
430  try:
431  for i in range(self.config.rejectIter):
432  wcs, scatter = fitWcs(wcs, title="Iteration %d" % i)
433 
434  ref = numpy.array([wcs.skyToPixel(m.first.getCoord()) for m in matches])
435  src = numpy.array([m.second.getCentroid() for m in matches])
436  diff = ref - src
437  rms = diff.std()
438  trimmed = []
439  for d, m in zip(diff, matches):
440  if numpy.all(numpy.abs(d) < self.config.rejectThresh*rms):
441  trimmed.append(m)
442  else:
443  numRejected += 1
444  if len(matches) == len(trimmed):
445  break
446  matches = trimmed
447 
448  # Final fit after rejection iterations
449  wcs, scatter = fitWcs(wcs, title="Final astrometry")
450 
451  except lsst.pex.exceptions.LengthError as e:
452  self.log.warn("Unable to fit SIP: %s" % e)
453 
454  self.log.info("Astrometric scatter: %f arcsec (%s non-linear terms, %d matches, %d rejected)" %
455  (scatter.asArcseconds(), "with" if wcs.hasDistortion() else "without",
456  len(matches), numRejected))
457  exposure.setWcs(wcs)
458 
459  # Apply WCS to sources
460  for index, source in enumerate(sourceCat):
461  sky = wcs.pixelToSky(source.getX(), source.getY())
462  source.setCoord(sky)
463  else:
464  self.log.warn("Not calculating a SIP solution; matches may be suspect")
465 
466  self.display('astrometry', exposure=exposure, sources=sourceCat, matches=matches)
467 
468  return sip
469 
def refitWcs
A final Wcs solution after matching and removing distortion.
CreateWcsWithSip< MatchT > makeCreateWcsWithSip(std::vector< MatchT > const &matches, afw::image::Wcs const &linearWcs, int const order, afw::geom::Box2I const &bbox=afw::geom::Box2I(), int const ngrid=0)
Factory function for CreateWcsWithSip.
def showAstrometry
Show results of astrometry fitting.
def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.run (   self,
  exposure,
  sourceCat 
)

Load reference objects, match sources and optionally fit a WCS.

This is a thin layer around solve or loadAndMatch, depending on config.forceKnownWcs

Parameters
[in,out]exposureexposure whose WCS is to be fit The following are read only:
  • bbox
  • calib (may be absent)
  • filter (may be unset)
  • detector (if wcs is pure tangent; may be absent) The following are updated:
  • wcs (the initial value is used as an initial guess, and is required)
[in]sourceCatcatalog of sourceCat detected on the exposure (an lsst.afw.table.SourceCatalog)
Returns
an lsst.pipe.base.Struct with these fields:
  • refCat reference object catalog of objects that overlap the exposure (with some margin) (an lsst::afw::table::SimpleCatalog)
  • matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
  • matchMeta metadata about the field (an lsst.daf.base.PropertyList)

Definition at line 156 of file anetAstrometry.py.

157  def run(self, exposure, sourceCat):
158  """!Load reference objects, match sources and optionally fit a WCS
159 
160  This is a thin layer around solve or loadAndMatch, depending on config.forceKnownWcs
161 
162  @param[in,out] exposure exposure whose WCS is to be fit
163  The following are read only:
164  - bbox
165  - calib (may be absent)
166  - filter (may be unset)
167  - detector (if wcs is pure tangent; may be absent)
168  The following are updated:
169  - wcs (the initial value is used as an initial guess, and is required)
170  @param[in] sourceCat catalog of sourceCat detected on the exposure (an lsst.afw.table.SourceCatalog)
171  @return an lsst.pipe.base.Struct with these fields:
172  - refCat reference object catalog of objects that overlap the exposure (with some margin)
173  (an lsst::afw::table::SimpleCatalog)
174  - matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
175  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
176  """
177  if self.config.forceKnownWcs:
178  return self.loadAndMatch(exposure=exposure, sourceCat=sourceCat)
179  else:
180  return self.solve(exposure=exposure, sourceCat=sourceCat)
def solve
Match with reference sources and calculate an astrometric solution.
def loadAndMatch
Load reference objects overlapping an exposure and match to sources detected on that exposure...
def run
Load reference objects, match sources and optionally fit a WCS.
def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.solve (   self,
  exposure,
  sourceCat 
)

Match with reference sources and calculate an astrometric solution.

Parameters
[in,out]exposureExposure to calibrate; wcs is updated
[in]sourceCatcatalog of measured sources (an lsst.afw.table.SourceCatalog)
Returns
a pipeBase.Struct with fields:
  • refCat reference object catalog of objects that overlap the exposure (with some margin) (an lsst::afw::table::SimpleCatalog)
  • matches: Astrometric matches, as an lsst.afw.table.ReferenceMatchVector
  • matchMeta metadata about the field (an lsst.daf.base.PropertyList)

The reference catalog actually used is up to the implementation of the solver; it will be manifested in the returned matches as a list of lsst.afw.table.ReferenceMatch objects (i.e. of lsst.afw.table.Match with first being of type lsst.afw.table.SimpleRecord and second type lsst.afw.table.SourceRecord — the reference object and matched object respectively).

Note
The input sources have the centroid slot moved to a new column "centroid.distorted" which has the positions corrected for any known optical distortion; the 'solver' (which is instantiated in the 'astrometry' member) should therefore simply use the centroids provided by calling afw.table.Source.getCentroid() on the individual source records. This column must be present in the sources table.
ignores config.forceKnownWcs

Definition at line 182 of file anetAstrometry.py.

183  def solve(self, exposure, sourceCat):
184  """!Match with reference sources and calculate an astrometric solution
185 
186  \param[in,out] exposure Exposure to calibrate; wcs is updated
187  \param[in] sourceCat catalog of measured sources (an lsst.afw.table.SourceCatalog)
188  \return a pipeBase.Struct with fields:
189  - refCat reference object catalog of objects that overlap the exposure (with some margin)
190  (an lsst::afw::table::SimpleCatalog)
191  - matches: Astrometric matches, as an lsst.afw.table.ReferenceMatchVector
192  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
193 
194  The reference catalog actually used is up to the implementation
195  of the solver; it will be manifested in the returned matches as
196  a list of lsst.afw.table.ReferenceMatch objects (\em i.e. of lsst.afw.table.Match with
197  \c first being of type lsst.afw.table.SimpleRecord and \c second type lsst.afw.table.SourceRecord ---
198  the reference object and matched object respectively).
199 
200  \note
201  The input sources have the centroid slot moved to a new column "centroid.distorted"
202  which has the positions corrected for any known optical distortion;
203  the 'solver' (which is instantiated in the 'astrometry' member)
204  should therefore simply use the centroids provided by calling
205  afw.table.Source.getCentroid() on the individual source records. This column \em must
206  be present in the sources table.
207 
208  \note ignores config.forceKnownWcs
209  """
210  with self.distortionContext(sourceCat=sourceCat, exposure=exposure) as bbox:
211  results = self._astrometry(sourceCat=sourceCat, exposure=exposure, bbox=bbox)
212 
213  if results.matches:
214  self.refitWcs(sourceCat=sourceCat, exposure=exposure, matches=results.matches)
215 
216  return results
def refitWcs
A final Wcs solution after matching and removing distortion.
def solve
Match with reference sources and calculate an astrometric solution.
def distortionContext
Context manager that applies and removes distortion.
def _astrometry
Solve astrometry to produce WCS.

Member Data Documentation

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidErrKey

Definition at line 151 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidFlagKey

Definition at line 148 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidKey

Definition at line 150 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidXErrKey

Definition at line 144 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidXKey

Definition at line 140 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidYErrKey

Definition at line 146 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidYKey

Definition at line 142 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.ConfigClass = ANetAstrometryConfig
static

Definition at line 127 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.distortedName

Definition at line 139 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.solver

Definition at line 153 of file anetAstrometry.py.


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