LSST Applications g0f08755f38+82efc23009,g12f32b3c4e+e7bdf1200e,g1653933729+a8ce1bb630,g1a0ca8cf93+50eff2b06f,g28da252d5a+52db39f6a5,g2bbee38e9b+37c5a29d61,g2bc492864f+37c5a29d61,g2cdde0e794+c05ff076ad,g3156d2b45e+41e33cbcdc,g347aa1857d+37c5a29d61,g35bb328faa+a8ce1bb630,g3a166c0a6a+37c5a29d61,g3e281a1b8c+fb992f5633,g414038480c+7f03dfc1b0,g41af890bb2+11b950c980,g5fbc88fb19+17cd334064,g6b1c1869cb+12dd639c9a,g781aacb6e4+a8ce1bb630,g80478fca09+72e9651da0,g82479be7b0+04c31367b4,g858d7b2824+82efc23009,g9125e01d80+a8ce1bb630,g9726552aa6+8047e3811d,ga5288a1d22+e532dc0a0b,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+37c5a29d61,gcf0d15dbbd+2acd6d4d48,gd7358e8bfb+778a810b6e,gda3e153d99+82efc23009,gda6a2b7d83+2acd6d4d48,gdaeeff99f8+1711a396fd,ge2409df99d+6b12de1076,ge79ae78c31+37c5a29d61,gf0baf85859+d0a5978c5a,gf3967379c6+4954f8c433,gfb92a5be7c+82efc23009,gfec2e1e490+2aaed99252,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
AstrometryTransform.h
Go to the documentation of this file.
1// -*- LSST-C++ -*-
2/*
3 * This file is part of jointcal.
4 *
5 * Developed for the LSST Data Management System.
6 * This product includes software developed by the LSST Project
7 * (https://www.lsst.org).
8 * See the COPYRIGHT file at the top-level directory of this distribution
9 * for details of code ownership.
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
25#ifndef LSST_JOINTCAL_ASTROMETRY_TRANSFORM_H
26#define LSST_JOINTCAL_ASTROMETRY_TRANSFORM_H
27
28#include <iostream>
29#include <memory>
30#include <string>
31#include <sstream>
32#include <vector>
33
34#include "Eigen/Core"
35
36#include "lsst/pex/exceptions.h"
39#include "lsst/jointcal/Frame.h"
40
42
43namespace lsst {
44namespace jointcal {
45
46class StarMatchList;
47class Frame;
48class AstrometryTransformLinear;
49
51
66public:
68 virtual void apply(double xIn, double yIn, double &xOut, double &yOut) const = 0;
69
71 void apply(Point const &in, Point &out) const { apply(in.x, in.y, out.x, out.y); }
72
75 Point apply(Point const &in) const {
76 double xout, yout;
77 apply(in.x, in.y, xout, yout);
78 return Point(xout, yout);
79 }
80
89 Frame apply(Frame const &inputframe, bool inscribed) const;
90
92 virtual void print(std::ostream &out) const = 0;
93
96 print(s);
97 return s.str();
98 }
99
101
105 virtual double fit(StarMatchList const &starMatchList) = 0;
106
107 void transformStar(FatPoint &in) const { transformPosAndErrors(in, in); }
108
110 virtual double getJacobian(Point const &point) const { return getJacobian(point.x, point.y); }
111
114
132
134 virtual double getJacobian(double x, double y) const;
135
141 virtual void computeDerivative(Point const &where, AstrometryTransformLinear &derivative,
142 double step = 0.01) const;
143
145 virtual AstrometryTransformLinear linearApproximation(Point const &where, double step = 0.01) const;
146
147 virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const;
148
150 virtual void transformErrors(Point const &where, const double *vIn, double *vOut) const;
151
153
156 const Frame &region) const;
157
159 void getParams(double *params) const;
160
162 void offsetParams(Eigen::VectorXd const &delta);
163
165 virtual double paramRef(Eigen::Index i) const;
166
168 virtual double &paramRef(Eigen::Index i);
169
172 virtual void paramDerivatives(Point const &where, double *dx, double *dy) const;
173
175
177 virtual std::unique_ptr<AstrometryTransform> roughInverse(const Frame &region) const;
178
180 virtual std::size_t getNpar() const { return 0; }
181
190 throw std::logic_error("toAstMap is not implemented for this class.");
191 }
192
193 void write(const std::string &fileName) const;
194
195 virtual void write(std::ostream &stream) const;
196
197 virtual ~AstrometryTransform() = default;;
198};
199
201
215
216/*=============================================================*/
218
220public:
223
225 void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override {
226 xOut = xIn;
227 yOut = yIn;
228 } // to speed up
229
230 double fit(StarMatchList const &starMatchList) override {
232 "AstrometryTransformIdentity is the identity transformation: it cannot be fit to anything.");
233 }
234
237 return right.clone();
238 }
239
240 void print(std::ostream &out) const override { out << "x' = x\ny' = y" << std::endl; }
241
242 std::size_t getNpar() const override { return 0; }
243
247
248 void computeDerivative(Point const &where, AstrometryTransformLinear &derivative,
249 double step = 0.01) const override;
250
253 double step = 0.01) const override;
254
256 std::shared_ptr<ast::Mapping> toAstMap(jointcal::Frame const &domain) const override;
257
258 void write(std::ostream &s) const override;
259
260 void read(std::istream &s);
261
262 // ClassDef(AstrometryTransformIdentity,1)
263};
264
271std::unique_ptr<AstrometryTransform> compose(AstrometryTransform const &left,
272 AstrometryTransformIdentity const &right);
273
275bool isIntegerShift(const AstrometryTransform *transform);
276
277/*==================== AstrometryTransformPolynomial =======================*/
278
281public:
288
291 std::size_t nPoint = 1000);
292
302 jointcal::Frame const &domain, std::size_t order, std::size_t nSteps = 50);
303
307 std::size_t getOrder() const { return _order; }
308
309 using AstrometryTransform::apply; // to unhide AstrometryTransform::apply(Point const &)
310
311 void apply(double xIn, double yIn, double &xOut, double &yOut) const override;
312
314 void computeDerivative(Point const &where, AstrometryTransformLinear &derivative,
315 double step = 0.01) const override;
316
318 virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const override;
319
321 std::size_t getNpar() const override { return 2 * _nterms; }
322
324 void print(std::ostream &out) const override;
325
327 double fit(StarMatchList const &starMatchList) override;
328
331
334
337
338 using AstrometryTransform::composeAndReduce; // to unhide
339 // AstrometryTransform::composeAndReduce(AstrometryTransform
340 // const &)
343
347
352 double getCoefficient(std::size_t powX, std::size_t powY, std::size_t whichCoord) const;
353 double &getCoefficient(std::size_t powX, std::size_t powY, std::size_t whichCoord);
357 double coeffOrZero(std::size_t powX, std::size_t powY, std::size_t whichCoord) const;
358
359 double determinant() const;
360
362 double paramRef(Eigen::Index i) const override;
363
365 double &paramRef(Eigen::Index i) override;
366
369 void paramDerivatives(Point const &where, double *dx, double *dy) const override;
370
372 std::shared_ptr<ast::Mapping> toAstMap(jointcal::Frame const &domain) const override;
373
374 void write(std::ostream &s) const override;
375 void read(std::istream &s);
376
377private:
378 double computeFit(StarMatchList const &starMatchList, AstrometryTransform const &shiftToCenter,
379 bool useErrors);
380
381 std::size_t _order{}; // The highest sum of exponents of the largest monomial.
382 std::size_t _nterms{}; // number of parameters per coordinate
383 std::vector<double> _coeffs; // the actual coefficients
384 // both polynomials in a single vector to speed up allocation and copies
385
386 /* use std::vector rather than double * to avoid
387 writing copy constructor and "operator =".
388 Vect would work as well but introduces a dependence
389 that can be avoided */
390
391 /* This routine take a double * for the vector because the array can
392 then be allocated on the execution stack, which speeds thing
393 up. However this uses Variable Length Array (VLA) which is not
394 part of C++, but gcc implements it. */
395 void computeMonomials(double xIn, double yIn, double *monomial) const;
396
402 ndarray::Array<double, 2, 2> toAstPolyMapCoefficients() const;
403};
404
417 Frame const &domain,
418 double precision,
419 std::size_t maxOrder = 9,
420 std::size_t nSteps = 50);
421
422AstrometryTransformLinear normalizeCoordinatesTransform(const Frame &frame);
423
424/*=============================================================*/
427public:
428 using AstrometryTransformPolynomial::apply; // to unhide AstrometryTransform::apply(Point const &)
429
432
435
438
441
442 void print(std::ostream &out) const override;
443
444 // useful? double jacobian(const double x, const double y) const { return determinant();}
445
447 void computeDerivative(Point const &where, AstrometryTransformLinear &derivative,
448 double step = 0.01) const override;
451 double step = 0.01) const override;
452
453 // void print(std::ostream &out) const;
454
455 // double fit(StarMatchList const &starMatchList);
456
458 AstrometryTransformLinear(double ox, double oy, double aa11, double aa12,
459 double aa21, double aa22);
460
463
467
469 const Frame &region) const override;
470
471 double A11() const { return getCoefficient(1, 0, 0); }
472 double A12() const { return getCoefficient(0, 1, 0); }
473 double A21() const { return getCoefficient(1, 0, 1); }
474 double A22() const { return getCoefficient(0, 1, 1); }
475 double Dx() const { return getCoefficient(0, 0, 0); }
476 double Dy() const { return getCoefficient(0, 0, 1); }
477
478protected:
479 double &a11() { return getCoefficient(1, 0, 0); }
480 double &a12() { return getCoefficient(0, 1, 0); }
481 double &a21() { return getCoefficient(1, 0, 1); }
482 double &a22() { return getCoefficient(0, 1, 1); }
483 double &dx() { return getCoefficient(0, 0, 0); }
484 double &dy() { return getCoefficient(0, 0, 1); }
485
487 friend class AstrometryTransformIdentity; // for AstrometryTransform::Derivative
488 friend class AstrometryTransformPolynomial; // // for AstrometryTransform::Derivative
489
490private:
491 void setOrder(std::size_t order); // to hide AstrometryTransformPolynomial::setOrder
492};
493
494/*=============================================================*/
495
498public:
499 using AstrometryTransform::apply; // to unhide AstrometryTransform::apply(Point const &)
501 AstrometryTransformLinearShift(double ox = 0., double oy = 0.)
502 : AstrometryTransformLinear(ox, oy, 1., 0., 0., 1.) {}
504 : AstrometryTransformLinear(point.x, point.y, 1., 0., 0., 1.){};
505 double fit(StarMatchList const &starMatchList);
506
507 std::size_t getNpar() const { return 2; }
508};
509
510/*=============================================================*/
513public:
514 using AstrometryTransform::apply; // to unhide apply(const Point&)
515
517 AstrometryTransformLinearRot(double angleRad, const Point *center = nullptr,
518 double scaleFactor = 1.0);
519 double fit(StarMatchList const &starMatchList);
520
521 std::size_t getNpar() const { return 4; }
522};
523
524/*=============================================================*/
525
528public:
529 using AstrometryTransform::apply; // to unhide apply(const Point&)
531 AstrometryTransformLinearScale(const double scale = 1)
532 : AstrometryTransformLinear(0.0, 0.0, scale, 0., 0., scale){};
534 AstrometryTransformLinearScale(const double scaleX, const double scaleY)
535 : AstrometryTransformLinear(0.0, 0.0, scaleX, 0., 0., scaleY){};
536
537 std::size_t getNpar() const { return 2; }
538};
539
551public:
553
555
556 // Input is x, y pixels; output is ICRS RA, Dec in degrees
557 void apply(double xIn, double yIn, double &xOut, double &yOut) const override;
558
559 void print(std::ostream &out) const override;
560
562 double fit(const StarMatchList &starMatchList) override;
563
565
567
568private:
570};
571
572/*==================WCS's transform's =====================================*/
573
575public:
576 using AstrometryTransform::apply; // to unhide apply(const Point&)
577
578 BaseTanWcs(AstrometryTransformLinear const &pixToTan, Point const &tangentPoint,
579 const AstrometryTransformPolynomial *corrections = nullptr);
580
581 BaseTanWcs(const BaseTanWcs &original);
582
583 BaseTanWcs &operator=(const BaseTanWcs &original);
584
586 void apply(double xIn, double yIn, double &xOut, double &yOut) const;
587
589 Point getTangentPoint() const;
590
593
595 const AstrometryTransformPolynomial *getCorr() const { return corr.get(); }
596
599
601 Point getCrPix() const;
602
606
608 virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
609 double &yTangentPlane) const = 0;
610
612
613protected:
614 AstrometryTransformLinear linPixelToTan; // transform from pixels to tangent plane (degrees)
615 // a linear approximation centered at the pixel and sky origins
617 double ra0{}, dec0{}; // sky origin (radians)
618 double cos0{}, sin0{}; // cos(dec0), sin(dec0)
619};
620
621class TanRaDecToPixel; // the inverse of TanPixelToRaDec.
622
628public:
629 using AstrometryTransform::apply; // to unhide apply(const Point&)
632 TanPixelToRaDec(AstrometryTransformLinear const &pixToTan, Point const &tangentPoint,
633 const AstrometryTransformPolynomial *corrections = nullptr);
634
637
639 virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
640 double &yTangentPlane) const;
641
643
646
647 using AstrometryTransform::composeAndReduce; // to unhide
648 // AstrometryTransform::composeAndReduce(AstrometryTransform
649 // const &)
652
655
658
661 std::unique_ptr<AstrometryTransform> inverseTransform(double precision, const Frame &region) const;
662
664
665 void print(std::ostream &out) const;
666
668 double fit(StarMatchList const &starMatchList);
669};
670
673public:
676 TanSipPixelToRaDec(AstrometryTransformLinear const &pixToTan, Point const &tangentPoint,
677 const AstrometryTransformPolynomial *corrections = nullptr);
678
681
683 virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
684 double &yTangentPlane) const;
685
687
690 std::unique_ptr<AstrometryTransform> inverseTransform(double precision, const Frame &region) const;
691
693
694 void print(std::ostream &out) const;
695
697 double fit(StarMatchList const &starMatchList);
698};
699
701
708public:
709 using AstrometryTransform::apply; // to unhide apply(const Point&)
710
712 TanRaDecToPixel(AstrometryTransformLinear tan2Pix, Point const &tangentPoint);
713
716
719
721 void setTangentPoint(Point const &tangentPoint);
722
724 Point getTangentPoint() const;
725
727 void apply(double xIn, double yIn, double &xOut, double &yOut) const;
728
730 void transformPosAndErrors(const FatPoint &in, FatPoint &out) const;
731
734
737
739 std::unique_ptr<AstrometryTransform> inverseTransform(double precision, const Frame &region) const;
740
741 void print(std::ostream &out) const;
742
744
745 double fit(StarMatchList const &starMatchList);
746
747private:
748 double ra0{}, dec0{}; // tangent point (radians)
749 double cos0{}, sin0{};
750 AstrometryTransformLinear linTan2Pix; // tangent plane (probably degrees) to pixels
751};
752
754using AstrometryTransformFun = void (const double, const double, double &, double &, const void *);
755
761public:
762 using AstrometryTransform::apply; // to unhide apply(const Point&)
763
765 UserTransform(AstrometryTransformFun &fun, const void *userData);
766
767 void apply(double xIn, double yIn, double &xOut, double &yOut) const;
768
769 void print(std::ostream &out) const;
770
771 double fit(StarMatchList const &starMatchList);
772
774
775private:
776 AstrometryTransformFun *_userFun;
777 const void *_userData;
778};
779
784} // namespace jointcal
785} // namespace lsst
786
787#endif // LSST_JOINTCAL_ASTROMETRY_TRANSFORM_H
int const step
int y
Definition SpanSet.cc:48
table::Key< int > transform
a virtual (interface) class for geometric transformations.
virtual void paramDerivatives(Point const &where, double *dx, double *dy) const
Derivative w.r.t parameters.
virtual std::unique_ptr< AstrometryTransform > roughInverse(const Frame &region) const
Rough inverse.
virtual std::size_t getNpar() const
returns the number of parameters (to compute chi2's)
virtual double getJacobian(Point const &point) const
returns the local jacobian.
void write(const std::string &fileName) const
virtual AstrometryTransformLinear linearApproximation(Point const &where, double step=0.01) const
linear (local) approximation.
virtual double fit(StarMatchList const &starMatchList)=0
fits a transform to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
virtual double paramRef(Eigen::Index i) const
virtual void apply(double xIn, double yIn, double &xOut, double &yOut) const =0
void apply(Point const &in, Point &out) const
applies the tranfo to in and writes into out. Is indeed virtual.
virtual void computeDerivative(Point const &where, AstrometryTransformLinear &derivative, double step=0.01) const
Computes the local Derivative of a transform, w.r.t.
virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const
virtual std::unique_ptr< AstrometryTransform > composeAndReduce(AstrometryTransform const &right) const
Return a reduced composition of newTransform = this(right()), or nullptr if it cannot be reduced.
void offsetParams(Eigen::VectorXd const &delta)
virtual std::unique_ptr< AstrometryTransform > inverseTransform(double precision, const Frame &region) const
returns an inverse transform. Numerical if not overloaded.
virtual ~AstrometryTransform()=default
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.
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))
Point apply(Point const &in) const
All these apply(..) shadow the virtual one in derived classes, unless one writes "using AstrometryTra...
void getParams(double *params) const
params should be at least Npar() long
virtual std::unique_ptr< AstrometryTransform > clone() const =0
returns a copy (allocated by new) of the transformation.
virtual void print(std::ostream &out) const =0
prints the transform coefficients to stream.
A do-nothing transformation. It anyway has dummy routines to mimick a AstrometryTransform.
void print(std::ostream &out) const override
prints the transform coefficients to stream.
void computeDerivative(Point const &where, AstrometryTransformLinear &derivative, double step=0.01) const override
Computes the local Derivative of a transform, w.r.t.
void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override
xOut = xIn; yOut = yIn !
virtual AstrometryTransformLinear linearApproximation(Point const &where, double step=0.01) const override
linear approximation.
std::size_t getNpar() const override
returns the number of parameters (to compute chi2's)
AstrometryTransformIdentity()=default
constructor.
void write(std::ostream &s) const override
double fit(StarMatchList const &starMatchList) override
fits a transform to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
std::unique_ptr< AstrometryTransform > composeAndReduce(AstrometryTransform const &right) const override
Return a reduced composition of newTransform = this(right()), or nullptr if it cannot be reduced.
std::shared_ptr< ast::Mapping > toAstMap(jointcal::Frame const &domain) const override
Create an equivalent AST mapping for this transformation, including an analytic inverse if possible.
std::unique_ptr< AstrometryTransform > clone() const override
returns a copy (allocated by new) of the transformation.
implements the linear transformations (6 real coefficients).
void computeDerivative(Point const &where, AstrometryTransformLinear &derivative, double step=0.01) const override
Computes the local Derivative of a transform, w.r.t.
AstrometryTransformLinear(AstrometryTransformIdentity const &)
Handy converter:
AstrometryTransformLinear linearApproximation(Point const &where, double step=0.01) const override
linear (local) approximation.
void print(std::ostream &out) const override
prints the transform coefficients to stream.
std::unique_ptr< AstrometryTransform > clone() const override
returns a copy (allocated by new) of the transformation.
AstrometryTransformLinear operator*(AstrometryTransformLinear const &right) const
enables to combine linear tranformations: T1=T2*T3 is legal.
AstrometryTransformLinear inverted() const
returns the inverse: T1 = T2.inverted();
AstrometryTransformLinear()
the default constructor constructs the do-nothing transformation.
std::unique_ptr< AstrometryTransform > inverseTransform(double precision, const Frame &region) const override
returns an inverse transform. Numerical if not overloaded.
just here to provide a specialized constructor, and fit.
std::size_t getNpar() const
returns the number of parameters (to compute chi2's)
just here to provide specialized constructors. AstrometryTransformLinear fit routine.
std::size_t getNpar() const
returns the number of parameters (to compute chi2's)
AstrometryTransformLinearScale(const double scaleX, const double scaleY)
just here to provide a specialized constructor, and fit.
AstrometryTransformLinearShift(double ox=0., double oy=0.)
Add ox and oy.
std::size_t getNpar() const
returns the number of parameters (to compute chi2's)
double coeffOrZero(std::size_t powX, std::size_t powY, std::size_t whichCoord) const
read access, zero if beyond order
std::shared_ptr< ast::Mapping > toAstMap(jointcal::Frame const &domain) const override
Create an equivalent AST mapping for this transformation, including an analytic inverse if possible.
AstrometryTransformPolynomial operator-(AstrometryTransformPolynomial const &right) const
Subtraction.
AstrometryTransformPolynomial operator*(AstrometryTransformPolynomial const &right) const
Composition (internal stuff in quadruple precision)
double getCoefficient(std::size_t powX, std::size_t powY, std::size_t whichCoord) const
Get the coefficient of a given power in x and y, for either the x or y coordinate.
std::size_t getNpar() const override
total number of parameters
double paramRef(Eigen::Index i) const override
void setOrder(std::size_t order)
Sets the polynomial order (the highest sum of exponents of the largest monomial).
void print(std::ostream &out) const override
print out of coefficients in a readable form.
void paramDerivatives(Point const &where, double *dx, double *dy) const override
Derivative w.r.t parameters.
void write(std::ostream &s) const override
virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const override
a mix of apply and Derivative
std::size_t getOrder() const
Returns the polynomial order.
AstrometryTransformPolynomial(std::size_t order=1)
Default transform : identity for all orders (>=1 ).
std::unique_ptr< AstrometryTransform > clone() const override
returns a copy (allocated by new) of the transformation.
AstrometryTransformPolynomial operator+(AstrometryTransformPolynomial const &right) const
Addition.
void apply(double xIn, double yIn, double &xOut, double &yOut) const override
void computeDerivative(Point const &where, AstrometryTransformLinear &derivative, double step=0.01) const override
specialised analytic routine
std::unique_ptr< AstrometryTransform > composeAndReduce(AstrometryTransformPolynomial const &right) const
Return a reduced composition of newTransform = this(right()), or nullptr if it cannot be reduced.
A AstrometryTransform that holds a SkyWcs.
void print(std::ostream &out) const override
prints the transform coefficients to stream.
std::unique_ptr< AstrometryTransform > clone() const override
returns a copy (allocated by new) of the transformation.
std::shared_ptr< afw::geom::SkyWcs > getSkyWcs() const
void apply(double xIn, double yIn, double &xOut, double &yOut) const override
AstrometryTransformSkyWcs(std::shared_ptr< afw::geom::SkyWcs > skyWcs)
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.
Definition FatPoint.h:34
rectangle with sides parallel to axes.
Definition Frame.h:38
A point in a plane.
Definition Point.h:37
double x
coordinate
Definition Point.h:42
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;
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 &region) 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 &region) 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)
void setTangentPoint(Point const &tangentPoint)
Resets the projection (or tangent) point.
std::unique_ptr< AstrometryTransform > inverseTransform(double precision, const Frame &region) 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 &region) 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 &region) 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.
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)
A run-time transform that allows users to define a AstrometryTransform with minimal coding (just the ...
void print(std::ostream &out) const
prints the transform coefficients to stream.
std::unique_ptr< AstrometryTransform > clone() const
returns a copy (allocated by new) of the transformation.
UserTransform(AstrometryTransformFun &fun, const void *userData)
the transform routine and extra data that it may need.
void apply(double xIn, double yIn, double &xOut, double &yOut) const
Reports errors from accepting an object of an unexpected or inappropriate type.
Definition Runtime.h:167
T endl(T... args)
T forward(T... args)
T right(T... args)
Definition __init__.py:1
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.
basic_ostream< char, traits > & operator<<(basic_ostream< char, traits > &, const char *)
table::Key< int > order