lsst.meas.astrom  13.0-14-g9415442+1
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
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 afw {
42  namespace image {
43  class Wcs;
44  class TanWcs;
45  }
46  }
47 
48 namespace meas {
49 namespace astrom {
50 namespace sip {
51 
52 
85 template<class MatchT>
87 public:
88 
89  typedef std::shared_ptr<CreateWcsWithSip> Ptr;
90  typedef std::shared_ptr<CreateWcsWithSip const> ConstPtr;
91 
107  std::vector<MatchT> const & matches,
108  afw::image::Wcs const & linearWcs,
109  int const order,
110  afw::geom::Box2I const& bbox = afw::geom::Box2I(),
111  int const ngrid=0
112  );
113 
114  PTR(afw::image::TanWcs) getNewWcs() { return _newWcs; }
115 
122  double getScatterInPixels() const;
123 
130  afw::geom::Angle getScatterOnSky() const;
131 
138  double getLinearScatterInPixels() const;
139 
146  afw::geom::Angle getLinearScatterOnSky() const;
147 
149  int getOrder() const { return _sipA.rows(); }
151  int getNPoints() const { return _matches.size(); }
153  int getNGrid() const { return _ngrid; }
154 
155 private:
156 
157  std::vector<MatchT> const _matches;
158  afw::geom::Box2I mutable _bbox;
159  int _ngrid; // grid size to calculate inverse SIP coefficients (1-D)
160  CONST_PTR(afw::image::Wcs) _linearWcs;
161  // _sipOrder is polynomial order for forward transform.
162  // _reverseSipOrder is order for reverse transform, not necessarily the same.
163  int const _sipOrder, _reverseSipOrder;
164 
165  Eigen::MatrixXd _sipA, _sipB;
166  Eigen::MatrixXd _sipAp, _sipBp;
167 
168  PTR(afw::image::TanWcs) _newWcs;
169 
170  void _calculateForwardMatrices();
171  void _calculateReverseMatrices();
172 
173  afw::geom::Point2D _getCrvalAsGeomPoint() const;
174 };
175 
177 template<class MatchT>
179  std::vector<MatchT> const & matches,
180  afw::image::Wcs 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.
int getNPoints() const
Return the number of points in the catalogue.
double getScatterInPixels() const
Compute the median separation, in pixels, between items in this object&#39;s match list.
int getNGrid() const
Return the number of grid points (on each axis) used in inverse SIP transform.
CreateWcsWithSip< MatchT > makeCreateWcsWithSip(std::vector< MatchT > const &matches, afw::image::Wcs const &linearWcs, int const order, afw::geom::Box2I const &bbox=afw::geom::Box2I(), int const ngrid=0)
Factory function for CreateWcsWithSip.
std::shared_ptr< CreateWcsWithSip > Ptr
CreateWcsWithSip(std::vector< MatchT > const &matches, afw::image::Wcs const &linearWcs, int const order, afw::geom::Box2I const &bbox=afw::geom::Box2I(), int const ngrid=0)
Construct a CreateWcsWithSip.
double getLinearScatterInPixels() const
Compute the median radial separation between items in this object&#39;s match list.
afw::geom::Angle getLinearScatterOnSky() const
Compute the median on-sky separation between items in this object&#39;s match list,.
boost::shared_ptr< afw::image::TanWcs > getNewWcs()
std::shared_ptr< CreateWcsWithSip const > ConstPtr
Measure the distortions in an image plane and express them a SIP polynomials.
afw::geom::Angle getScatterOnSky() const
Compute the median on-sky separation between items in this object&#39;s match list.