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
|
Basic implemeentation of the astrometry.net astrometrical fitter. More...
Public Member Functions | |
def | __init__ |
Construct an ANetBasicAstrometryTask. More... | |
def | memusage |
def | useKnownWcs |
Return an InitialAstrometry object, just like determineWcs, but assuming the given input WCS is correct. More... | |
def | determineWcs |
def | determineWcs2 |
def | getBlindWcsSolution |
def | getSipWcsFromWcs |
Get a TAN-SIP WCS, starting from an existing WCS. More... | |
def | getSipWcsFromCorrespondences |
def | plotSolution |
def | getColumnName |
def | joinMatchListWithCatalog |
Public Attributes | |
config | |
refObjLoader | |
Static Public Attributes | |
ConfigClass = ANetBasicAstrometryConfig | |
Private Member Functions | |
def | _getImageParams |
def | _calculateSipTerms |
Iteratively calculate SIP distortions and regenerate matches based on improved WCS. More... | |
def | _computeMatchStatsOnSky |
def | _getMatchList |
def | _solve |
def | _isGoodSource |
Static Private Member Functions | |
def | _trimBadPoints |
Static Private Attributes | |
string | _DefaultName = "aNetBasicAstrometry" |
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 191 of file anetBasicAstrometry.py.
def lsst.meas.astrom.anetBasicAstrometry.ANetBasicAstrometryTask.__init__ | ( | self, | |
config, | |||
andConfig = None , |
|||
kwargs | |||
) |
Construct an ANetBasicAstrometryTask.
[in] | config | configuration (an instance of self.ConfigClass) |
[in] | andConfig | astrometry.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] | kwargs | additional keyword arguments for pipe_base Task.__init__ |
RuntimeError | if 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 227 of file anetBasicAstrometry.py.
|
private |
Iteratively calculate SIP distortions and regenerate matches based on improved WCS.
[in] | origWcs | original WCS object, probably (but not necessarily) a TAN WCS; this is used to set the baseline when determining whether a SIP solution is any better; it will be returned if no better SIP solution can be found. |
[in] | refCat | reference source catalog |
[in] | sourceCat | sources in the image to be solved |
[in] | matches | list of supposedly matched sources, using the "origWcs". |
[in] | bbox | bounding box of image, which is used when finding reverse SIP coefficients. |
Definition at line 626 of file anetBasicAstrometry.py.
|
private |
Compute on-sky radial distance statistics for a match list @param[in] wcs WCS for match list; an lsst.afw.image.Wcs @param[in] matchList list of matches between reference object and sources; a list of lsst.afw.table.ReferenceMatch; the source centroid and reference object coord are read @return a pipe_base Struct containing these fields: - distMean clipped mean of on-sky radial separation - distStdDev clipped standard deviation of on-sky radial separation - maxMatchDist distMean + self.config.matchDistanceSigma*distStdDev
Definition at line 761 of file anetBasicAstrometry.py.
|
private |
Get image parameters @param[in] exposure exposure (an afwImage.Exposure) or None @param[in] bbox bounding box (an afwGeom.Box2I) or None; if None then bbox must be specified @param[in] wcs WCS (an afwImage.Wcs) or None; if None then exposure must be specified @param[in] filterName filter name, a string, or None; if None exposure must be specified @param[in] wcsRequired if True then either wcs must be specified or exposure must contain a wcs; if False then the returned wcs may be None @return these items: - bbox bounding box; guaranteed to be set - wcs WCS if known, else None - filterName filter name if known, else None @throw RuntimeError if bbox cannot be determined, or wcs cannot be determined and wcsRequired True
Definition at line 262 of file anetBasicAstrometry.py.
|
private |
Definition at line 783 of file anetBasicAstrometry.py.
|
private |
Definition at line 942 of file anetBasicAstrometry.py.
|
private |
Definition at line 832 of file anetBasicAstrometry.py.
|
staticprivate |
Remove elements from catalog whose xy positions are not within the given bbox. sourceCat: a Catalog of SimpleRecord or SourceRecord objects bbox: an afwImage.Box2D wcs: if not None, will be used to compute the xy positions on-the-fly; this is required when sources actually contains SimpleRecords. Returns: a list of Source objects with xAstrom,yAstrom within the bbox.
Definition at line 949 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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 376 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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 435 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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 478 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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 814 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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 604 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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.
[in] | wcs | initial WCS |
[in] | bbox | bounding box of image |
[in] | ngrid | number of grid points along x and y for fitting (fit at ngrid^2 points) |
[in] | linearizeAtCenter | if 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 551 of file anetBasicAstrometry.py.
def lsst.meas.astrom.anetBasicAstrometry.ANetBasicAstrometryTask.joinMatchListWithCatalog | ( | self, | |
packedMatches, | |||
sourceCat | |||
) |
This function is required to reconstitute a ReferenceMatchVector after being unpersisted. The persisted form of a ReferenceMatchVector is the normalized Catalog of IDs produced by afw.table.packMatches(), with the result of InitialAstrometry.getMatchMetadata() in the associated tables\' metadata. The "live" form of a matchlist has links to the real record objects that are matched; it is "denormalized". This function takes a normalized match catalog, along with the catalog of sources to which the match catalog refers. It fetches the reference sources that are within range, and then denormalizes the matches -- sets the "matches[*].first" and "matches[*].second" entries to point to the sources in the "sourceCat" argument, and to the reference sources fetched from the astrometry_net_data files. @param[in] packedMatches Unpersisted match list (an lsst.afw.table.BaseCatalog). packedMatches.table.getMetadata() must contain the values from InitialAstrometry.getMatchMetadata() @param[in,out] sourceCat Source catalog used for the 'second' side of the matches (an lsst.afw.table.SourceCatalog). As a side effect, the catalog will be sorted by ID. @return An lsst.afw.table.ReferenceMatchVector of denormalized matches.
Definition at line 967 of file anetBasicAstrometry.py.
def lsst.meas.astrom.anetBasicAstrometry.ANetBasicAstrometryTask.memusage | ( | self, | |
prefix = '' |
|||
) |
Definition at line 246 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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 683 of file anetBasicAstrometry.py.
def lsst.meas.astrom.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.
[in] | sourceCat | list of detected sources in this image. |
[in] | wcs | your known WCS, or None to get from exposure |
[in] | exposure | the exposure holding metadata for this image; if None then you must specify wcs, filterName and bbox |
[in] | filterName | string, filter name, eg "i", or None to get from exposure` |
[in] | bbox | bounding box of image, or None to get from exposure |
[in] | calculateSip | calculate SIP distortion terms for the WCS? If None then use self.config.calculateSip. To disable WCS fitting set calculateSip=False |
Definition at line 293 of file anetBasicAstrometry.py.
|
staticprivate |
Definition at line 223 of file anetBasicAstrometry.py.
lsst.meas.astrom.anetBasicAstrometry.ANetBasicAstrometryTask.config |
Definition at line 240 of file anetBasicAstrometry.py.
|
static |
Definition at line 222 of file anetBasicAstrometry.py.
lsst.meas.astrom.anetBasicAstrometry.ANetBasicAstrometryTask.refObjLoader |
Definition at line 242 of file anetBasicAstrometry.py.