LSSTApplications  11.0-22-g33de520,12.1+25,13.0+25,13.0+30,13.0-1-g174df6e+3,13.0-1-g41367f3+3,13.0-1-g47a359c+3,13.0-1-g52a7baa+3,13.0-1-g976b40b+3,13.0-10-gcc6134a+6,13.0-10-gf7c21d5+2,13.0-13-gdd29b46+5,13.0-14-gc9904b0,13.0-2-g15de9a1+3,13.0-2-ga4f5e85+6,13.0-2-gf5c5ced+6,13.0-2-gf9e84ea+5,13.0-22-g8f1d162,13.0-3-g7fa07e0+4,13.0-34-ga37f01a,13.0-4-g0bde1de,13.0-5-g0db1a30+1,13.0-5-g6708b9e+9,13.0-6-g7b63e3f+6,13.0-8-gba0f85f,13.0-9-gc47bba1,master-gb637561bb9
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
refObjLoaderThe AstrometryTask constructor requires a refObjLoader. In order to make this task retargettable for AstrometryTask it needs to take the same arguments. This argument will be ignored since it uses its own internal loader.
**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:

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 70 of file anetAstrometry.py.

Constructor & Destructor Documentation

def lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.__init__ (   self,
  schema,
  refObjLoader = None,
  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
refObjLoaderThe AstrometryTask constructor requires a refObjLoader. In order to make this task retargettable for AstrometryTask it needs to take the same arguments. This argument will be ignored since it uses its own internal loader.
**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 142 of file anetAstrometry.py.

143  def __init__(self, schema, refObjLoader=None, **kwds):
144  """!Create the astrometric calibration task. Most arguments are simply passed onto pipe.base.Task.
145 
146  \param schema An lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
147  \param refObjLoader The AstrometryTask constructor requires a refObjLoader. In order to make this
148  task retargettable for AstrometryTask it needs to take the same arguments. This argument will be
149  ignored since it uses its own internal loader.
150  \param **kwds keyword arguments to be passed to the lsst.pipe.base.task.Task constructor
151 
152  A centroid field "centroid.distorted" (used internally during the Task's operation)
153  will be added to the schema.
154  """
155  pipeBase.Task.__init__(self, **kwds)
156  self.distortedName = "astrom_distorted"
157  self.centroidXKey = schema.addField(self.distortedName + "_x", type="D",
158  doc="centroid distorted for astrometry solver")
159  self.centroidYKey = schema.addField(self.distortedName + "_y", type="D",
160  doc="centroid distorted for astrometry solver")
161  self.centroidXErrKey = schema.addField(self.distortedName + "_xSigma", type="F",
162  doc="centroid distorted err for astrometry solver")
163  self.centroidYErrKey = schema.addField(self.distortedName + "_ySigma", type="F",
164  doc="centroid distorted err for astrometry solver")
165  self.centroidFlagKey = schema.addField(self.distortedName + "_flag", type="Flag",
166  doc="centroid distorted flag astrometry solver")
168  self.centroidErrKey = CovarianceMatrix2fKey((self.centroidXErrKey, self.centroidYErrKey))
169  # postpone making the solver subtask because it may not be needed and is expensive to create
170  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:

Definition at line 372 of file anetAstrometry.py.

373  def _astrometry(self, sourceCat, exposure, bbox=None):
374  """!Solve astrometry to produce WCS
375 
376  \param[in] sourceCat Sources on exposure, an lsst.afw.table.SourceCatalog
377  \param[in,out] exposure Exposure to process, an lsst.afw.image.ExposureF or D; wcs is updated
378  \param[in] bbox Bounding box, or None to use exposure
379  \return a pipe.base.Struct with fields:
380  - refCat reference object catalog of objects that overlap the exposure (with some margin)
381  (an lsst::afw::table::SimpleCatalog)
382  - matches astrometric matches, a list of lsst.afw.table.ReferenceMatch
383  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
384  """
385  self.log.info("Solving astrometry")
386  if bbox is None:
387  bbox = exposure.getBBox()
388 
389  if not self.solver:
390  self.makeSubtask("solver")
391 
392  astrom = self.solver.determineWcs(sourceCat=sourceCat, exposure=exposure, bbox=bbox)
393 
394  if astrom is None or astrom.getWcs() is None:
395  raise RuntimeError("Unable to solve astrometry")
396 
397  matches = astrom.getMatches()
398  matchMeta = astrom.getMatchMetadata()
399  if matches is None or len(matches) == 0:
400  raise RuntimeError("No astrometric matches")
401  self.log.info("%d astrometric matches" % (len(matches)))
402 
403  # Note that this is the Wcs for the provided positions, which may be distorted
404  exposure.setWcs(astrom.getWcs())
405 
406  if self._display:
407  frame = lsstDebug.Info(__name__).frame
408  displayAstrometry(exposure=exposure, sourceCat=sourceCat, matches=matches,
409  frame=frame, pause=False)
410 
411  return pipeBase.Struct(
412  refCat=astrom.refCat,
413  matches=matches,
414  matchMeta=matchMeta,
415  )
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 234 of file anetAstrometry.py.

235  def distort(self, sourceCat, exposure):
236  """!Calculate distorted source positions
237 
238  CCD images are often affected by optical distortion that makes
239  the astrometric solution higher order than linear. Unfortunately,
240  most (all?) matching algorithms require that the distortion be
241  small or zero, and so it must be removed. We do this by calculating
242  (un-)distorted positions, based on a known optical distortion model
243  in the Ccd.
244 
245  The distortion correction moves sources, so we return the distorted bounding box.
246 
247  \param[in] exposure Exposure to process
248  \param[in,out] sourceCat SourceCatalog; getX() and getY() will be used as inputs,
249  with distorted points in "centroid.distorted" field.
250  \return bounding box of distorted exposure
251  """
252  detector = exposure.getDetector()
253  pixToTanXYTransform = None
254  if detector is None:
255  self.log.warn("No detector associated with exposure; assuming null distortion")
256  else:
257  tanSys = detector.makeCameraSys(TAN_PIXELS)
258  pixToTanXYTransform = detector.getTransformMap().get(tanSys)
259 
260  if pixToTanXYTransform is None:
261  self.log.info("Null distortion correction")
262  for s in sourceCat:
263  s.set(self.centroidKey, s.getCentroid())
264  s.set(self.centroidErrKey, s.getCentroidErr())
265  s.set(self.centroidFlagKey, s.getCentroidFlag())
266  return exposure.getBBox()
267 
268  # Distort source positions
269  self.log.info("Applying distortion correction")
270  for s in sourceCat:
271  centroid = pixToTanXYTransform.forwardTransform(s.getCentroid())
272  s.set(self.centroidKey, centroid)
273  s.set(self.centroidErrKey, s.getCentroidErr())
274  s.set(self.centroidFlagKey, s.getCentroidFlag())
275 
276  # Get distorted image size so that astrometry_net does not clip.
277  bboxD = afwGeom.Box2D()
278  for corner in detector.getCorners(TAN_PIXELS):
279  bboxD.include(corner)
280 
281  if lsstDebug.Info(__name__).display:
282  frame = lsstDebug.Info(__name__).frame
283  pause = lsstDebug.Info(__name__).pause
284  displayAstrometry(sourceCat=sourceCat, distortedCentroidKey=self.centroidKey,
285  exposure=exposure, frame=frame, pause=pause)
286 
287  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 289 of file anetAstrometry.py.

290  def distortionContext(self, sourceCat, exposure):
291  """!Context manager that applies and removes distortion
292 
293  We move the "centroid" definition in the catalog table to
294  point to the distorted positions. This is undone on exit
295  from the context.
296 
297  The input Wcs is taken to refer to the coordinate system
298  with the distortion correction applied, and hence no shift
299  is required when the sources are distorted. However, after
300  Wcs fitting, the Wcs is in the distorted frame so when the
301  distortion correction is removed, the Wcs needs to be
302  shifted to compensate.
303 
304  \param sourceCat Sources on exposure, an lsst.afw.table.SourceCatalog
305  \param exposure Exposure holding Wcs, an lsst.afw.image.ExposureF or D
306  \return bounding box of distorted exposure
307  """
308  # Apply distortion, if not already present in the exposure's WCS
309  if exposure.getWcs().hasDistortion():
310  yield exposure.getBBox()
311  else:
312  bbox = self.distort(sourceCat=sourceCat, exposure=exposure)
313  oldCentroidName = sourceCat.table.getCentroidDefinition()
314  sourceCat.table.defineCentroid(self.distortedName)
315  try:
316  yield bbox # Execute 'with' block, providing bbox to 'as' variable
317  finally:
318  # Un-apply distortion
319  sourceCat.table.defineCentroid(oldCentroidName)
320  x0, y0 = exposure.getXY0()
321  wcs = exposure.getWcs()
322  if wcs:
323  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:
Note
ignores config.forceKnownWcs

Definition at line 325 of file anetAstrometry.py.

326  def loadAndMatch(self, exposure, sourceCat, bbox=None):
327  """!Load reference objects overlapping an exposure and match to sources detected on that exposure
328 
329  @param[in] exposure exposure whose WCS is to be fit
330  @param[in] sourceCat catalog of sourceCat detected on the exposure (an lsst.afw.table.SourceCatalog)
331  @param[in] bbox bounding box go use for finding reference objects; if None, use exposure's bbox
332 
333  @return an lsst.pipe.base.Struct with these fields:
334  - refCat reference object catalog of objects that overlap the exposure (with some margin)
335  (an lsst::afw::table::SimpleCatalog)
336  - matches astrometric matches, a list of lsst.afw.table.ReferenceMatch
337  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
338 
339  @note ignores config.forceKnownWcs
340  """
341  with self.distortionContext(sourceCat=sourceCat, exposure=exposure) as bbox:
342  if not self.solver:
343  self.makeSubtask("solver")
344 
345  astrom = self.solver.useKnownWcs(
346  sourceCat=sourceCat,
347  exposure=exposure,
348  bbox=bbox,
349  calculateSip=False,
350  )
351 
352  if astrom is None or astrom.getWcs() is None:
353  raise RuntimeError("Unable to solve astrometry")
354 
355  matches = astrom.getMatches()
356  matchMeta = astrom.getMatchMetadata()
357  if matches is None or len(matches) == 0:
358  raise RuntimeError("No astrometric matches")
359  self.log.info("%d astrometric matches" % (len(matches)))
360 
361  if self._display:
362  frame = lsstDebug.Info(__name__).frame
363  displayAstrometry(exposure=exposure, sourceCat=sourceCat, matches=matches,
364  frame=frame, pause=False)
365 
366  return pipeBase.Struct(
367  refCat=astrom.refCat,
368  matches=matches,
369  matchMeta=matchMeta,
370  )
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 a list of lsst.afw.table.ReferenceMatch
Returns
the resolved-Wcs object, or None if config.solver.calculateSip is False.

Definition at line 417 of file anetAstrometry.py.

418  def refitWcs(self, sourceCat, exposure, matches):
419  """!A final Wcs solution after matching and removing distortion
420 
421  Specifically, fitting the non-linear part, since the linear
422  part has been provided by the matching engine.
423 
424  @param sourceCat Sources on exposure, an lsst.afw.table.SourceCatalog
425  @param exposure Exposure of interest, an lsst.afw.image.ExposureF or D
426  @param matches Astrometric matches, as a list of lsst.afw.table.ReferenceMatch
427 
428  @return the resolved-Wcs object, or None if config.solver.calculateSip is False.
429  """
430  sip = None
431  if self.config.solver.calculateSip:
432  self.log.info("Refitting WCS")
433  origMatches = matches
434  wcs = exposure.getWcs()
435 
436  import lsstDebug
437  display = lsstDebug.Info(__name__).display
438  frame = lsstDebug.Info(__name__).frame
439  pause = lsstDebug.Info(__name__).pause
440 
441  def fitWcs(initialWcs, title=None):
442  """!Do the WCS fitting and display of the results"""
443  sip = makeCreateWcsWithSip(matches, initialWcs, self.config.solver.sipOrder)
444  resultWcs = sip.getNewWcs()
445  if display:
446  showAstrometry(exposure, resultWcs, origMatches, matches, frame=frame,
447  title=title, pause=pause)
448  return resultWcs, sip.getScatterOnSky()
449 
450  numRejected = 0
451  try:
452  for i in range(self.config.rejectIter):
453  wcs, scatter = fitWcs(wcs, title="Iteration %d" % i)
454 
455  ref = np.array([wcs.skyToPixel(m.first.getCoord()) for m in matches])
456  src = np.array([m.second.getCentroid() for m in matches])
457  diff = ref - src
458  rms = diff.std()
459  trimmed = []
460  for d, m in zip(diff, matches):
461  if np.all(np.abs(d) < self.config.rejectThresh*rms):
462  trimmed.append(m)
463  else:
464  numRejected += 1
465  if len(matches) == len(trimmed):
466  break
467  matches = trimmed
468 
469  # Final fit after rejection iterations
470  wcs, scatter = fitWcs(wcs, title="Final astrometry")
471 
473  self.log.warn("Unable to fit SIP: %s" % e)
474 
475  self.log.info("Astrometric scatter: %f arcsec (%s non-linear terms, %d matches, %d rejected)" %
476  (scatter.asArcseconds(), "with" if wcs.hasDistortion() else "without",
477  len(matches), numRejected))
478  exposure.setWcs(wcs)
479 
480  # Apply WCS to sources
481  for index, source in enumerate(sourceCat):
482  sky = wcs.pixelToSky(source.getX(), source.getY())
483  source.setCoord(sky)
484  else:
485  self.log.warn("Not calculating a SIP solution; matches may be suspect")
486 
487  if self._display:
488  frame = lsstDebug.Info(__name__).frame
489  displayAstrometry(exposure=exposure, sourceCat=sourceCat, matches=matches,
490  frame=frame, pause=False)
491 
492  return sip
493 
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:

Definition at line 172 of file anetAstrometry.py.

173  def run(self, exposure, sourceCat):
174  """!Load reference objects, match sources and optionally fit a WCS
175 
176  This is a thin layer around solve or loadAndMatch, depending on config.forceKnownWcs
177 
178  @param[in,out] exposure exposure whose WCS is to be fit
179  The following are read only:
180  - bbox
181  - calib (may be absent)
182  - filter (may be unset)
183  - detector (if wcs is pure tangent; may be absent)
184  The following are updated:
185  - wcs (the initial value is used as an initial guess, and is required)
186  @param[in] sourceCat catalog of sourceCat detected on the exposure (an lsst.afw.table.SourceCatalog)
187  @return an lsst.pipe.base.Struct with these fields:
188  - refCat reference object catalog of objects that overlap the exposure (with some margin)
189  (an lsst::afw::table::SimpleCatalog)
190  - matches astrometric matches, a list of lsst.afw.table.ReferenceMatch
191  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
192  """
193  if self.config.forceKnownWcs:
194  return self.loadAndMatch(exposure=exposure, sourceCat=sourceCat)
195  else:
196  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:

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 198 of file anetAstrometry.py.

199  def solve(self, exposure, sourceCat):
200  """!Match with reference sources and calculate an astrometric solution
201 
202  \param[in,out] exposure Exposure to calibrate; wcs is updated
203  \param[in] sourceCat catalog of measured sources (an lsst.afw.table.SourceCatalog)
204  \return a pipeBase.Struct with fields:
205  - refCat reference object catalog of objects that overlap the exposure (with some margin)
206  (an lsst::afw::table::SimpleCatalog)
207  - matches astrometric matches, a list of lsst.afw.table.ReferenceMatch
208  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
209 
210  The reference catalog actually used is up to the implementation
211  of the solver; it will be manifested in the returned matches as
212  a list of lsst.afw.table.ReferenceMatch objects (\em i.e. of lsst.afw.table.Match with
213  \c first being of type lsst.afw.table.SimpleRecord and \c second type lsst.afw.table.SourceRecord ---
214  the reference object and matched object respectively).
215 
216  \note
217  The input sources have the centroid slot moved to a new column "centroid.distorted"
218  which has the positions corrected for any known optical distortion;
219  the 'solver' (which is instantiated in the 'astrometry' member)
220  should therefore simply use the centroids provided by calling
221  afw.table.Source.getCentroid() on the individual source records. This column \em must
222  be present in the sources table.
223 
224  \note ignores config.forceKnownWcs
225  """
226  with self.distortionContext(sourceCat=sourceCat, exposure=exposure) as bbox:
227  results = self._astrometry(sourceCat=sourceCat, exposure=exposure, bbox=bbox)
228 
229  if results.matches:
230  self.refitWcs(sourceCat=sourceCat, exposure=exposure, matches=results.matches)
231 
232  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 167 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidFlagKey

Definition at line 164 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidKey

Definition at line 166 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidXErrKey

Definition at line 160 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidXKey

Definition at line 156 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidYErrKey

Definition at line 162 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.centroidYKey

Definition at line 158 of file anetAstrometry.py.

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

Definition at line 140 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.distortedName

Definition at line 155 of file anetAstrometry.py.

lsst.meas.astrom.anetAstrometry.ANetAstrometryTask.solver

Definition at line 169 of file anetAstrometry.py.


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