LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
|
A fitter class for scaled polynomial transforms. More...
#include <ScaledPolynomialTransformFitter.h>
Classes | |
class | Keys |
Public Member Functions | |
void | fit (int order=-1) |
Perform a linear least-squares fit of the polynomial coefficients. | |
void | updateModel () |
Update the 'model' field in the data catalog using the current best- fit transform. | |
double | updateIntrinsicScatter () |
Infer the intrinsic scatter in the offset between the data points and the best-fit model, and update the uncertainties accordingly. | |
double | getIntrinsicScatter () const |
Return the current estimate of the intrinsic scatter. | |
std::pair< double, size_t > | rejectOutliers (OutlierRejectionControl const &ctrl) |
Mark outliers in the data catalog using sigma clipping. | |
afw::table::BaseCatalog const & | getData () const |
Return a catalog of data points and model values for diagnostic purposes. | |
ScaledPolynomialTransform const & | getTransform () const |
Return the best-fit transform. | |
PolynomialTransform const & | getPoly () const |
Return the polynomial part of the best-fit transform. | |
geom::AffineTransform const & | getInputScaling () const |
Return the input scaling transform that maps input data points to [-1, 1]. | |
geom::AffineTransform const & | getOutputScaling () const |
Return the output scaling transform that maps output data points to [-1, 1]. | |
Static Public Member Functions | |
static ScaledPolynomialTransformFitter | fromMatches (int maxOrder, afw::table::ReferenceMatchVector const &matches, afw::geom::SkyWcs const &initialWcs, double intrinsicScatter) |
Initialize a fit from intermediate world coordinates to pixels using source/reference matches. | |
static ScaledPolynomialTransformFitter | fromGrid (int maxOrder, geom::Box2D const &bbox, int nGridX, int nGridY, ScaledPolynomialTransform const &toInvert) |
Initialize a fit that inverts an existing transform by evaluating and fitting to points on a grid. | |
A fitter class for scaled polynomial transforms.
This class allows for iteration between actual fitting, outlier rejection, and estimation of intrinsic scatter. It also provides access to the current model for debugging via an afw::table::BaseCatalog that contains the input values, output values, and the best-fit-transformed input values.
ScaledPolynomialTransformFitter has two public construction methods:
In either case, the fitter creates affine transforms that map the input and output data points onto [-1, 1]. It then fits a polynomial transform that, when composed with the input scaling transform and the inverse of the output scaling transform, maps the input data points to the output data points.
The fitter can be used in an outlier-rejection loop with the following pattern (with user-defined convergence criteria):
This pattern fits a model, uses that model to transform the input points, estimates intrinsic scatter from the differences between model-transformed points and output data points, and finally rejects outliers by sigma-clipping those differences before repeating.
ScaledPolynomialTransformFitter instances should be confined to a single thread.
Definition at line 101 of file ScaledPolynomialTransformFitter.h.
void lsst::meas::astrom::ScaledPolynomialTransformFitter::fit | ( | int | order = -1 | ) |
Perform a linear least-squares fit of the polynomial coefficients.
[in] | order | The maximum order of the polynomial transform. If negative (the default) the maxOrder from construction is used. |
After fitting, updateModel() should be called to apply the model transform to the input points if the user wants to make use of the data catalog for diagnostics. Calling fit() alone is sufficient if the user is only interested in getting the model transform itself.
Definition at line 200 of file ScaledPolynomialTransformFitter.cc.
|
static |
Initialize a fit that inverts an existing transform by evaluating and fitting to points on a grid.
[in] | maxOrder | Maximum polynomial order for the fit. |
[in] | bbox | Bounding box for the grid in the input coordinates of the toInvert transform (or equivalently the output coordinates of the transform to be fit). |
[in] | nGridX | Number of grid points in the X direction. |
[in] | nGridY | Number of grid points in the Y direction. |
[in] | toInvert | Transform to invert |
This initializes the data catalog with the following fields:
The updateIntrinsicScatter and rejectOutliers methods cannot be used on fitters initialized using this method.
Definition at line 150 of file ScaledPolynomialTransformFitter.cc.
|
static |
Initialize a fit from intermediate world coordinates to pixels using source/reference matches.
[in] | maxOrder | Maximum polynomial order for the fit. |
[in] | matches | Vector of source-reference matches. The centroids and centroid errors from the sources are used, along with the coords from the reference objects. |
[in] | initialWcs | Initial WCS, used to transform reference positions to intermediate world coordinates and populate the "ref" field in the data catalog. |
[in] | intrinsicScatter | Initial intrinsic scatter to be added in quadrature with source measurement errors in setting the uncertainty on each match. |
This initializes the data catalog with the following fields:
Definition at line 127 of file ScaledPolynomialTransformFitter.cc.
|
inline |
Return a catalog of data points and model values for diagnostic purposes.
The values in the returned catalog should not be modified by the user.
For information about the schema, either introspect it programmatically or see fromMatches and fromGrid.
Definition at line 249 of file ScaledPolynomialTransformFitter.h.
|
inline |
Return the input scaling transform that maps input data points to [-1, 1].
Definition at line 270 of file ScaledPolynomialTransformFitter.h.
|
inline |
Return the current estimate of the intrinsic scatter.
Because the intrinsic scatter is included in the uncertainty used in both the fit and outlier rejection, this may be called either before updateIntrinsicScatter() to obtain the scatter used in the last such operation or after updateIntrinsicScatter() to obtain the scatter to be used in the next operation.
Definition at line 219 of file ScaledPolynomialTransformFitter.h.
|
inline |
Return the output scaling transform that maps output data points to [-1, 1].
Definition at line 275 of file ScaledPolynomialTransformFitter.h.
|
inline |
Return the polynomial part of the best-fit transform.
Definition at line 265 of file ScaledPolynomialTransformFitter.h.
|
inline |
Return the best-fit transform.
If f is an instance of this class, then for an arbitrary point p:
Definition at line 260 of file ScaledPolynomialTransformFitter.h.
std::pair< double, std::size_t > lsst::meas::astrom::ScaledPolynomialTransformFitter::rejectOutliers | ( | OutlierRejectionControl const & | ctrl | ) |
Mark outliers in the data catalog using sigma clipping.
A data point is declare an outlier if:
Should be called after updateIntrinsicScatter() and before fit() if the fitter is being used in an outlier rejection loop.
Definition at line 367 of file ScaledPolynomialTransformFitter.cc.
double lsst::meas::astrom::ScaledPolynomialTransformFitter::updateIntrinsicScatter | ( | ) |
Infer the intrinsic scatter in the offset between the data points and the best-fit model, and update the uncertainties accordingly.
The scatter is calculated as the RMS scatter that maximizes the likelihood of the current positional offsets (assumed fixed) assuming the per-data-point uncertainties are the quadrature sum of the intrinsic scatter and that source's centroid measurement uncertainty.
Should be called after updateModel() and before rejectOutliers() if the fitter is being used in an outlier-rejection loop.
Definition at line 297 of file ScaledPolynomialTransformFitter.cc.
void lsst::meas::astrom::ScaledPolynomialTransformFitter::updateModel | ( | ) |
Update the 'model' field in the data catalog using the current best- fit transform.
Should be called after fit() and before updateIntrinsicScatter() if the fitter is being used in an outlier-rejection loop.
Definition at line 291 of file ScaledPolynomialTransformFitter.cc.