lsst.meas.astrom  14.0-7-g0d69b06+3
CreateWcsWithSip.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 
26 #ifndef CREATE_WCS_WITH_SIP
27 #define CREATE_WCS_WITH_SIP
28 
29 #include <memory>
30 #include <vector>
31 
32 #include "lsst/base.h"
33 #include "Eigen/Core"
34 
35 #include "lsst/afw/table/Match.h"
36 #include "lsst/afw/geom/Box.h"
37 #include "lsst/afw/geom/Point.h"
38 #include "lsst/afw/geom/Angle.h"
39 
40 namespace lsst {
41 namespace meas {
42 namespace astrom {
43 namespace sip {
44 
45 
78 template<class MatchT>
80 public:
81 
84 
100  std::vector<MatchT> const & matches,
101  afw::geom::SkyWcs const & linearWcs,
102  int const order,
103  afw::geom::Box2I const& bbox = afw::geom::Box2I(),
104  int const ngrid=0
105  );
106 
108 
115  double getScatterInPixels() const;
116 
124 
131  double getLinearScatterInPixels() const;
132 
140 
142  int getOrder() const { return _sipA.rows(); }
144  int getNPoints() const { return _matches.size(); }
146  int getNGrid() const { return _ngrid; }
147 
148  // Return the SIP A matrix
149  Eigen::MatrixXd const getSipA() { return _sipA; }
150  // Return the SIP B matrix
151  Eigen::MatrixXd const getSipB() { return _sipB; }
152  // Return the SIP Ap matrix
153  Eigen::MatrixXd const getSipAp() { return _sipAp; }
154  // Return the SIP Bp matrix
155  Eigen::MatrixXd const getSipBp() { return _sipBp; }
156 
157 private:
158 
159  std::vector<MatchT> const _matches;
160  afw::geom::Box2I mutable _bbox;
161  int _ngrid; // grid size to calculate inverse SIP coefficients (1-D)
163  // _sipOrder is polynomial order for forward transform.
164  // _reverseSipOrder is order for reverse transform, not necessarily the same.
165  int const _sipOrder, _reverseSipOrder;
166 
167  Eigen::MatrixXd _sipA, _sipB;
168  Eigen::MatrixXd _sipAp, _sipBp;
169 
171 
172  void _calculateForwardMatrices();
173  void _calculateReverseMatrices();
174 };
175 
177 template<class MatchT>
179  std::vector<MatchT> const & matches,
180  afw::geom::SkyWcs const& linearWcs,
181  int const order,
182  afw::geom::Box2I const& bbox = afw::geom::Box2I(),
183  int const ngrid=0
184 ) {
185  return CreateWcsWithSip<MatchT>(matches, linearWcs, order, bbox, ngrid);
186 }
187 
188 }}}}
189 
190 #endif
int getOrder() const
Return the number of terms in the SIP matrix.
double getScatterInPixels() const
Compute the median separation, in pixels, between items in this object&#39;s match list.
CreateWcsWithSip(std::vector< MatchT > const &matches, afw::geom::SkyWcs const &linearWcs, int const order, afw::geom::Box2I const &bbox=afw::geom::Box2I(), int const ngrid=0)
Construct a CreateWcsWithSip.
CreateWcsWithSip< MatchT > makeCreateWcsWithSip(std::vector< MatchT > const &matches, afw::geom::SkyWcs const &linearWcs, int const order, afw::geom::Box2I const &bbox=afw::geom::Box2I(), int const ngrid=0)
Factory function for CreateWcsWithSip.
int getNPoints() const
Return the number of points in the catalogue.
std::shared_ptr< CreateWcsWithSip > Ptr
afw::geom::Angle getScatterOnSky() const
Compute the median on-sky separation between items in this object&#39;s match list.
std::shared_ptr< afw::geom::SkyWcs > getNewWcs()
T size(T... args)
std::shared_ptr< CreateWcsWithSip const > ConstPtr
afw::geom::Angle getLinearScatterOnSky() const
Compute the median on-sky separation between items in this object&#39;s match list,.
Measure the distortions in an image plane and express them a SIP polynomials.
table::Box2IKey bbox
int getNGrid() const
Return the number of grid points (on each axis) used in inverse SIP transform.
double getLinearScatterInPixels() const
Compute the median radial separation between items in this object&#39;s match list.