FitSipDistortionTask¶
FitSipDistortionTask
is a dropin replacement for
lsst.meas.astrom.FitTanSipWcsTask
. It is built on fundamentally
stronger fitting algorithms, but has received significantly less testing.
Like lsst.meas.astrom.FitTanSipWcsTask
, this task is most easily
used as the wcsFitter component of
lsst.meas.astrom.AstrometryTask
; it can be enabled in a config
file via e.g.
from lsst.meas.astrom import FitSipDistortionTask
config.(...).astometry.wcsFitter.retarget(FitSipDistortionTask)
Processing summary¶
FitSipDistortionTask
involves three steps:
 We set the CRVAL and CRPIX reference points to the mean positions of the matches, while holding the CD matrix fixed to the value passed in to the run() method. This work is done by the makeInitialWcs method.i
 We fit the SIP “reverse transform” (the AP and BP polynomials that map
“intermediate world coordinates” to pixels). This happens iteratively;
while fitting for the polynomial coefficients given a set of matches is
a linear operation that can be done without iteration, outlier
rejection using sigmaclipping and estimation of the intrinsic scatter
are not. By fitting the reverse transform first, we can do outlier
rejection in pixel coordinates, where we can better handle the source
measurement uncertainties that contribute to the overall scatter. This
fit results in a
lsst::meas::astrom::ScaledPolynomialTransform
, which is somewhat more general than the SIP reverse transform in that it allows an affine transform both before and after the polynomial. This is somewhat more numerically stable than the SIP form, which applies only a linear transform (with no offset) before the polynomial and only a shift afterwards. We only convert to SIP form once the fitting is complete. This conversion is exact (though it may be subject to significant roundoff error) as long as we do not attempt to null the loworder SIP polynomial terms (we do not).  Once the SIP reverse transform has been fit, we use it to populate a grid of points that we use as the data points for fitting its inverse, the SIP forward transform. Because our “data” here is artificial, there is no need for outlier rejection or uncertainty handling. We again fit a general scaled polynomial, and only convert to SIP form when the fit is complete.
Python API summary¶
from lsst.meas.astrom.fitSipDistortion import FitSipDistortionTask

class
(**kwargs)FitSipDistortionTask
Fit a TANSIP WCS given a list of reference object/source matches
...

attribute
config
Access configuration fields and retargetable subtasks.
See also
See the FitSipDistortionTask
API reference for complete details.
Retargetable subtasks¶
No subtasks.
Configuration fields¶
gridBorder¶
maxScatterArcsec¶
 Default
10
 Field type
float
RangeField
 Range
 [0,inf)
nGridX¶
nGridY¶
refUncertainty¶
rejSigma¶
 Default
3.0
 Field type
float
RangeField
 Range
 [0.0,inf)
Debugging¶
Enabling DEBUGlevel logging on this task will report the number of outliers rejected and the current estimate of intrinsic scatter at each iteration.
FitSipDistortionTask also supports the following lsstDebug variables to control diagnostic displays:
 FitSipDistortionTask.display: if True, enable display diagnostics.
 FitSipDistortionTask.frame: frame to which the display will be sent
 FitSipDistortionTask.pause: whether to pause (by dropping into pdb) between iterations (default is True). If False, multiple frames will be used, starting at the given number.
The diagnostic display displays the image (or an empty image if exposure=None) overlaid with the positions of sources and reference objects will be shown for every iteration in the reverse transform fit. The legend for the overlay is:
 Red X
 Reference sources transformed without SIP distortion terms; this uses a TAN WCS whose CRPIX, CRVAL and CD matrix are the same as those in the TANSIP WCS being fit. These are not expected to line up with sources unless distortion is small.
 Magenta X
 Same as Red X, but for matches that were rejected as outliers.
 Red O
 Reference sources using the current bestfit TANSIP WCS. These are connected to the corresponding nondistorted WCS position by a red line, and should be a much better fit to source positions than the Red Xs.
 Magenta O
 Same as Red O, but for matches that were rejected as outliers.
 Green Ellipse
 Source positions and their error ellipses, including the current estimate of the intrinsic scatter.
 Cyan Ellipse
 Same as Green Ellipse, but for matches that were rejected as outliers.
Reference to parameters:
See lsst.pipe.base.Task
; FitSipDistortionTask does not add any
additional constructor parameters.