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
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
200std::ostream &operator<<(std::ostream &stream, AstrometryTransform const &transform);
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
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)
double fit(StarMatchList const &starMatchList)
fits a transform to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
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.
double fit(StarMatchList const &starMatchList)
fits a transform to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
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).
double fit(StarMatchList const &starMatchList) override
guess what
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
double fit(const StarMatchList &starMatchList) override
Not implemented; throws pex::exceptions::LogicError.
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;
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 &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)
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 &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.
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)
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.
double fit(StarMatchList const &starMatchList)
fits a transform to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
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)
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)
table::Key< int > order