LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
lsst::meas::astrom::SipReverseTransform Class Reference

A transform that maps intermediate world coordinates to pixel coordinates according to the SIP convention. More...

#include <SipTransform.h>

Inheritance diagram for lsst::meas::astrom::SipReverseTransform:
lsst::meas::astrom::SipTransformBase

Public Member Functions

 SipReverseTransform (geom::Point2D const &pixelOrigin, geom::LinearTransform const &cdMatrix, PolynomialTransform const &reverseSipPoly)
 Construct a SipReverseTransform from its components. More...
 
 SipReverseTransform (SipReverseTransform const &other)=default
 
 SipReverseTransform (SipReverseTransform &&other)=default
 
SipReverseTransformoperator= (SipReverseTransform const &other)=default
 
SipReverseTransformoperator= (SipReverseTransform &&other)=default
 
void swap (SipReverseTransform &other)
 
geom::AffineTransform linearize (geom::Point2D const &in) const
 Return an approximate affine transform at the given point. More...
 
geom::Point2D operator() (geom::Point2D const &xy) const
 Apply the transform to a point. More...
 
SipReverseTransform transformPixels (geom::AffineTransform const &s) const
 Return a new reverse SIP transform that includes a transformation of the pixel coordinate system by the given affine transform. More...
 
geom::Point2D const & getPixelOrigin () const
 Return the pixel origin (CRPIX, but zero-indexed) of the transform. More...
 
geom::LinearTransform const & getCdMatrix () const
 Return the CD matrix of the transform. More...
 
PolynomialTransform const & getPoly () const
 Return the polynomial component of the transform (A,B) or (AP,BP). More...
 

Static Public Member Functions

static SipReverseTransform convert (PolynomialTransform const &poly, geom::Point2D const &pixelOrigin, geom::LinearTransform const &cdMatrix)
 Convert a PolynomialTransform to an equivalent SipReverseTransform. More...
 
static SipReverseTransform convert (ScaledPolynomialTransform const &scaled, geom::Point2D const &pixelOrigin, geom::LinearTransform const &cdMatrix)
 Convert a ScaledPolynomialTransform to an equivalent SipReverseTransform. More...
 
static SipReverseTransform convert (ScaledPolynomialTransform const &scaled)
 Convert a ScaledPolynomialTransform to an equivalent SipReverseTransform. More...
 

Protected Member Functions

void swap (SipTransformBase &other)
 
void transformPixelsInPlace (geom::AffineTransform const &s)
 

Protected Attributes

geom::Point2D _pixelOrigin
 
geom::LinearTransform _cdMatrix
 
PolynomialTransform _poly
 

Friends

class PolynomialTransform
 
class ScaledPolynomialTransform
 

Detailed Description

A transform that maps intermediate world coordinates to pixel coordinates according to the SIP convention.

The SIP reverse transform is defined as

\[ \left[\begin{array}{ c } u \\ v \end{array}\right] = \left[\begin{array}{ c } u_0 + U + {\displaystyle\sum_{p,q}^{0 \le p + q \le N}} \mathrm{AP}_{p,q} U^p V^q \\ v_0 + V + {\displaystyle\sum_{p,q}^{0 \le p + q \le N}} \mathrm{BP}_{p,q} U^p V^q \\ \end{array}\right] \]

with

\[ \left[\begin{array}{ c } U \\ V \end{array}\right] = \mathbf{Z}^{-1} \left[\begin{array}{ c } x \\ y \end{array}\right] \]

and

SipForwardTransform instances should be confined to a single thread.

Definition at line 246 of file SipTransform.h.

Constructor & Destructor Documentation

◆ SipReverseTransform() [1/3]

lsst::meas::astrom::SipReverseTransform::SipReverseTransform ( geom::Point2D const &  pixelOrigin,
geom::LinearTransform const &  cdMatrix,
PolynomialTransform const &  reverseSipPoly 
)
inline

Construct a SipReverseTransform from its components.

Parameters
[in]pixelOriginCRPIX \((u_0,v_0)\) (zero-indexed)
[in]cdMatrixCD matrix \(Z\)
[in]reverseSipPolyPolynomial transform \((AP,BP)\)

Definition at line 285 of file SipTransform.h.

287  : SipTransformBase(pixelOrigin, cdMatrix, reverseSipPoly), _cdInverse(cdMatrix.inverted()) {}
SipTransformBase(geom::Point2D const &pixelOrigin, geom::LinearTransform const &cdMatrix, PolynomialTransform const &poly)
Construct a SipTransformBase from its components.
Definition: SipTransform.h:76

◆ SipReverseTransform() [2/3]

lsst::meas::astrom::SipReverseTransform::SipReverseTransform ( SipReverseTransform const &  other)
default

