LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
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 353 of file anetAstrometry.py.

354  def _astrometry(self, sourceCat, exposure, bbox=None):
355  """!Solve astrometry to produce WCS
356 
357  \param[in] sourceCat Sources on exposure, an lsst.afw.table.SourceCatalog
358  \param[in,out] exposure Exposure to process, an lsst.afw.image.ExposureF or D; wcs is updated
359  \param[in] bbox Bounding box, or None to use exposure
360  \return a pipe.base.Struct with fields:
361  - refCat reference object catalog of objects that overlap the exposure (with some margin)
362  (an lsst::afw::table::SimpleCatalog)
363  - matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
364  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
365  """
366  self.log.info("Solving astrometry")
367  if bbox is None:
368  bbox = exposure.getBBox()
369 
370  if not self.solver:
371  self.makeSubtask("solver")
372 
373  astrom = self.solver.determineWcs(sourceCat=sourceCat, exposure=exposure, bbox=bbox)
374 
375  if astrom is None or astrom.getWcs() is None:
376  raise RuntimeError("Unable to solve astrometry")
377 
378  matches = astrom.getMatches()
379  matchMeta = astrom.getMatchMetadata()
380  if matches is None or len(matches) == 0:
381  raise RuntimeError("No astrometric matches")
382  self.log.info("%d astrometric matches" % (len(matches)))
383 
384  # Note that this is the Wcs for the provided positions, which may be distorted
385  exposure.setWcs(astrom.getWcs())
386 
387  self.display('astrometry', exposure=exposure, sources=sourceCat, matches=matches)
388 
389  return pipeBase.Struct(
390  refCat = astrom.refCat,
391  matches = matches,
392  matchMeta = matchMeta,
393  )
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)
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 
317  @return an lsst.pipe.base.Struct with these fields:
318  - refCat reference object catalog of objects that overlap the exposure (with some margin)
319  (an lsst::afw::table::SimpleCatalog)
320  - matches list of reference object/source matches (an lsst.afw.table.ReferenceMatchVector)
321  - matchMeta metadata about the field (an lsst.daf.base.PropertyList)
322 
323  @note ignores config.forceKnownWcs
324  """
325  with self.distortionContext(sourceCat=sourceCat, exposure=exposure) as bbox:
326  if not self.solver:
327  self.makeSubtask("solver")
328 
329  astrom = self.solver.useKnownWcs(
330  sourceCat = sourceCat,
331  exposure = exposure,
332  bbox = bbox,
333  calculateSip = False,
334  )
335 
336  if astrom is None or astrom.getWcs() is None:
337  raise RuntimeError("Unable to solve astrometry")
338 
339  matches = astrom.getMatches()
340  matchMeta = astrom.getMatchMetadata()
341  if matches is None or len(matches) == 0:
342  raise RuntimeError("No astrometric matches")
343  self.log.info("%d astrometric matches" % (len(matches)))
344 
345  self.display('astrometry', exposure=exposure, sources=sourceCat, matches=matches)
346 
347  return pipeBase.Struct(
348  refCat = astrom.refCat,
349  matches = matches,
350  matchMeta = matchMeta,
351  )
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 395 of file anetAstrometry.py.

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