lsst.meas.astrom gaea863341c+d18973ec71
Loading...
Searching...
No Matches
lsst.meas.astrom.astrometry.AstrometryTask Class Reference
Inheritance diagram for lsst.meas.astrom.astrometry.AstrometryTask:
lsst.meas.astrom.ref_match.RefMatchTask

Public Member Functions

 __init__ (self, refObjLoader=None, schema=None, **kwargs)
 
 run (self, sourceCat, exposure, exposure_region=None)
 
 solve (self, exposure, sourceCat, exposure_region=None)
 
 check (self, exposure, sourceCat, nMatches)
 
 setRefObjLoader (self, refObjLoader)
 
 loadAndMatch (self, exposure, sourceCat)
 

Public Attributes

 usedKey
 
 refObjLoader = refObjLoader
 

Static Public Attributes

 ConfigClass = RefMatchConfig
 

Protected Member Functions

 _matchAndFitWcs (self, refCat, sourceCat, goodSourceCat, refFluxField, bbox, wcs, matchTolerance, exposure=None)
 
 _removeMagnitudeOutliers (self, sourceFluxField, refFluxField, matchesIn)
 
 _compute_ref_src_filter_diff (self, band, refFluxField, refCat)
 
 _do_fiducial_zeropoint_culling (self, band, refFluxField, refCat, sourceCat, expTime)
 
 _computeMatchStatsOnSky (self, matchList)
 

Static Protected Attributes

str _DefaultName = "calibrationBaseClass"
 

Detailed Description

Match an input source catalog with objects from a reference catalog and
solve for the WCS.

This task is broken into two main subasks: matching and WCS fitting which
are very interactive. The matching here can be considered in part a first
pass WCS fitter due to the fitter's sensitivity to outliers.

Parameters
----------
refObjLoader : `lsst.meas.algorithms.ReferenceLoader`
    A reference object loader object; gen3 pipeline tasks will pass `None`
    and call `setRefObjLoader` in `runQuantum`.
schema : `lsst.afw.table.Schema`
    Used to set "calib_astrometry_used" flag in output source catalog.
**kwargs
    Additional keyword arguments for pipe_base
    `lsst.pipe.base.Task.__init__`.

Definition at line 157 of file astrometry.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.astrom.astrometry.AstrometryTask.__init__ ( self,
refObjLoader = None,
schema = None,
** kwargs )

Definition at line 179 of file astrometry.py.

Member Function Documentation

◆ _compute_ref_src_filter_diff()

lsst.meas.astrom.astrometry.AstrometryTask._compute_ref_src_filter_diff ( self,
band,
refFluxField,
refCat )
protected
Compute the median ref flux - source filter color difference.

The median difference in color between the flux field used for
selection and that of the observations being calibrated is computed
from the values for each in the reference catalog.

Parameters
----------
band : `str`
    Bandpass of observed data.
refFluxField : `str`
    Name of the flux field used in the reference catalog.
refCat : `lsst.afw.table.SimpleCatalog`
    Catalog of reference objects from which to compute the color
    offset.

Returns
-------
refColorDelta : `float`
    The median color difference.

Definition at line 612 of file astrometry.py.

◆ _computeMatchStatsOnSky()

lsst.meas.astrom.ref_match.RefMatchTask._computeMatchStatsOnSky ( self,
matchList )
protectedinherited
Compute on-sky radial distance statistics for a match list

Parameters
----------
matchList : `list` of `lsst.afw.table.ReferenceMatch`
    list of matches between reference object and sources;
    the distance field is the only field read and it must be set to distance in radians

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with components:

    - ``distMean`` : clipped mean of on-sky radial separation (`float`)
    - ``distStdDev`` : clipped standard deviation of on-sky radial
      separation (`float`)
    - ``maxMatchDist`` : distMean + self.config.matchDistanceSigma *
      distStdDev (`float`)

Definition at line 210 of file ref_match.py.

◆ _do_fiducial_zeropoint_culling()

lsst.meas.astrom.astrometry.AstrometryTask._do_fiducial_zeropoint_culling ( self,
band,
refFluxField,
refCat,
sourceCat,
expTime )
protected
Perform a culling of the catalogs to attempt to match their
effective magnitude ranges.

This uses a fiducial zeropoint along with the exposure time for
the observations to compute our best-guess magnitudes.  Also,
accommodation is made for the  median difference in color between
the flux field used for selection and that of the observations being
calibrated, which is computed from the values for each in the reference
catalog.