◆ SipReverseTransform() [3/3]

lsst::meas::astrom::SipReverseTransform::SipReverseTransform ( SipReverseTransform &&  other)
default

Member Function Documentation

◆ convert() [1/3]

SipReverseTransform lsst::meas::astrom::SipReverseTransform::convert ( PolynomialTransform const &  poly,
geom::Point2D const &  pixelOrigin,
geom::LinearTransform const &  cdMatrix 
)
static

Convert a PolynomialTransform to an equivalent SipReverseTransform.

Parameters
[in]polyPolynomialTransform to convert.
[in]pixelOriginCRPIX \((u_0,v_0)\) (zero-indexed)
[in]cdMatrixCD matrix \(Z\)

Definition at line 101 of file SipTransform.cc.

103  {
104  auto reverseSipPoly = compose(geom::AffineTransform(-geom::Extent2D(pixelOrigin)),
105  compose(poly, geom::AffineTransform(cdMatrix)));
106  // Account for the terms outside the sum in the definition (see comment
107  // earlier in the file for more explanation).
108  reverseSipPoly._xCoeffs(1, 0) -= 1;
109  reverseSipPoly._yCoeffs(0, 1) -= 1;
110  return SipReverseTransform(pixelOrigin, cdMatrix, reverseSipPoly);
111 }
An affine coordinate transformation consisting of a linear transformation and an offset.
SipReverseTransform(geom::Point2D const &pixelOrigin, geom::LinearTransform const &cdMatrix, PolynomialTransform const &reverseSipPoly)
Construct a SipReverseTransform from its components.
Definition: SipTransform.h:285
Low-level polynomials (including special polynomials) in C++.
Definition: Basis1d.h:26
PolynomialTransform compose(geom::AffineTransform const &t1, PolynomialTransform const &t2)
Return a PolynomialTransform that is equivalent to the composition t1(t2())

◆ convert() [2/3]

SipReverseTransform lsst::meas::astrom::SipReverseTransform::convert ( ScaledPolynomialTransform const &  scaled)
static

Convert a ScaledPolynomialTransform to an equivalent SipReverseTransform.

The pixel origin CRPIX and CD matrix are defined to reproduce the translation and linear transformation in the ScaledPolynomialTransforms output and input scalings (respectively).

Definition at line 126 of file SipTransform.cc.

126  {
127  return convert(scaled, geom::Point2D(scaled.getOutputScalingInverse().getTranslation()),
128  scaled.getInputScaling().getLinear());
129 }
static SipReverseTransform convert(PolynomialTransform const &poly, geom::Point2D const &pixelOrigin, geom::LinearTransform const &cdMatrix)
Convert a PolynomialTransform to an equivalent SipReverseTransform.

◆ convert() [3/3]

SipReverseTransform lsst::meas::astrom::SipReverseTransform::convert ( ScaledPolynomialTransform const &  scaled,
geom::Point2D const &  pixelOrigin,
geom::LinearTransform const &  cdMatrix 
)
static

Convert a ScaledPolynomialTransform to an equivalent SipReverseTransform.

Parameters
[in]scaledScaledPolynomialTransform to convert.
[in]pixelOriginCRPIX \((u_0,v_0)\) (zero-indexed)
[in]cdMatrixCD matrix \(Z\)

Definition at line 113 of file SipTransform.cc.

115  {
116  auto reverseSipPoly =
117  compose(geom::AffineTransform(-geom::Extent2D(pixelOrigin)) * scaled.getOutputScalingInverse(),
118  compose(scaled.getPoly(), scaled.getInputScaling() * geom::AffineTransform(cdMatrix)));
119  // Account for the terms outside the sum in the definition (see comment
120  // earlier in the file for more explanation).
121  reverseSipPoly._xCoeffs(1, 0) -= 1;
122  reverseSipPoly._yCoeffs(0, 1) -= 1;
123  return SipReverseTransform(pixelOrigin, cdMatrix, reverseSipPoly);
124 }

◆ getCdMatrix()

geom::LinearTransform const& lsst::meas::astrom::SipTransformBase::getCdMatrix ( ) const
inlineinherited

Return the CD matrix of the transform.

Definition at line 56 of file SipTransform.h.

56 { return _cdMatrix; }
geom::LinearTransform _cdMatrix
Definition: SipTransform.h:94

◆ getPixelOrigin()

geom::Point2D const& lsst::meas::astrom::SipTransformBase::getPixelOrigin ( ) const
inlineinherited

Return the pixel origin (CRPIX, but zero-indexed) of the transform.

Definition at line 51 of file SipTransform.h.

51 { return _pixelOrigin; }

◆ getPoly()

PolynomialTransform const& lsst::meas::astrom::SipTransformBase::getPoly ( ) const
inlineinherited

