lsst.meas.extensions.astrometryNet  14.0-1-g013352c+36
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask Class Reference

Basic implemeentation of the astrometry.net astrometrical fitter. More...

Inheritance diagram for lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask:

Public Member Functions

def __init__ (self, config, andConfig=None, kwargs)
 Construct an ANetBasicAstrometryTask. More...
 
def memusage (self, prefix='')
 
def useKnownWcs (self, sourceCat, wcs=None, exposure=None, filterName=None, bbox=None, calculateSip=None)
 Return an InitialAstrometry object, just like determineWcs, but assuming the given input WCS is correct. More...
 
def determineWcs (self, sourceCat, exposure, kwargs)
 
def determineWcs2 (self, sourceCat, kwargs)
 
def getBlindWcsSolution (self, sourceCat, exposure=None, wcs=None, bbox=None, radecCenter=None, searchRadius=None, pixelScale=None, filterName=None, doTrim=False, usePixelScale=True, useRaDecCenter=True, useParity=True, searchRadiusScale=2.)
 
def getSipWcsFromWcs (self, wcs, bbox, ngrid=20, linearizeAtCenter=True)
 Get a TAN-SIP WCS, starting from an existing WCS. More...
 
def getSipWcsFromCorrespondences (self, origWcs, refCat, sourceCat, bbox)
 
def plotSolution (self, matches, wcs, imageSize)
 
def getColumnName (self, filterName, columnMap, default=None)
 

Public Attributes

 config
 
 refObjLoader
 

Static Public Attributes

 ConfigClass = ANetBasicAstrometryConfig
 

Detailed Description

Basic implemeentation of the astrometry.net astrometrical fitter.

A higher-level class ANetAstrometryTask takes care of dealing with the fact that the initial WCS is probably only a pure TAN SIP, yet we may have significant distortion and a good estimate for that distortion.

About Astrometry.net index files (astrometry_net_data):

There are three components of an index file: a list of stars (stored as a star kd-tree), a list of quadrangles of stars ("quad file") and a list of the shapes ("codes") of those quadrangles, stored as a code kd-tree.

Each index covers a region of the sky, defined by healpix nside and number, and a range of angular scales. In LSST, we share the list of stars in a part of the sky between multiple indexes. That is, the star kd-tree is shared between multiple indices (quads and code kd-trees). In the astrometry.net code, this is called a "multiindex".

It is possible to "unload" and "reload" multiindex (and index) objects. When "unloaded", they consume no FILE or mmap resources.

The multiindex object holds the star kd-tree and gives each index object it holds a pointer to it, so it is necessary to multiindex_reload_starkd() before reloading the indices it holds. The multiindex_unload() method, on the other hand, unloads its starkd and unloads each index it holds.

Definition at line 222 of file anetBasicAstrometry.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.__init__ (   self,
  config,
  andConfig = None,
  kwargs 
)

Construct an ANetBasicAstrometryTask.

Parameters
[in]configconfiguration (an instance of self.ConfigClass)
[in]andConfigastrometry.net data config (an instance of AstromNetDataConfig, or None); if None then use andConfig.py in the astrometry_net_data product (which must be setup)
[in]kwargsadditional keyword arguments for pipe_base Task.__init__
Exceptions
RuntimeErrorif andConfig is None and the configuration cannot be found, either because astrometry_net_data is not setup in eups or because the setup version does not include the file "andConfig.py"

Definition at line 259 of file anetBasicAstrometry.py.

Member Function Documentation

◆ determineWcs()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.determineWcs (   self,
  sourceCat,
  exposure,
  kwargs 
)
Find a WCS solution for the given 'sourceCat' in the given
'exposure', getting other parameters from config.

Valid kwargs include:

'radecCenter', an afw.coord.Coord giving the RA,Dec position
   of the center of the field.  This is used to limit the
   search done by Astrometry.net (to make it faster and load
   fewer index files, thereby using less memory).  Defaults to
   the RA,Dec center from the exposure's WCS; turn that off
   with the boolean kwarg 'useRaDecCenter' or config option
   'useWcsRaDecCenter'

'useRaDecCenter', a boolean.  Don't use the RA,Dec center from
   the exposure's initial WCS.

'searchRadius', in degrees, to search for a solution around
   the given 'radecCenter'; default from config option
   'raDecSearchRadius'.

'useParity': parity is the 'flip' of the image.  Knowing it
   reduces the search space (hence time) for Astrometry.net.
   The parity can be computed from the exposure's WCS (the
   sign of the determinant of the CD matrix); this option
   controls whether we do that or force Astrometry.net to
   search both parities.  Default from config.useWcsParity.

'pixelScale': afwGeom.Angle, estimate of the angle-per-pixel
   (ie, arcseconds per pixel).  Defaults to a value derived
   from the exposure's WCS.  If enabled, this value, plus or
   minus config.pixelScaleUncertainty, will be used to limit
   Astrometry.net's search.

'usePixelScale': boolean.  Use the pixel scale to limit
   Astrometry.net's search?  Defaults to config.useWcsPixelScale.

'filterName', a string, the filter name of this image.  Will
   be mapped through the 'filterMap' config dictionary to a
   column name in the astrometry_net_data index FITS files.
   Defaults to the exposure.getFilter() value.

