2 #ifndef LSST_JOINTCAL_SIMPLE_POLY_MAPPING_H
3 #define LSST_JOINTCAL_SIMPLE_POLY_MAPPING_H
30 std::unique_ptr<GtransfoLin>
lin;
59 for (
unsigned k = 0; k <
getNpar(); ++k) indices[k] =
index + k;
64 transfo->transformPosAndErrors(where, outPoint);
66 errorProp->transformPosAndErrors(where, tmp);
75 derivative(0, 0) =
lin->coeff(1, 0, 0);
82 derivative(1, 0) =
lin->coeff(0, 1, 0);
83 derivative(0, 1) =
lin->coeff(1, 0, 1);
84 derivative(1, 1) =
lin->coeff(0, 1, 1);
99 transfo->paramDerivatives(where, &H(0, 0), &H(0, 1));
112 Eigen::Matrix2d preDer;
129 preDer(0, 0) = _centerAndScale.
coeff(1, 0, 0);
130 preDer(1, 0) = _centerAndScale.
coeff(0, 1, 0);
131 preDer(0, 1) = _centerAndScale.
coeff(1, 0, 1);
132 preDer(1, 1) = _centerAndScale.
coeff(0, 1, 1);
136 assert((&H(1, 0) - &H(0, 0)) == 1);
145 derivative(0, 0) =
lin->coeff(1, 0, 0);
152 derivative(1, 0) =
lin->coeff(0, 1, 0);
153 derivative(0, 1) =
lin->coeff(1, 0, 1);
154 derivative(1, 1) =
lin->coeff(0, 1, 1);
155 derivative = preDer * derivative;
166 transfo->transformPosAndErrors(mid, outPoint);
168 errorProp->transformPosAndErrors(mid, tmp);
169 outPoint.
vx = tmp.
vx;
170 outPoint.
vy = tmp.
vy;
172 transfo->paramDerivatives(mid, &H(0, 0), &H(0, 1));
179 transfo->transformPosAndErrors(mid, outPoint);
181 errorProp->transformPosAndErrors(mid, tmp);
182 outPoint.
vx = tmp.
vx;
183 outPoint.
vy = tmp.
vy;
191 actualResult = (*fittedPoly) * _centerAndScale;
199 class SimpleIdentityMapping :
public SimpleGtransfoMapping<GtransfoIdentity> {
202 virtual void computeTransformAndDerivatives(
const FatPoint &where, FatPoint &outPoint,
211 #endif // LSST_JOINTCAL_SIMPLE_POLY_MAPPING_H
virtual void freezeErrorScales()
implements the linear transformations (6 real coefficients).
virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const
a mix of apply and Derivative
void transformPosAndErrors(const FatPoint &where, FatPoint &outPoint) const
The same as above but without the parameter derivatives (used to evaluate chi^2)
virtual class needed in the abstraction of the distortion model
unsigned getIndex() const
position of the parameters within the grand fitting scheme
double coeff(const unsigned powX, const unsigned powY, const unsigned whichCoord) const
access to coefficients (read only)
virtual void computeTransformAndDerivatives(const FatPoint &where, FatPoint &outPoint, Eigen::MatrixX2d &H) const
Actually applies the mapping and evaluates the derivatives w.r.t the fitted parameters.
Mapping implementation for a polynomial transformation.
void setMappingIndices(std::vector< unsigned > &indices) const
Sets how this set of parameters (of length Npar()) map into the "grand" fit Expects that indices has ...
void transformPosAndErrors(const FatPoint &where, FatPoint &outPoint) const
Implements as well the centering and scaling of coordinates.
Polynomial transformation class.
unsigned getNpar() const
Number of parameters in total.
void offsetParams(const double *delta)
Remember the error scale and freeze it.
A Point with uncertainties.
virtual const Gtransfo & getTransfo() const
Access to the (fitted) transfo.
void apply(const double xIn, const double yIn, double &xOut, double &yOut) const
SimplePolyMapping(const GtransfoLin &CenterAndScale, const GtransfoPoly >ransfo)
The transformation will be initialized to gtransfo, so that the effective transformation reads gtrans...
virtual void computeTransformAndDerivatives(const FatPoint &where, FatPoint &outPoint, Eigen::MatrixX2d &H) const
Calls the transforms and implements the centering and scaling of coordinates.
const Gtransfo & getTransfo() const
Access to the (fitted) transfo.
void setIndex(unsigned i)
Eigen::Matrix< double, Eigen::Dynamic, 2 > MatrixX2d
void positionDerivative(const Point &where, Eigen::Matrix2d &derivative, double epsilon) const
The derivative w.r.t. position.
a virtual (interface) class for geometric transformations.
void positionDerivative(const Point &where, Eigen::Matrix2d &derivative, double epsilon) const
The derivative w.r.t. position.
SimpleGtransfoMapping(const Gtransfo >ransfo, bool toFit=true)
std::unique_ptr< GtransfoLin > lin
std::shared_ptr< Gtransfo > errorProp
std::shared_ptr< Gtransfo > transfo