LSST Applications 30.0.7,g0e76e35be5+e8e946ae08,g19811a7679+138f7293ba,g199a45376c+5e234f8357,g1fd858c14a+2f48dbc4c4,g262e1987ae+fb36cac54d,g29ae962dfc+d9108a0941,g2c21b0017a+4f59a27f16,g31e44d4a5c+b0138be388,g33ac35c1f1+28b9f72785,g35bb328faa+b0138be388,g40c9b15c53+823ad735c1,g47891489e3+bcc48a0b46,g53246c7159+b0138be388,g64539dfbff+e8e946ae08,g67b6fd64d1+bcc48a0b46,g74acd417e5+422380537a,g76965917b2+a5ca99c4d9,g786e29fd12+796b79145d,g7aefaa3e3d+dc0c200193,g86b635cae8+734fe384f0,g87389fa792+d8b5378923,g89139ef638+bcc48a0b46,g8bbb235e95+3f4f7f9447,g8ea07a8fe4+78a4c88802,g9290983e33+ffdc83c6f7,g92c671f44c+e8e946ae08,gaa753fd333+03f406da14,gbf99507273+b0138be388,gc49b57b85e+8df26ee1f0,gca7fc764a6+bcc48a0b46,gd7ef33dd92+bcc48a0b46,gdab6d2f7ff+422380537a,ge1c02a5578+b0138be388,ge410e46f29+bcc48a0b46,ge80df9fc40+e6db5413d1,geaed405ab2+1de65a85c6,gf5dcc679e7+35a0ce2edd,gf5f1c85443+e8e946ae08
LSST Data Management Base Package
Loading...
Searching...
No Matches
SipApproximation.h
Go to the documentation of this file.
1// -*- lsst-c++ -*-
2/*
3 * Developed for the LSST Data Management System.
4 * This product includes software developed by the LSST Project
5 * (https://www.lsst.org).
6 * See the COPYRIGHT file at the top-level directory of this distribution
7 * for details of code ownership.
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef LSST_AFW_GEOM_SipApproximation_h_INCLUDED
24#define LSST_AFW_GEOM_SipApproximation_h_INCLUDED
25
26#include <memory>
27#include <optional>
28#include <vector>
29
30#include "Eigen/Core"
31
33#include "lsst/geom/Box.h"
35
36namespace lsst { namespace afw { namespace geom {
37
89class SipApproximation final {
90public:
91
117 SkyWcs const & target,
118 lsst::geom::Box2D const & bbox,
119 lsst::geom::Extent2I const & gridShape,
120 int order = 5,
121 std::optional<lsst::geom::Point2D> const & pixelOrigin = std::nullopt,
122 double svdThreshold=-1
123 );
124
125 // No copies just because they'd be a pain to implement and probably aren't necessary
128
129 // Moves are fine.
130 SipApproximation(SipApproximation &&) noexcept = default;
131 SipApproximation & operator=(SipApproximation &&) noexcept = default;
132
133 // Needs to be defined in .cc, where compiler can see the definitions of forward-declared
134 // private implementation classes.
135 ~SipApproximation() noexcept;
136
138 int getOrder() const noexcept;
139
147 double getA(int p, int q) const;
148
156 double getB(int p, int q) const;
157
159 Eigen::MatrixXd getA() const;
160
162 Eigen::MatrixXd getB() const;
163
165 lsst::geom::Box2D getBBox() const noexcept { return _bbox; }
166
168 lsst::geom::SpherePoint getSkyOrigin() const noexcept { return _skyOrigin; }
169
171 lsst::geom::Point2D getPixelOrigin() const noexcept { return lsst::geom::Point2D(_pixelOrigin); }
172
174 Eigen::Matrix2d getCdMatrix() const noexcept;
175
177 std::shared_ptr<SkyWcs> getWcs() const noexcept;
178
190 std::pair<lsst::geom::Angle, double> computeDeltas() const;
191
192private:
193
194 struct FitGrid;
195 struct ValidationGrid;
196 struct Solution;
197
198 lsst::geom::Box2D _bbox;
199 lsst::geom::Point2D _pixelOrigin;
200 lsst::geom::SpherePoint _skyOrigin;
201 std::unique_ptr<FitGrid const> _fitGrid;
202 std::unique_ptr<ValidationGrid const> _validationGrid;
203 std::unique_ptr<Solution const> _solution;
204 std::shared_ptr<SkyWcs> _wcs;
205};
206
207}}} // namespace lsst::afw::geom
208
209#endif // !LSST_AFW_GEOM_SipApproximation_h_INCLUDED
lsst::geom::Box2D getBBox() const noexcept
Return the pixel-coordinate bounding box over which the approximation should be valid.
SipApproximation(SkyWcs const &target, lsst::geom::Box2D const &bbox, lsst::geom::Extent2I const &gridShape, int order=5, std::optional< lsst::geom::Point2D > const &pixelOrigin=std::nullopt, double svdThreshold=-1)
Construct a new approximation by fitting on a grid of points.
lsst::geom::SpherePoint getSkyOrigin() const noexcept
Return the sky-coordinate origin of the WCS.
SipApproximation(SipApproximation const &)=delete
std::shared_ptr< SkyWcs > getWcs() const noexcept
Return a TAN-SIP WCS object that evaluates the approximation.
SipApproximation(SipApproximation &&) noexcept=default
double getB(int p, int q) const
Return a coefficient of the forward transform polynomial.
int getOrder() const noexcept
Return the polynomial order of the current solution (same for forward and reverse).
Eigen::Matrix2d getCdMatrix() const noexcept
Return the CD matrix of the WCS (in degrees).
double getA(int p, int q) const
Return a coefficient of the forward transform polynomial.
SipApproximation & operator=(SipApproximation const &)=delete
std::pair< lsst::geom::Angle, double > computeDeltas() const
Return the maximum deviations of the solution from the exact transform on a grid offset from the one ...
lsst::geom::Point2D getPixelOrigin() const noexcept
Return the pixel origin of the WCS.
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition SkyWcs.h:119
A floating-point coordinate rectangle geometry.
Definition Box.h:413
Point in an unspecified spherical coordinate system.
Definition SpherePoint.h:57
Point< double, 2 > Point2D
Definition Point.h:324
Extent< int, 2 > Extent2I
Definition Extent.h:397
STL namespace.