Parameters
----------
band : `str`
    Bandpass of observed data.
refFluxField : `str`
    Name of the flux field used in the reference catalog.
refCat : `lsst.afw.table.SimpleCatalog`
    Catalog of reference objects to be passed to the matcher. Modified
    in place.
sourceCat : `lsst.afw.table.SourceCatalog`
    Catalog of observed sources to be passed to the matcher. Modified
    in place.
expTime : `float`
    Exposure time of the observation being calibrated.

Returns
-------
refColorDelta : `float`
    The median color difference.

Definition at line 663 of file astrometry.py.

◆ _matchAndFitWcs()

lsst.meas.astrom.astrometry.AstrometryTask._matchAndFitWcs ( self,
refCat,
sourceCat,
goodSourceCat,
refFluxField,
bbox,
wcs,
matchTolerance,
exposure = None )
protected
Match sources to reference objects and fit a WCS.

Parameters
----------
refCat : `lsst.afw.table.SimpleCatalog`
    catalog of reference objects
sourceCat : `lsst.afw.table.SourceCatalog`
    catalog of sources detected on the exposure
goodSourceCat : `lsst.afw.table.SourceCatalog`
    catalog of down-selected good sources detected on the exposure
refFluxField : 'str'
    field of refCat to use for flux
bbox : `lsst.geom.Box2I`
    bounding box of exposure
wcs : `lsst.afw.geom.SkyWcs`
    initial guess for WCS of exposure
matchTolerance : `lsst.meas.astrom.MatchTolerance`
    a MatchTolerance object (or None) specifying
    internal tolerances to the matcher. See the MatchTolerance
    definition in the respective matcher for the class definition.
exposure : `lsst.afw.image.Exposure`, optional
    exposure whose WCS is to be fit, or None; used only for the debug
    display.

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with components:

    - ``matches``:  astrometric matches
      (`list` of `lsst.afw.table.ReferenceMatch`).
    - ``wcs``:  the fit WCS (lsst.afw.geom.SkyWcs).
    - ``scatterOnSky`` :  median on-sky separation between reference
      objects and sources in "matches" (`lsst.afw.geom.Angle`).

Definition at line 463 of file astrometry.py.

◆ _removeMagnitudeOutliers()

lsst.meas.astrom.astrometry.AstrometryTask._removeMagnitudeOutliers ( self,
sourceFluxField,
refFluxField,
matchesIn )
protected
Remove magnitude outliers, computing a simple zeropoint.

Parameters
----------
sourceFluxField : `str`
    Field in source catalog for instrumental fluxes.
refFluxField : `str`
    Field in reference catalog for fluxes (nJy).
matchesIn : `list` [`lsst.afw.table.ReferenceMatch`]
    List of source/reference matches input

Returns
-------
matchesOut : `list` [`lsst.afw.table.ReferenceMatch`]
    List of source/reference matches with magnitude
    outliers removed.

Definition at line 562 of file astrometry.py.

◆ check()

lsst.meas.astrom.astrometry.AstrometryTask.check ( self,
exposure,
sourceCat,
nMatches )
Validate the astrometric fit against the maxMeanDistance threshold.

If the distMean metric does not satisfy the requirement of being less
than the value set in config.maxMeanDistanceArcsec, the WCS on the
exposure will be set to None and the coordinate values in the
source catalog will be set to NaN to reflect a failed astrometric fit.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    The exposure whose astrometric fit is being evaluated.
sourceCat : `lsst.afw.table.SourceCatalog`
    The catalog of sources associated with the exposure.
nMatches : `int`
    The number of matches that were found and used during
    the astrometric fit (for logging purposes only).

Raises
------
BadAstrometryFit
    If the measured mean on-sky distance between the matched source and
    reference objects is greater than
    ``self.config.maxMeanDistanceArcsec``.

Definition at line 422 of file astrometry.py.

◆ loadAndMatch()

lsst.meas.astrom.ref_match.RefMatchTask.loadAndMatch ( self,
exposure,
sourceCat )
inherited
Load reference objects overlapping an exposure and match to sources
detected on that exposure.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    exposure that the sources overlap
sourceCat : `lsst.afw.table.SourceCatalog.`
    catalog of sources detected on the exposure

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with Components:

    - ``refCat`` : reference object catalog of objects that overlap the
      exposure (`lsst.afw.table.SimpleCatalog`)
    - ``matches`` :  Matched sources and references
      (`list` of `lsst.afw.table.ReferenceMatch`)
    - ``matchMeta`` : metadata needed to unpersist matches
      (`lsst.daf.base.PropertyList`)