'bbox', bounding box of exposure; defaults to exposure.getBBox()

Definition at line 409 of file anetBasicAstrometry.py.

◆ determineWcs2()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.determineWcs2 (   self,
  sourceCat,
  kwargs 
)
Get a blind astrometric solution for the given catalog of sources.

We need:
  -the image size;
  -the filter

And if available, we can use:
  -an initial Wcs estimate;
     --> RA,Dec center
     --> pixel scale
     --> "parity"

(all of which are metadata of Exposure).

filterName: string
imageSize: (W,H) integer tuple/iterable
pixelScale: afwGeom::Angle per pixel.
radecCenter: afwCoord::Coord

Definition at line 468 of file anetBasicAstrometry.py.

◆ getBlindWcsSolution()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.getBlindWcsSolution (   self,
  sourceCat,
  exposure = None,
  wcs = None,
  bbox = None,
  radecCenter = None,
  searchRadius = None,
  pixelScale = None,
  filterName = None,
  doTrim = False,
  usePixelScale = True,
  useRaDecCenter = True,
  useParity = True,
  searchRadiusScale = 2. 
)

Definition at line 511 of file anetBasicAstrometry.py.

◆ getColumnName()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.getColumnName (   self,
  filterName,
  columnMap,
  default = None 
)
Returns the column name in the astrometry_net_data index file that will be used
for the given filter name.

@param filterName   Name of filter used in exposure
@param columnMap    Dict that maps filter names to column names
@param default      Default column name

Definition at line 845 of file anetBasicAstrometry.py.

◆ getSipWcsFromCorrespondences()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.getSipWcsFromCorrespondences (   self,
  origWcs,
  refCat,
  sourceCat,
  bbox 
)
Produce a SIP solution given a list of known correspondences.

Unlike _calculateSipTerms, this does not iterate the solution;
it assumes you have given it a good sets of corresponding stars.

NOTE that "refCat" and "sourceCat" are assumed to be the same length;
entries "refCat[i]" and "sourceCat[i]" are assumed to be correspondences.

@param[in] origWcs  the WCS to linearize in order to get the TAN part of the TAN-SIP WCS.
@param[in] refCat  reference source catalog
@param[in] sourceCat  source catalog
@param[in] bbox  bounding box of image

Definition at line 635 of file anetBasicAstrometry.py.

◆ getSipWcsFromWcs()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.getSipWcsFromWcs (   self,
  wcs,
  bbox,
  ngrid = 20,
  linearizeAtCenter = True 
)

Get a TAN-SIP WCS, starting from an existing WCS.

It uses your WCS to compute a fake grid of corresponding "stars" in pixel and sky coords, and feeds that to the regular SIP code.

Parameters
[in]wcsinitial WCS
[in]bboxbounding box of image
[in]ngridnumber of grid points along x and y for fitting (fit at ngrid^2 points)
[in]linearizeAtCenterif True, get a linear approximation of the input WCS at the image center and use that as the TAN initialization for the TAN-SIP solution. You probably want this if your WCS has its CRPIX outside the image bounding box.

Definition at line 584 of file anetBasicAstrometry.py.

◆ memusage()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.memusage (   self,
  prefix = '' 
)

Definition at line 282 of file anetBasicAstrometry.py.

◆ plotSolution()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.plotSolution (   self,
  matches,
  wcs,
  imageSize 
)
Plot the solution, when debugging is turned on.

@param matches   The list of matches
@param wcs         The Wcs
@param imageSize   2-tuple with the image size (W,H)

Definition at line 713 of file anetBasicAstrometry.py.

◆ useKnownWcs()

def lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.useKnownWcs (   self,
  sourceCat,
  wcs = None,
  exposure = None,
  filterName = None,
  bbox = None,
  calculateSip = None 
)

Return an InitialAstrometry object, just like determineWcs, but assuming the given input WCS is correct.

This involves searching for reference sources within the WCS area, and matching them to the given 'sourceCat'. If 'calculateSip' is set, we will try to compute a TAN-SIP distortion correction.

Parameters
[in]sourceCatlist of detected sources in this image.
[in]wcsyour known WCS, or None to get from exposure
[in]exposurethe exposure holding metadata for this image; if None then you must specify wcs, filterName and bbox
[in]filterNamestring, filter name, eg "i", or None to get from exposure`
[in]bboxbounding box of image, or None to get from exposure
[in]calculateSipcalculate SIP distortion terms for the WCS? If None then use self.config.calculateSip. To disable WCS fitting set calculateSip=False
Note
this function is also called by 'determineWcs' (via 'determineWcs2'), since the steps are all the same.

Definition at line 329 of file anetBasicAstrometry.py.

Member Data Documentation

◆ config

lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.config

Definition at line 272 of file anetBasicAstrometry.py.

◆ ConfigClass

lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.ConfigClass = ANetBasicAstrometryConfig
static

Definition at line 253 of file anetBasicAstrometry.py.

◆ refObjLoader

lsst.meas.extensions.astrometryNet.anetBasicAstrometry.ANetBasicAstrometryTask.refObjLoader

Definition at line 274 of file anetBasicAstrometry.py.


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