25 #ifndef LSST_JOINTCAL_GTRANSFO_H 26 #define LSST_JOINTCAL_GTRANSFO_H 68 virtual void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const = 0;
78 return Point(xout, yout);
135 virtual double getJacobian(
const double x,
const double y)
const;
143 const double step = 0.01)
const;
165 virtual double paramRef(
const int i)
const;
168 virtual double &
paramRef(
const int i);
225 void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const override {
232 "GtransfoIdentity is the identity transformation: it cannot be fit to anything.");
247 const double step = 0.01)
const override;
297 unsigned const order,
unsigned const nSteps = 50);
300 void setOrder(
const unsigned order);
306 void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const override;
310 const double step = 0.01)
const override;
316 int getNpar()
const override {
return 2 * _nterms; }
342 double coeff(
const unsigned powX,
const unsigned powY,
const unsigned whichCoord)
const;
345 double &
coeff(
const unsigned powX,
const unsigned powY,
const unsigned whichCoord);
348 double coeffOrZero(
const unsigned powX,
const unsigned powY,
const unsigned whichCoord)
const;
350 double determinant()
const;
353 double paramRef(
const int i)
const override;
356 double &
paramRef(
const int i)
override;
369 double computeFit(
StarMatchList const &starMatchList,
Gtransfo const &InTransfo,
const bool UseErrors);
385 void computeMonomials(
double xIn,
double yIn,
double *monomial)
const;
392 ndarray::Array<double, 2, 2> toAstPolyMapCoefficients()
const;
407 double const precision,
int const maxOrder = 9,
408 unsigned const nSteps = 50);
442 GtransfoLin(
const double ox,
const double oy,
const double aa11,
const double aa12,
const double aa21,
472 void setOrder(
const unsigned order);
496 GtransfoLinRot(
const double angleRad,
const Point *center =
nullptr,
const double scaleFactor = 1.0);
534 void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const override;
563 void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const;
566 Point getTangentPoint()
const;
578 Point getCrPix()
const;
582 virtual GtransfoPoly getPixelToTangentPlane()
const = 0;
585 virtual void pixToTangentPlane(
double xPixel,
double yPixel,
double &xTangentPlane,
586 double &yTangentPlane)
const = 0;
613 virtual void pixToTangentPlane(
double xPixel,
double yPixel,
double &xTangentPlane,
614 double &yTangentPlane)
const;
655 virtual void pixToTangentPlane(
double xPixel,
double yPixel,
double &xTangentPlane,
656 double &yTangentPlane)
const;
693 void setTangentPoint(
Point const &tangentPoint);
696 Point getTangentPoint()
const;
699 void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const;
726 typedef void(
GtransfoFun)(
const double,
const double,
double &,
double &,
const void *);
736 void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const;
746 const void *_userData;
756 #endif // LSST_JOINTCAL_GTRANSFO_H virtual std::unique_ptr< Gtransfo > roughInverse(const Frame ®ion) const
Rough inverse.
implements the linear transformations (6 real coefficients).
the transformation that handles pix to sideral transfos (Gnomonic, possibly with polynomial distortio...
A Gtransfo that holds a SkyWcs.
void getParams(double *params) const
params should be at least Npar() long
GtransfoLin(GtransfoIdentity const &)
Handy converter:
virtual void computeDerivative(Point const &where, GtransfoLin &derivative, const double step=0.01) const
Computes the local Derivative of a transfo, w.r.t.
std::ostream & operator<<(std::ostream &out, CcdImageKey const &key)
void transformStar(FatPoint &in) const
allows to write MyTransfo(MyStar)
virtual double getJacobian(Point const &point) const
returns the local jacobian.
void apply(Point const &in, Point &out) const
applies the tranfo to in and writes into out. Is indeed virtual.
void offsetParams(Eigen::VectorXd const &delta)
void() GtransfoFun(const double, const double, double &, double &, const void *)
signature of the user-provided routine that actually does the coordinate transfo for UserTransfo...
GtransfoLinShift(double ox=0., double oy=0.)
Add ox and oy.
std::unique_ptr< Gtransfo > clone() const override
returns a copy (allocated by new) of the transformation.
virtual int getNpar() const
returns the number of parameters (to compute chi2's)
GtransfoLinScale(const double scale=1)
void dump(std::ostream &stream=std::cout) const override
dumps the transfo coefficients to stream.
def scale(algorithm, min, max=None, frame=None)
std::shared_ptr< Image< PixelT > > operator+(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator+()
virtual void transformErrors(Point const &where, const double *vIn, double *vOut) const
transform errors (represented as double[3] in order V(xx),V(yy),Cov(xy))
Implements the (forward) SIP distorsion scheme.
Point apply(Point const &in) const
All these apply(..) shadow the virtual one in derived classes, unless one writes "using Gtransfo::app...
void write(const std::string &fileName) const
virtual double fit(StarMatchList const &starMatchList)=0
fits a transfo to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
GtransfoLin linPixelToTan
Polynomial transformation class.
std::shared_ptr< GtransfoPoly > inversePolyTransfo(Gtransfo const &forward, Frame const &domain, double const precision, int const maxOrder=9, unsigned const nSteps=50)
Approximate the inverse by a polynomial, to some precision.
GtransfoLin normalizeCoordinatesTransfo(const Frame &frame)
Returns the transformation that maps the input frame along both axes to [-1,1].
A Point with uncertainties.
GtransfoLin()
the default constructor constructs the do-nothing transformation.
bool isIntegerShift(const Gtransfo *gtransfo)
Shorthand test to tell if a transfo is a simple integer shift.
std::unique_ptr< Gtransfo > clone() const
returns a copy (allocated by new) of the transformation.
just here to provide a specialized constructor, and fit.
GtransfoLinScale(const double scaleX, const double scaleY)
rectangle with sides parallel to axes.
A base class for image defects.
int getNpar() const
total number of parameters
int getNpar() const override
returns the number of parameters (to compute chi2's)
GtransfoIdentity()
constructor.
std::shared_ptr< afw::geom::SkyWcs > getSkyWcs() const
This one is the Tangent Plane (called gnomonic) projection (from celestial sphere to tangent plane) ...
GtransfoLinShift(Point const &point)
virtual std::unique_ptr< Gtransfo > composeAndReduce(Gtransfo const &right) const
Return a reduced composition of newTransfo = this(right()), or nullptr if it cannot be reduced...
virtual double paramRef(const int i) const
virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const
virtual std::shared_ptr< ast::Mapping > toAstMap(jointcal::Frame const &domain) const
Create an equivalent AST mapping for this transformation, including an analytic inverse if possible...
const GtransfoPoly * getCorr() const
Get a non-owning pointer to the correction transform polynomial.
unsigned getOrder() const
Returns the polynomial order.
std::shared_ptr< Image< PixelT > > operator-(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator-()
A do-nothing transformation. It anyway has dummy routines to mimick a Gtransfo.
table::Key< table::Array< double > > coeff
just here to provide a specialized constructor, and fit.
void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override
xOut = xIn; yOut = yIn !
just here to provide specialized constructors. GtransfoLin fit routine.
a virtual (interface) class for geometric transformations.
std::unique_ptr< Gtransfo > composeAndReduce(Gtransfo const &right) const override
Return a reduced composition of newTransfo = this(right()), or nullptr if it cannot be reduced...
std::unique_ptr< GtransfoPoly > corr
virtual void paramDerivatives(Point const &where, double *dx, double *dy) const
Derivative w.r.t parameters.
std::unique_ptr< Gtransfo > clone() const override
returns a copy (allocated by new) of the transformation.
double fit(StarMatchList const &starMatchList) override
fits a transfo to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
a run-time transfo that allows users to define a Gtransfo with minimal coding (just the transfo routi...
Reports errors from accepting an object of an unexpected or inappropriate type.
std::unique_ptr< Gtransfo > gtransfoRead(const std::string &fileName)
The virtual constructor from a file.
virtual std::unique_ptr< Gtransfo > clone() const =0
returns a copy (allocated by new) of the transformation.
virtual void dump(std::ostream &stream=std::cout) const =0
dumps the transfo coefficients to stream.
int getNpar() const
total number of parameters
void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override
int getNpar() const
total number of parameters
virtual GtransfoLin linearApproximation(Point const &where, const double step=0.01) const
linear (local) approximation.
int getNpar() const override
total number of parameters
virtual std::unique_ptr< Gtransfo > inverseTransfo(const double precision, const Frame ®ion) const
returns an inverse transfo. Numerical if not overloaded.
virtual void apply(const double xIn, const double yIn, double &xOut, double &yOut) const =0
std::unique_ptr< Gtransfo > gtransfoCompose(Gtransfo const &left, Gtransfo const &right)
Returns a pointer to a composition of gtransfos, representing left(right()).