Notes
-----
ignores config.matchDistanceSigma

Definition at line 120 of file ref_match.py.

◆ run()

lsst.meas.astrom.astrometry.AstrometryTask.run ( self,
sourceCat,
exposure,
exposure_region = None )
Load reference objects, match sources and optionally fit a WCS.

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

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    The exposure whose WCS is to be fit.
    The following are read only:
    - bbox
    - 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)
sourceCat : `lsst.afw.table.SourceCatalog`
    The catalog of sources detected on the exposure.
exposure_region : `lsst.sphgeom.Region`, optional
    The exposure region to use for the for the reference catalog
    filtering. If `None`, this region will be set as a padded bbox +
    current WCS of the exposure.


Returns
-------
result : `lsst.pipe.base.Struct`
    with these fields:

    - ``refCat`` : reference object catalog of objects that overlap the
      exposure (with some margin) (`lsst.afw.table.SimpleCatalog`).
    - ``matches`` : astrometric matches
      (`list` of `lsst.afw.table.ReferenceMatch`).
    - ``scatterOnSky`` :  median on-sky separation between reference
      objects and sources in "matches"
      (`lsst.afw.geom.Angle`) or `None` if config.forceKnownWcs True
    - ``matchMeta`` :  metadata needed to unpersist matches
      (`lsst.daf.base.PropertyList`)
    - ``sip`` : a nested struct returned by
      `FitSipApproximationTask.run`.

Definition at line 193 of file astrometry.py.

◆ setRefObjLoader()

lsst.meas.astrom.ref_match.RefMatchTask.setRefObjLoader ( self,
refObjLoader )
inherited
Sets the reference object loader for the task.

Parameters
----------
refObjLoader
    An instance of a reference object loader task or class.

Definition at line 109 of file ref_match.py.

◆ solve()

lsst.meas.astrom.astrometry.AstrometryTask.solve ( self,
exposure,
sourceCat,
exposure_region = None )
Load reference objects overlapping an exposure, match to sources and
fit a WCS

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    The exposure whose WCS is to be fit
    The following are read only:
    - bbox
    - 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)
sourceCat : `lsst.afw.table.SourceCatalog`
    The catalog of sources detected on the exposure.
exposure_region : `lsst.sphgeom.Region`, optional
    The exposure region to use for the for the reference catalog
    filtering. If `None`, this region will be set as a padded bbox +
    current WCS of the exposure.

Returns
-------
result : `lsst.pipe.base.Struct`
    Result struct with components:

    - ``refCat`` : reference object catalog of objects that overlap the
      exposure (with some margin) (`lsst::afw::table::SimpleCatalog`).
    - ``matches`` :  astrometric matches
      (`list` of `lsst.afw.table.ReferenceMatch`).
    - ``scatterOnSky`` :  median on-sky separation between reference
      objects and sources in "matches" (`lsst.geom.Angle`)
    - ``matchMeta`` :  metadata needed to unpersist matches
      (`lsst.daf.base.PropertyList`)

Raises
------
BadAstrometryFit
    If the measured mean on-sky distance between the matched source and
    reference objects is greater than
    ``self.config.maxMeanDistanceArcsec``.

Notes
-----
ignores config.forceKnownWcs

Definition at line 249 of file astrometry.py.

Member Data Documentation

◆ _DefaultName

str lsst.meas.astrom.ref_match.RefMatchTask._DefaultName = "calibrationBaseClass"
staticprotectedinherited

Definition at line 91 of file ref_match.py.

◆ ConfigClass

lsst.meas.astrom.ref_match.RefMatchTask.ConfigClass = RefMatchConfig
staticinherited

Definition at line 90 of file ref_match.py.

◆ refObjLoader

lsst.meas.astrom.ref_match.RefMatchTask.refObjLoader = refObjLoader
inherited

Definition at line 96 of file ref_match.py.

◆ usedKey

lsst.meas.astrom.astrometry.AstrometryTask.usedKey
Initial value:
= schema.addField("calib_astrometry_used", type="Flag",
doc="set if source was used in astrometric calibration")

Definition at line 183 of file astrometry.py.


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