Return the polynomial component of the transform (A,B) or (AP,BP).

Definition at line 61 of file SipTransform.h.

61 { return _poly; }

◆ linearize()

geom::AffineTransform lsst::meas::astrom::SipReverseTransform::linearize ( geom::Point2D const &  in) const

Return an approximate affine transform at the given point.

Definition at line 138 of file SipTransform.cc.

138  {
140  (geom::AffineTransform() + _poly.linearize(_cdInverse(in))) * _cdInverse;
141 }
geom::AffineTransform linearize(geom::Point2D const &in) const
Return an approximate affine transform at the given point.
geom::Point2D const & getPixelOrigin() const
Return the pixel origin (CRPIX, but zero-indexed) of the transform.
Definition: SipTransform.h:51

◆ operator()()

geom::Point2D lsst::meas::astrom::SipReverseTransform::operator() ( geom::Point2D const &  xy) const

Apply the transform to a point.

Definition at line 143 of file SipTransform.cc.

143  {
144  geom::Point2D UV = _cdInverse(xy);
145  return geom::Extent2D(UV) + geom::Extent2D(getPixelOrigin()) + getPoly()(UV);
146 }
PolynomialTransform const & getPoly() const
Return the polynomial component of the transform (A,B) or (AP,BP).
Definition: SipTransform.h:61
Extent< double, 2 > Extent2D
Definition: Extent.h:400

◆ operator=() [1/2]

SipReverseTransform& lsst::meas::astrom::SipReverseTransform::operator= ( SipReverseTransform &&  other)
default

◆ operator=() [2/2]

SipReverseTransform& lsst::meas::astrom::SipReverseTransform::operator= ( SipReverseTransform const &  other)
default

◆ swap() [1/2]

void lsst::meas::astrom::SipReverseTransform::swap ( SipReverseTransform other)
inline

Definition at line 297 of file SipTransform.h.

297  {
298  SipTransformBase::swap(other);
299  std::swap(_cdInverse, other._cdInverse);
300  }
void swap(SipTransformBase &other)
Definition: SipTransform.h:85
T swap(T... args)

◆ swap() [2/2]

void lsst::meas::astrom::SipTransformBase::swap ( SipTransformBase other)
inlineprotectedinherited

Definition at line 85 of file SipTransform.h.

85  {
86  std::swap(_pixelOrigin, other._pixelOrigin);
87  std::swap(_cdMatrix, other._cdMatrix);
88  _poly.swap(other._poly);
89  }
void swap(PolynomialTransform &other)
Lightweight swap.

◆ transformPixels()

SipReverseTransform lsst::meas::astrom::SipReverseTransform::transformPixels ( geom::AffineTransform const &  s) const

Return a new reverse SIP transform that includes a transformation of the pixel coordinate system by the given affine transform.

Definition at line 131 of file SipTransform.cc.

131  {
133  result.transformPixelsInPlace(s);
134  result._cdInverse = result._cdMatrix.inverted();
135  return result;
136 }
py::object result
Definition: _schema.cc:429

◆ transformPixelsInPlace()

void lsst::meas::astrom::SipTransformBase::transformPixelsInPlace ( geom::AffineTransform const &  s)
protectedinherited

Definition at line 40 of file SipTransform.cc.

40  {
41  // The implementation for transformPixels is identical for
42  // SipForwardTransform and SipReverseTransform. That's pretty obvious for
43  // the pixel origin and CD matrix, which are the same in both cases, but
44  // it wasn't obvious to me until I did the math that the polynomial
45  // transforms are composed with the affine transform the same way.
46  auto sInv = s.inverted();
47  _pixelOrigin = s.getLinear()(_pixelOrigin - sInv.getTranslation());
48  _cdMatrix = _cdMatrix * sInv.getLinear();
49  _poly = compose(s.getLinear(), compose(getPoly(), sInv.getLinear()));
50 }

Friends And Related Function Documentation

◆ PolynomialTransform

friend class PolynomialTransform
friend

Definition at line 319 of file SipTransform.h.

◆ ScaledPolynomialTransform

friend class ScaledPolynomialTransform
friend

Definition at line 320 of file SipTransform.h.

Member Data Documentation

◆ _cdMatrix

geom::LinearTransform lsst::meas::astrom::SipTransformBase::_cdMatrix
protectedinherited

Definition at line 94 of file SipTransform.h.

◆ _pixelOrigin

geom::Point2D lsst::meas::astrom::SipTransformBase::_pixelOrigin
protectedinherited

Definition at line 93 of file SipTransform.h.

◆ _poly

PolynomialTransform lsst::meas::astrom::SipTransformBase::_poly
protectedinherited

Definition at line 95 of file SipTransform.h.


The documentation for this class was generated from the following files: