25#ifndef LSST_JOINTCAL_ASTROMETRY_TRANSFORM_H
26#define LSST_JOINTCAL_ASTROMETRY_TRANSFORM_H
48class AstrometryTransformLinear;
68 virtual void apply(
double xIn,
double yIn,
double &xOut,
double &yOut)
const = 0;
78 return Point(xout, yout);
142 double step = 0.01)
const;
156 const Frame ®ion)
const;
165 virtual double paramRef(Eigen::Index i)
const;
168 virtual double &
paramRef(Eigen::Index i);
225 void apply(
const double xIn,
const double yIn,
double &xOut,
double &yOut)
const override {
232 "AstrometryTransformIdentity is the identity transformation: it cannot be fit to anything.");
237 return right.clone();
249 double step = 0.01)
const override;
253 double step = 0.01)
const override;
272 AstrometryTransformIdentity
const &
right);
311 void apply(
double xIn,
double yIn,
double &xOut,
double &yOut)
const override;
315 double step = 0.01)
const override;
362 double paramRef(Eigen::Index i)
const override;
365 double &
paramRef(Eigen::Index i)
override;
395 void computeMonomials(
double xIn,
double yIn,
double *monomial)
const;
402 ndarray::Array<double, 2, 2> toAstPolyMapCoefficients()
const;
448 double step = 0.01)
const override;
451 double step = 0.01)
const override;
459 double aa21,
double aa22);
469 const Frame ®ion)
const override;
518 double scaleFactor = 1.0);
557 void apply(
double xIn,
double yIn,
double &xOut,
double &yOut)
const override;
586 void apply(
double xIn,
double yIn,
double &xOut,
double &yOut)
const;
609 double &yTangentPlane)
const = 0;
621class TanRaDecToPixel;
639 virtual void pixToTangentPlane(
double xPixel,
double yPixel,
double &xTangentPlane,
640 double &yTangentPlane)
const;
683 virtual void pixToTangentPlane(
double xPixel,
double yPixel,
double &xTangentPlane,
684 double &yTangentPlane)
const;
727 void apply(
double xIn,
double yIn,
double &xOut,
double &yOut)
const;
748 double ra0{}, dec0{};
749 double cos0{}, sin0{};
767 void apply(
double xIn,
double yIn,
double &xOut,
double &yOut)
const;
777 const void *_userData;
std::unique_ptr< AstrometryTransformPolynomial > corr
virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane, double &yTangentPlane) const =0
Transform from pixels to tangent plane (degrees)
Point getCrPix() const
Get the pixel origin of the WCS (CRPIX in FITS WCS terminology, but zero-based)
BaseTanWcs & operator=(const BaseTanWcs &original)
BaseTanWcs(AstrometryTransformLinear const &pixToTan, Point const &tangentPoint, const AstrometryTransformPolynomial *corrections=nullptr)
AstrometryTransformLinear getLinPart() const
The Linear part (corresponding to CD's and CRPIX's)
const AstrometryTransformPolynomial * getCorr() const
Get a non-owning pointer to the correction transform polynomial.
virtual AstrometryTransformPolynomial getPixelToTangentPlane() const =0
Get a transform from pixels to tangent plane (degrees) This is a linear transform plus the effects of...
Point getTangentPoint() const
Get the sky origin (CRVAL in FITS WCS terminology) in degrees.
void apply(double xIn, double yIn, double &xOut, double &yOut) const
Transform pixels to ICRS RA, Dec in degrees.
AstrometryTransformLinear linPixelToTan
void setCorrections(std::unique_ptr< AstrometryTransformPolynomial > corrections)
Assign the correction polynomial (what it means is left to derived classes)
A Point with uncertainties.
rectangle with sides parallel to axes.
The transformation that handles pixels to sideral transformations (Gnomonic, possibly with polynomial...
TanPixelToRaDec operator*(AstrometryTransformLinear const &right) const
composition with AstrometryTransformLinear
std::unique_ptr< AstrometryTransform > clone() const
returns a copy (allocated by new) of the transformation.
TanRaDecToPixel inverted() const
approximate inverse : it ignores corrections;
double fit(StarMatchList const &starMatchList)
Not implemented yet, because we do it otherwise.
virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane, double &yTangentPlane) const
transforms from pixel space to tangent plane (degrees)
void print(std::ostream &out) const
prints the transform coefficients to stream.
std::unique_ptr< AstrometryTransform > roughInverse(const Frame ®ion) const
Overload the "generic routine" (available for all AstrometryTransform types.
AstrometryTransformPolynomial getPixelToTangentPlane() const
the transformation from pixels to tangent plane (degrees)
std::unique_ptr< AstrometryTransform > inverseTransform(double precision, const Frame ®ion) const
Inverse transform: returns a TanRaDecToPixel if there are no corrections, or the iterative solver if ...
std::unique_ptr< AstrometryTransform > composeAndReduce(AstrometryTransformLinear const &right) const
Return a reduced composition of newTransform = this(right()), or nullptr if it cannot be reduced.
This one is the Tangent Plane (called gnomonic) projection (from celestial sphere to tangent plane)
void transformPosAndErrors(const FatPoint &in, FatPoint &out) const
transform with analytical derivatives
Point getTangentPoint() const
tangent point coordinates (degrees)
double fit(StarMatchList const &starMatchList)
fits a transform to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
void setTangentPoint(Point const &tangentPoint)
Resets the projection (or tangent) point.
std::unique_ptr< AstrometryTransform > inverseTransform(double precision, const Frame ®ion) const
Inverse transform: returns a TanPixelToRaDec.
TanPixelToRaDec inverted() const
exact typed inverse:
void apply(double xIn, double yIn, double &xOut, double &yOut) const
std::unique_ptr< AstrometryTransform > clone() const
returns a copy (allocated by new) of the transformation.
AstrometryTransformLinear getLinPart() const
The Linear part (corresponding to CD's and CRPIX's)
std::unique_ptr< AstrometryTransform > roughInverse(const Frame ®ion) const
Overload the "generic routine" (available for all AstrometryTransform types.
void print(std::ostream &out) const
prints the transform coefficients to stream.
Implements the (forward) SIP distorsion scheme.
std::unique_ptr< AstrometryTransform > inverseTransform(double precision, const Frame ®ion) const
Inverse transform: returns a TanRaDecToPixel if there are no corrections, or the iterative solver if ...
void print(std::ostream &out) const
prints the transform coefficients to stream.
double fit(StarMatchList const &starMatchList)
Not implemented yet, because we do it otherwise.
virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane, double &yTangentPlane) const
transforms from pixel space to tangent plane (degrees)
std::unique_ptr< AstrometryTransform > clone() const
returns a copy (allocated by new) of the transformation.
AstrometryTransformPolynomial getPixelToTangentPlane() const
the transformation from pixels to tangent plane (degrees)
Reports errors from accepting an object of an unexpected or inappropriate type.
AstrometryTransformLinear normalizeCoordinatesTransform(const Frame &frame)
Returns the transformation that maps the input frame along both axes to [-1,1].
std::shared_ptr< AstrometryTransformPolynomial > inversePolyTransform(AstrometryTransform const &forward, Frame const &domain, double precision, std::size_t maxOrder=9, std::size_t nSteps=50)
Approximate the inverse by a polynomial, to some precision.
bool isIntegerShift(const AstrometryTransform *transform)
Shorthand test to tell if a transform is a simple integer shift.
std::unique_ptr< AstrometryTransform > compose(AstrometryTransform const &left, AstrometryTransform const &right)
Returns a pointer to a composition of transforms, representing left(right()).
std::unique_ptr< AstrometryTransform > astrometryTransformRead(const std::string &fileName)
The virtual constructor from a file.
void(const double, const double, double &, double &, const void *) AstrometryTransformFun
signature of the user-provided routine that actually does the coordinate transform for UserTransform.
std::ostream & operator<<(std::ostream &stream, AstrometryMapping const &mapping)