LSSTApplications  16.0-10-g4f78f78+16,16.0-10-gc1446dd+42,16.0-11-g09ed895+1,16.0-13-g7649090,16.0-14-g0a28612+1,16.0-14-g6c7ed55+16,16.0-15-ga29f190+1,16.0-16-g89065d4+14,16.0-16-gd8e3590+16,16.0-16-ge6a35c8+6,16.0-17-g7e0e4ff+10,16.0-17-ga3d2e9f,16.0-19-gb830ed4e+16,16.0-2-g0febb12+21,16.0-2-g9d5294e+61,16.0-2-ga8830df+5,16.0-24-gc1c7f52+9,16.0-25-g07af9f2+1,16.0-3-ge00e371+21,16.0-36-g07840cb1,16.0-4-g18f3627+5,16.0-4-g5f3a788+20,16.0-4-ga3eb747+10,16.0-4-gabf74b7+16,16.0-4-gade8416+9,16.0-4-gb13d127+5,16.0-5-g6a53317+21,16.0-5-gb3f8a4b+74,16.0-5-gef99c9f+12,16.0-6-g9321be7+4,16.0-6-gcbc7b31+22,16.0-6-gf49912c+16,16.0-63-gae20905ba,16.0-7-gd2eeba5+31,16.0-8-g21fd5fe+16,16.0-8-g3a9f023+12,16.0-8-g4734f7a,16.0-9-g85d1a16+16,16.0-9-gf5c1f43,master-g07ce7b41a7,w.2018.48
LSSTDataManagementBasePackage
Gtransfo.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_GTRANSFO_H
26 #define LSST_JOINTCAL_GTRANSFO_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"
37 #include "lsst/afw/geom/SkyWcs.h"
38 #include "lsst/jointcal/FatPoint.h"
39 #include "lsst/jointcal/Frame.h"
40 
42 
43 namespace lsst {
44 namespace jointcal {
45 
46 class StarMatchList;
47 class Frame;
48 class GtransfoLin;
49 
51 
65 class Gtransfo {
66 public:
68  virtual void apply(const double xIn, const 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 dump(std::ostream &stream = std::cout) const = 0;
93 
96  dump(s);
97  return s.str();
98  }
99 
101 
105  virtual double fit(StarMatchList const &starMatchList) = 0;
106 
108  void transformStar(FatPoint &in) const { transformPosAndErrors(in, in); }
109 
111  virtual double getJacobian(Point const &point) const { return getJacobian(point.x, point.y); }
112 
114  virtual std::unique_ptr<Gtransfo> clone() const = 0;
115 
133 
135  virtual double getJacobian(const double x, const double y) const;
136 
142  virtual void computeDerivative(Point const &where, GtransfoLin &derivative,
143  const double step = 0.01) const;
144 
146  virtual GtransfoLin linearApproximation(Point const &where, const double step = 0.01) const;
147 
148  virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const;
149 
151  virtual void transformErrors(Point const &where, const double *vIn, double *vOut) const;
152 
154 
156  virtual std::unique_ptr<Gtransfo> inverseTransfo(const double precision, const Frame &region) const;
157 
159  void getParams(double *params) const;
160 
162  void offsetParams(Eigen::VectorXd const &delta);
163 
165  virtual double paramRef(const int i) const;
166 
168  virtual double &paramRef(const int i);
169 
172  virtual void paramDerivatives(Point const &where, double *dx, double *dy) const;
173 
175 
177  virtual std::unique_ptr<Gtransfo> roughInverse(const Frame &region) const;
178 
180  virtual int 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 ~Gtransfo(){};
198 };
199 
202 
215 
216 /*=============================================================*/
218 
219 class GtransfoIdentity : public Gtransfo {
220 public:
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 {
231  throw pexExcept::TypeError(
232  "GtransfoIdentity is the identity transformation: it cannot be fit to anything.");
233  }
234 
236  std::unique_ptr<Gtransfo> composeAndReduce(Gtransfo const &right) const override { return right.clone(); }
237 
238  void dump(std::ostream &stream = std::cout) const override { stream << "x' = x\ny' = y" << std::endl; }
239 
240  int getNpar() const override { return 0; }
241 
242  std::unique_ptr<Gtransfo> clone() const override {
244  }
245 
246  void computeDerivative(Point const &where, GtransfoLin &derivative,
247  const double step = 0.01) const override;
248 
250  virtual GtransfoLin linearApproximation(Point const &where, const double step = 0.01) const override;
251 
253  std::shared_ptr<ast::Mapping> toAstMap(jointcal::Frame const &domain) const override;
254 
255  void write(std::ostream &s) const override;
256 
257  void read(std::istream &s);
258 
259  // ClassDef(GtransfoIdentity,1)
260 };
261 
269 
271 bool isIntegerShift(const Gtransfo *gtransfo);
272 
273 /*==================== GtransfoPoly =======================*/
274 
276 class GtransfoPoly : public Gtransfo {
277 public:
283  GtransfoPoly(const unsigned order = 1);
284 
286  GtransfoPoly(const Gtransfo *gtransfo, const Frame &frame, unsigned order, unsigned nPoint = 1000);
287 
297  unsigned const order, unsigned const nSteps = 50);
298 
300  void setOrder(const unsigned order);
302  unsigned getOrder() const { return _order; }
303 
304  using Gtransfo::apply; // to unhide Gtransfo::apply(Point const &)
305 
306  void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override;
307 
309  void computeDerivative(Point const &where, GtransfoLin &derivative,
310  const double step = 0.01) const override;
311 
313  virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const override;
314 
316  int getNpar() const override { return 2 * _nterms; }
317 
319  void dump(std::ostream &stream = std::cout) const override;
320 
322  double fit(StarMatchList const &starMatchList) override;
323 
325  GtransfoPoly operator*(GtransfoPoly const &right) const;
326 
328  GtransfoPoly operator+(GtransfoPoly const &right) const;
329 
331  GtransfoPoly operator-(GtransfoPoly const &right) const;
332 
333  using Gtransfo::composeAndReduce; // to unhide Gtransfo::composeAndReduce(Gtransfo const &)
336 
337  std::unique_ptr<Gtransfo> clone() const override {
338  return std::unique_ptr<Gtransfo>(new GtransfoPoly(*this));
339  }
340 
342  double coeff(const unsigned powX, const unsigned powY, const unsigned whichCoord) const;
343 
345  double &coeff(const unsigned powX, const unsigned powY, const unsigned whichCoord);
346 
348  double coeffOrZero(const unsigned powX, const unsigned powY, const unsigned whichCoord) const;
349 
350  double determinant() const;
351 
353  double paramRef(const int i) const override;
354 
356  double &paramRef(const int i) override;
357 
360  void paramDerivatives(Point const &where, double *dx, double *dy) const override;
361 
363  std::shared_ptr<ast::Mapping> toAstMap(jointcal::Frame const &domain) const override;
364 
365  void write(std::ostream &s) const override;
366  void read(std::istream &s);
367 
368 private:
369  double computeFit(StarMatchList const &starMatchList, Gtransfo const &InTransfo, const bool UseErrors);
370 
371  unsigned _order; // The highest sum of exponents of the largest monomial.
372  unsigned _nterms; // number of parameters per coordinate
373  std::vector<double> _coeffs; // the actual coefficients
374  // both polynomials in a single vector to speed up allocation and copies
375 
376  /* use std::vector rather than double * to avoid
377  writing copy constructor and "operator =".
378  Vect would work as well but introduces a dependence
379  that can be avoided */
380 
381  /* This routine take a double * for the vector because the array can
382  then be allocated on the execution stack, which speeds thing
383  up. However this uses Variable Length Array (VLA) which is not
384  part of C++, but gcc implements it. */
385  void computeMonomials(double xIn, double yIn, double *monomial) const;
386 
392  ndarray::Array<double, 2, 2> toAstPolyMapCoefficients() const;
393 };
394 
407  double const precision, int const maxOrder = 9,
408  unsigned const nSteps = 50);
409 
411 
412 /*=============================================================*/
414 class GtransfoLin : public GtransfoPoly {
415 public:
416  using GtransfoPoly::apply; // to unhide Gtransfo::apply(Point const &)
417 
420 
422  explicit GtransfoLin(GtransfoPoly const &gtransfoPoly);
423 
425  GtransfoLin operator*(GtransfoLin const &right) const;
426 
428  GtransfoLin inverted() const;
429 
430  // useful? double jacobian(const double x, const double y) const { return determinant();}
431 
433  void computeDerivative(Point const &where, GtransfoLin &derivative, const double step = 0.01) const;
435  GtransfoLin linearApproximation(Point const &where, const double step = 0.01) const;
436 
437  // void dump(std::ostream &stream = std::cout) const;
438 
439  // double fit(StarMatchList const &starMatchList);
440 
442  GtransfoLin(const double ox, const double oy, const double aa11, const double aa12, const double aa21,
443  const double aa22);
444 
447 
449 
450  std::unique_ptr<Gtransfo> inverseTransfo(const double precision, const Frame &region) const;
451 
452  double A11() const { return coeff(1, 0, 0); }
453  double A12() const { return coeff(0, 1, 0); }
454  double A21() const { return coeff(1, 0, 1); }
455  double A22() const { return coeff(0, 1, 1); }
456  double Dx() const { return coeff(0, 0, 0); }
457  double Dy() const { return coeff(0, 0, 1); }
458 
459 protected:
460  double &a11() { return coeff(1, 0, 0); }
461  double &a12() { return coeff(0, 1, 0); }
462  double &a21() { return coeff(1, 0, 1); }
463  double &a22() { return coeff(0, 1, 1); }
464  double &dx() { return coeff(0, 0, 0); }
465  double &dy() { return coeff(0, 0, 1); }
466 
467  friend class Gtransfo;
468  friend class GtransfoIdentity; // for Gtransfo::Derivative
469  friend class GtransfoPoly; // // for Gtransfo::Derivative
470 
471 private:
472  void setOrder(const unsigned order); // to hide GtransfoPoly::setOrder
473 };
474 
475 /*=============================================================*/
476 
479 public:
480  using Gtransfo::apply; // to unhide Gtransfo::apply(Point const &)
482  GtransfoLinShift(double ox = 0., double oy = 0.) : GtransfoLin(ox, oy, 1., 0., 0., 1.) {}
483  GtransfoLinShift(Point const &point) : GtransfoLin(point.x, point.y, 1., 0., 0., 1.){};
484  double fit(StarMatchList const &starMatchList);
485 
486  int getNpar() const { return 2; }
487 };
488 
489 /*=============================================================*/
491 class GtransfoLinRot : public GtransfoLin {
492 public:
493  using Gtransfo::apply; // to unhide apply(const Point&)
494 
496  GtransfoLinRot(const double angleRad, const Point *center = nullptr, const double scaleFactor = 1.0);
497  double fit(StarMatchList const &starMatchList);
498 
499  int getNpar() const { return 4; }
500 };
501 
502 /*=============================================================*/
503 
506 public:
507  using Gtransfo::apply; // to unhide apply(const Point&)
509  GtransfoLinScale(const double scale = 1) : GtransfoLin(0.0, 0.0, scale, 0., 0., scale){};
511  GtransfoLinScale(const double scaleX, const double scaleY)
512  : GtransfoLin(0.0, 0.0, scaleX, 0., 0., scaleY){};
513 
514  int getNpar() const { return 2; }
515 };
516 
527 class GtransfoSkyWcs : public Gtransfo {
528 public:
530 
531  using Gtransfo::apply;
532 
533  // Input is x, y pixels; output is ICRS RA, Dec in degrees
534  void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override;
535 
536  void dump(std::ostream &stream = std::cout) const override;
537 
539  double fit(const StarMatchList &starMatchList) override;
540 
541  std::unique_ptr<Gtransfo> clone() const override;
542 
543  std::shared_ptr<afw::geom::SkyWcs> getSkyWcs() const { return _skyWcs; }
544 
545 private:
547 };
548 
549 /*==================WCS's transfo's =====================================*/
550 
551 class BaseTanWcs : public Gtransfo {
552 public:
553  using Gtransfo::apply; // to unhide apply(const Point&)
554 
555  BaseTanWcs(GtransfoLin const &pixToTan, Point const &tangentPoint,
556  const GtransfoPoly *corrections = nullptr);
557 
558  BaseTanWcs(const BaseTanWcs &original);
559 
560  void operator=(const BaseTanWcs &original);
561 
563  void apply(const double xIn, const double yIn, double &xOut, double &yOut) const;
564 
566  Point getTangentPoint() const;
567 
569  GtransfoLin getLinPart() const;
570 
572  const GtransfoPoly *getCorr() const { return corr.get(); }
573 
575  void setCorrections(std::unique_ptr<GtransfoPoly> corrections);
576 
578  Point getCrPix() const;
579 
582  virtual GtransfoPoly getPixelToTangentPlane() const = 0;
583 
585  virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
586  double &yTangentPlane) const = 0;
587 
588  ~BaseTanWcs();
589 
590 protected:
591  GtransfoLin linPixelToTan; // transform from pixels to tangent plane (degrees)
592  // a linear approximation centered at the pixel and sky origins
594  double ra0, dec0; // sky origin (radians)
595  double cos0, sin0; // cos(dec0), sin(dec0)
596 };
597 
598 class TanRaDecToPixel; // the inverse of TanPixelToRaDec.
599 
601 class TanPixelToRaDec : public BaseTanWcs {
602 public:
603  using Gtransfo::apply; // to unhide apply(const Point&)
606  TanPixelToRaDec(GtransfoLin const &pixToTan, Point const &tangentPoint,
607  const GtransfoPoly *corrections = nullptr);
608 
610  GtransfoPoly getPixelToTangentPlane() const;
611 
613  virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
614  double &yTangentPlane) const;
615 
616  TanPixelToRaDec();
617 
619  TanPixelToRaDec operator*(GtransfoLin const &right) const;
620 
621  using Gtransfo::composeAndReduce; // to unhide Gtransfo::composeAndReduce(Gtransfo const &)
624 
626  TanRaDecToPixel inverted() const;
627 
630 
633  std::unique_ptr<Gtransfo> inverseTransfo(const double precision, const Frame &region) const;
634 
636 
637  void dump(std::ostream &stream) const;
638 
640  double fit(StarMatchList const &starMatchList);
641 };
642 
645 public:
648  TanSipPixelToRaDec(GtransfoLin const &pixToTan, Point const &tangentPoint,
649  const GtransfoPoly *corrections = nullptr);
650 
652  GtransfoPoly getPixelToTangentPlane() const;
653 
655  virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
656  double &yTangentPlane) const;
657 
659 
662  std::unique_ptr<Gtransfo> inverseTransfo(const double precision, const Frame &region) const;
663 
665 
666  void dump(std::ostream &stream) const;
667 
669  double fit(StarMatchList const &starMatchList);
670 };
671 
673 
679 class TanRaDecToPixel : public Gtransfo {
680 public:
681  using Gtransfo::apply; // to unhide apply(const Point&)
682 
684  TanRaDecToPixel(GtransfoLin const &tan2Pix, Point const &tangentPoint);
685 
687  TanRaDecToPixel();
688 
690  GtransfoLin getLinPart() const;
691 
693  void setTangentPoint(Point const &tangentPoint);
694 
696  Point getTangentPoint() const;
697 
699  void apply(const double xIn, const double yIn, double &xOut, double &yOut) const;
700 
702  void transformPosAndErrors(const FatPoint &in, FatPoint &out) const;
703 
705  TanPixelToRaDec inverted() const;
706 
709 
711  std::unique_ptr<Gtransfo> inverseTransfo(const double precision, const Frame &region) const;
712 
713  void dump(std::ostream &stream) const;
714 
716 
717  double fit(StarMatchList const &starMatchList);
718 
719 private:
720  double ra0, dec0; // tangent point (radians)
721  double cos0, sin0;
722  GtransfoLin linTan2Pix; // tangent plane (probably degrees) to pixels
723 };
724 
726 typedef void(GtransfoFun)(const double, const double, double &, double &, const void *);
727 
729 class UserTransfo : public Gtransfo {
730 public:
731  using Gtransfo::apply; // to unhide apply(const Point&)
732 
734  UserTransfo(GtransfoFun &fun, const void *userData);
735 
736  void apply(const double xIn, const double yIn, double &xOut, double &yOut) const;
737 
738  void dump(std::ostream &stream = std::cout) const;
739 
740  double fit(StarMatchList const &starMatchList);
741 
743 
744 private:
745  GtransfoFun *_userFun;
746  const void *_userData;
747 };
748 
753 } // namespace jointcal
754 } // namespace lsst
755 
756 #endif // LSST_JOINTCAL_GTRANSFO_H
virtual std::unique_ptr< Gtransfo > roughInverse(const Frame &region) const
Rough inverse.
Definition: Gtransfo.cc:190
implements the linear transformations (6 real coefficients).
Definition: Gtransfo.h:414
the transformation that handles pix to sideral transfos (Gnomonic, possibly with polynomial distortio...
Definition: Gtransfo.h:601
A Gtransfo that holds a SkyWcs.
Definition: Gtransfo.h:527
void getParams(double *params) const
params should be at least Npar() long
Definition: Gtransfo.cc:210
GtransfoLin(GtransfoIdentity const &)
Handy converter:
Definition: Gtransfo.h:446
virtual void computeDerivative(Point const &where, GtransfoLin &derivative, const double step=0.01) const
Computes the local Derivative of a transfo, w.r.t.
Definition: Gtransfo.cc:116
std::ostream & operator<<(std::ostream &out, CcdImageKey const &key)
Definition: CcdImage.cc:52
void transformStar(FatPoint &in) const
allows to write MyTransfo(MyStar)
Definition: Gtransfo.h:108
virtual double getJacobian(Point const &point) const
returns the local jacobian.
Definition: Gtransfo.h:111
A point in a plane.
Definition: Point.h:36
void apply(Point const &in, Point &out) const
applies the tranfo to in and writes into out. Is indeed virtual.
Definition: Gtransfo.h:71
void offsetParams(Eigen::VectorXd const &delta)
Definition: Gtransfo.cc:215
void() GtransfoFun(const double, const double, double &, double &, const void *)
signature of the user-provided routine that actually does the coordinate transfo for UserTransfo...
Definition: Gtransfo.h:726
GtransfoLinShift(double ox=0., double oy=0.)
Add ox and oy.
Definition: Gtransfo.h:482
std::unique_ptr< Gtransfo > clone() const override
returns a copy (allocated by new) of the transformation.
Definition: Gtransfo.h:242
virtual int getNpar() const
returns the number of parameters (to compute chi2&#39;s)
Definition: Gtransfo.h:180
GtransfoLinScale(const double scale=1)
Definition: Gtransfo.h:509
void dump(std::ostream &stream=std::cout) const override
dumps the transfo coefficients to stream.
Definition: Gtransfo.h:238
def scale(algorithm, min, max=None, frame=None)
Definition: ds9.py:114
T endl(T... args)
std::shared_ptr< Image< PixelT > > operator+(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator+()
Definition: ImageSlice.cc:69
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))
Definition: Gtransfo.cc:157
T right(T... args)
int y
Definition: SpanSet.cc:49
Implements the (forward) SIP distorsion scheme.
Definition: Gtransfo.h:644
Point apply(Point const &in) const
All these apply(..) shadow the virtual one in derived classes, unless one writes "using Gtransfo::app...
Definition: Gtransfo.h:75
void write(const std::string &fileName) const
Definition: Gtransfo.cc:239
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
Definition: Gtransfo.h:591
Polynomial transformation class.
Definition: Gtransfo.h:276
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.
Definition: Gtransfo.cc:1096
GtransfoLin normalizeCoordinatesTransfo(const Frame &frame)
Returns the transformation that maps the input frame along both axes to [-1,1].
Definition: Gtransfo.cc:788
STL class.
A Point with uncertainties.
Definition: FatPoint.h:34
STL class.
double x
coordinate
Definition: Point.h:41
GtransfoLin()
the default constructor constructs the do-nothing transformation.
Definition: Gtransfo.h:419
bool isIntegerShift(const Gtransfo *gtransfo)
Shorthand test to tell if a transfo is a simple integer shift.
Definition: Gtransfo.cc:55
std::unique_ptr< Gtransfo > clone() const
returns a copy (allocated by new) of the transformation.
Definition: Gtransfo.h:448
just here to provide a specialized constructor, and fit.
Definition: Gtransfo.h:491
GtransfoLinScale(const double scaleX, const double scaleY)
Definition: Gtransfo.h:511
rectangle with sides parallel to axes.
Definition: Frame.h:38
A base class for image defects.
Definition: cameraGeom.dox:3
int const step
int getNpar() const
total number of parameters
Definition: Gtransfo.h:486
int getNpar() const override
returns the number of parameters (to compute chi2&#39;s)
Definition: Gtransfo.h:240
GtransfoIdentity()
constructor.
Definition: Gtransfo.h:222
std::shared_ptr< afw::geom::SkyWcs > getSkyWcs() const
Definition: Gtransfo.h:543
T str(T... args)
std::string __str__()
Definition: Gtransfo.h:94
This one is the Tangent Plane (called gnomonic) projection (from celestial sphere to tangent plane) ...
Definition: Gtransfo.h:679
GtransfoLinShift(Point const &point)
Definition: Gtransfo.h:483
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...
Definition: Gtransfo.cc:92
virtual double paramRef(const int i) const
Definition: Gtransfo.cc:220
virtual void transformPosAndErrors(const FatPoint &in, FatPoint &out) const
Definition: Gtransfo.cc:140
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...
Definition: Gtransfo.h:189
const GtransfoPoly * getCorr() const
Get a non-owning pointer to the correction transform polynomial.
Definition: Gtransfo.h:572
solver_t * s
double x
unsigned getOrder() const
Returns the polynomial order.
Definition: Gtransfo.h:302
std::shared_ptr< Image< PixelT > > operator-(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator-()
Definition: ImageSlice.cc:89
A do-nothing transformation. It anyway has dummy routines to mimick a Gtransfo.
Definition: Gtransfo.h:219
table::Key< table::Array< double > > coeff
Definition: PsfexPsf.cc:362
just here to provide a specialized constructor, and fit.
Definition: Gtransfo.h:478
void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override
xOut = xIn; yOut = yIn !
Definition: Gtransfo.h:225
STL class.
STL class.
just here to provide specialized constructors. GtransfoLin fit routine.
Definition: Gtransfo.h:505
a virtual (interface) class for geometric transformations.
Definition: Gtransfo.h:65
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...
Definition: Gtransfo.h:236
std::unique_ptr< GtransfoPoly > corr
Definition: Gtransfo.h:593
virtual void paramDerivatives(Point const &where, double *dx, double *dy) const
Derivative w.r.t parameters.
Definition: Gtransfo.cc:229
std::unique_ptr< Gtransfo > clone() const override
returns a copy (allocated by new) of the transformation.
Definition: Gtransfo.h:337
double fit(StarMatchList const &starMatchList) override
fits a transfo to a std::list of Point pairs (p1,p2, the Point fields in StarMatch).
Definition: Gtransfo.h:230
a run-time transfo that allows users to define a Gtransfo with minimal coding (just the transfo routi...
Definition: Gtransfo.h:729
Reports errors from accepting an object of an unexpected or inappropriate type.
Definition: Runtime.h:167
std::unique_ptr< Gtransfo > gtransfoRead(const std::string &fileName)
The virtual constructor from a file.
Definition: Gtransfo.cc:1722
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
Definition: Gtransfo.h:499
void apply(const double xIn, const double yIn, double &xOut, double &yOut) const override
Definition: Gtransfo.cc:546
STL class.
int getNpar() const
total number of parameters
Definition: Gtransfo.h:514
T forward(T... args)
virtual GtransfoLin linearApproximation(Point const &where, const double step=0.01) const
linear (local) approximation.
Definition: Gtransfo.cc:133
int getNpar() const override
total number of parameters
Definition: Gtransfo.h:316
virtual std::unique_ptr< Gtransfo > inverseTransfo(const double precision, const Frame &region) const
returns an inverse transfo. Numerical if not overloaded.
Definition: Gtransfo.cc:292
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()).
Definition: Gtransfo.cc:408