lsst.afw  13.0-57-g42cae95
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SkyWcs.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * See COPYRIGHT file at the top of the source tree.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
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 LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_AFW_GEOM_SKYWCS_H
25 #define LSST_AFW_GEOM_SKYWCS_H
26 
27 #include <memory>
28 #include <utility>
29 #include <vector>
30 
31 #include "Eigen/Core"
32 #include "astshim.h"
33 #include "ndarray.h"
34 
35 #include "lsst/afw/geom/Angle.h"
36 #include "lsst/afw/geom/Point.h"
38 #include "lsst/afw/geom/Endpoint.h"
40 #include "lsst/daf/base/PropertyList.h"
41 
42 namespace lsst {
43 namespace afw {
44 namespace geom {
45 
59 Eigen::Matrix2d makeCdMatrix(Angle const &scale, Angle const &orientation = 0 * degrees, bool flipX = false);
60 
97 class SkyWcs : public Transform<Point2Endpoint, SpherePointEndpoint> {
98 public:
99  SkyWcs(SkyWcs const &) = default;
100  SkyWcs(SkyWcs &&) = default;
101  SkyWcs &operator=(SkyWcs const &) = delete;
102  SkyWcs &operator=(SkyWcs &&) = delete;
103 
113  explicit SkyWcs(Point2D const &crpix, SpherePoint const &crval, Eigen::Matrix2d const &cdMatrix);
114 
126  explicit SkyWcs(daf::base::PropertyList &metadata, bool strip = true);
127 
137  explicit SkyWcs(ast::FrameSet const &frameSet);
138 
139  ~SkyWcs(){};
140 
146  Angle getPixelScale(Point2D const &pixel) const;
147 
153  Angle getPixelScale() const;
154 
158  Point2D getPixelOrigin() const;
159 
163  SpherePoint getSkyOrigin() const;
164 
168  Eigen::Matrix2d getCdMatrix(Point2D const &pixel) const;
169 
173  Eigen::Matrix2d getCdMatrix() const;
174 
178  SkyWcs getTanWcs(Point2D const &pixel) const;
179 
183  SkyWcs copyAtShiftedPixelOrigin(Extent2D const &shift) const;
184 
191  std::pair<Angle, Angle> pixelToSky(double x, double y) const;
192  SpherePoint pixelToSky(Point2D const &pixel) const { return tranForward(pixel); };
193  std::vector<SpherePoint> pixelToSky(std::vector<Point2D> const &pixels) const {
194  return tranForward(pixels);
195  }
197 
204  std::pair<double, double> skyToPixel(Angle const &ra, Angle const &dec) const;
205  Point2D skyToPixel(SpherePoint const &sky) const { return tranInverse(sky); }
206  std::vector<Point2D> skyToPixel(std::vector<SpherePoint> const &sky) const { return tranInverse(sky); }
208 
209 private:
210  // Construct a SkyWcs from a shared pointer to an ast::FrameSet
211  explicit SkyWcs(std::shared_ptr<ast::FrameSet> &&frameSet);
212 
213  // Check a FrameSet to see if it can safely be used for a SkyWcs
214  // Return a copy so that it can be used as an argument to the SkyWcs(shared_ptr<FrameSet>) constructor
215  std::shared_ptr<ast::FrameSet> _checkFrameSet(ast::FrameSet const &frameSet) const;
216 };
217 
218 } // namespace geom
219 } // namespace afw
220 } // namespace lsst
221 
222 #endif
ToPoint tranForward(FromPoint const &point) const
Transform one point in the forward direction (&quot;from&quot; to &quot;to&quot;)
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:60
A WCS that transform pixels to ICRS RA/Dec using the LSST standard for pixels.
Definition: SkyWcs.h:97
lsst::afw::geom::Angle Angle
Definition: misc.h:36
FromPoint tranInverse(ToPoint const &point) const
Transform one point in the inverse direction (&quot;to&quot; to &quot;from&quot;)
Point2D skyToPixel(SpherePoint const &sky) const
Compute pixel position(s) from sky position(s)
Definition: SkyWcs.h:205
std::vector< Point2D > skyToPixel(std::vector< SpherePoint > const &sky) const
Compute pixel position(s) from sky position(s)
Definition: SkyWcs.h:206
AngleUnit constexpr degrees
constant with units of degrees
Definition: Angle.h:88
std::pair< double, double > skyToPixel(Angle const &ra, Angle const &dec) const
Compute pixel position(s) from sky position(s)
Eigen::Matrix2d getCdMatrix() const
Get the 2x2 CD matrix at the pixel origin.
Point2D getPixelOrigin() const
Get CRPIX, the pixel origin, using the LSST convention.
SpherePoint getSkyOrigin() const
Get CRVAL, the sky origin or celestial fiducial point.
SkyWcs getTanWcs(Point2D const &pixel) const
Get a local TAN WCS approximation to this WCS at the specified pixel position.
A class representing an angle.
Definition: Angle.h:102
std::pair< Angle, Angle > pixelToSky(double x, double y) const
Compute sky position(s) from pixel position(s)
double x
Angle getPixelScale() const
Get the pixel scale at the pixel origin.
std::vector< SpherePoint > pixelToSky(std::vector< Point2D > const &pixels) const
Compute sky position(s) from pixel position(s)
Definition: SkyWcs.h:193
SkyWcs(SkyWcs const &)=default
SpherePoint pixelToSky(Point2D const &pixel) const
Compute sky position(s) from pixel position(s)
Definition: SkyWcs.h:192
Eigen::Matrix2d makeCdMatrix(Angle const &scale, Angle const &orientation=0 *degrees, bool flipX=false)
Make a WCS CD matrix.
table::PointKey< int > pixel
table::PointKey< double > crval
Definition: Wcs.cc:929
SkyWcs copyAtShiftedPixelOrigin(Extent2D const &shift) const
Return a copy of this SkyWcs with the pixel origin by the specified amount.
SkyWcs & operator=(SkyWcs const &)=delete
Transform LSST spatial data, such as Point2D and SpherePoint, using an AST transform.
Definition: Transform.h:64
table::PointKey< double > crpix
Definition: Wcs.cc:930
lsst::daf::base::PropertyList PropertyList
Definition: Wcs.cc:56