LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
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 <vector>
30 
31 #include "boost/shared_ptr.hpp"
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 #include "lsst/pex/logging/Log.h"
40 
41 namespace lsst {
42  namespace afw {
43  namespace image {
44  class Wcs;
45  class TanWcs;
46  }
47  }
48 
49 namespace meas {
50 namespace astrom {
51 namespace sip {
52 
53 
86 template<class MatchT>
88 public:
89 
90  typedef boost::shared_ptr<CreateWcsWithSip> Ptr;
91  typedef boost::shared_ptr<CreateWcsWithSip const> ConstPtr;
92 
108  std::vector<MatchT> const & matches,
109  afw::image::Wcs const & linearWcs,
110  int const order,
111  afw::geom::Box2I const& bbox = afw::geom::Box2I(),
112  int const ngrid=0
113  );
114 
116 
123  double getScatterInPixels() const;
124 
132 
139  double getLinearScatterInPixels() const;
140 
148 
150  int getOrder() const { return _sipA.rows(); }
152  int getNPoints() const { return _matches.size(); }
154  int getNGrid() const { return _ngrid; }
155 
156 private:
157 
159 
160  std::vector<MatchT> const _matches;
162  int _ngrid; // grid size to calculate inverse SIP coefficients (1-D)
164  // _sipOrder is polynomial order for forward transform.
165  // _reverseSipOrder is order for reverse transform, not necessarily the same.
167 
168  Eigen::MatrixXd _sipA, _sipB;
169  Eigen::MatrixXd _sipAp, _sipBp;
170 
171  PTR(afw::image::TanWcs) _newWcs;
172 
175 
176  afw::geom::Point2D _getCrvalAsGeomPoint() const;
177 };
178 
180 template<class MatchT>
182  std::vector<MatchT> const & matches,
183  afw::image::Wcs const& linearWcs,
184  int const order,
185  afw::geom::Box2I const& bbox = afw::geom::Box2I(),
186  int const ngrid=0
187 ) {
188  return CreateWcsWithSip<MatchT>(matches, linearWcs, order, bbox, ngrid);
189 }
190 
191 }}}}
192 
193 #endif
boost::shared_ptr< afw::image::TanWcs > _newWcs
A coordinate class intended to represent absolute positions.
afw::geom::Angle getScatterOnSky() const
#define PTR(...)
Definition: base.h:41
Point< double, 2 > Point2D
Definition: Point.h:286
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
a place to record messages and descriptions of the state of processing.
Definition: Log.h:154
An integer coordinate rectangle.
Definition: Box.h:53
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.
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
int getNPoints() const
Return the number of points in the catalogue.
afw::geom::Point2D _getCrvalAsGeomPoint() const
boost::shared_ptr< afw::image::Wcs const > _linearWcs
Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection...
Definition: TanWcs.h:68
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)
Constructor.
boost::shared_ptr< CreateWcsWithSip const > ConstPtr
afw::geom::Angle getLinearScatterOnSky() const
Measure the distortions in an image plane and express them a SIP polynomials.
#define CONST_PTR(...)
Definition: base.h:47
boost::shared_ptr< afw::image::TanWcs > getNewWcs()
int getNGrid() const
Return the number of grid points (on each axis) used in inverse SIP transform.
boost::shared_ptr< CreateWcsWithSip > Ptr
int getOrder() const
Return the number of terms in the SIP matrix.
std::vector< MatchT > const _matches