LSSTApplications  11.0-22-g33de520,13.0+153,14.0+52,14.0+57,14.0-1-g013352c+36,14.0-1-g13ef843+9,14.0-1-g4b114ac+14,14.0-1-g7257b6a+12,14.0-1-g8b7e855+51,14.0-13-g7a60b79+2,14.0-14-g87d16e8+10,14.0-14-gbf7a6f8a,14.0-17-g4f4ea82+5,14.0-2-g319577b+11,14.0-2-ga5af9b6+10,14.0-22-gc48c03f+3,14.0-3-g20413be+3,14.0-46-g76222d5f+3,14.0-47-g0a51fac97,14.0-5-g744ff5f+2,14.0-5-g86eb1bd+31,14.0-6-gd5b81a9+6,14.0-6-ge2c9487+42,14.0-8-g7f6dd6b+6,14.0-8-gb81b6e9+4,14.0-9-g11010eb,14.0-9-g330837b+5
LSSTDataManagementBasePackage
BinnedWcs.cc
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 
25 #include "wcslib/wcs.h" // Unfortunate, but necessary due to parent class mixing implementation and interface
26 
27 namespace lsst { namespace meas { namespace algorithms {
28 
30  PTR(afw::image::Wcs) parent,
31  unsigned int xBin,
32  unsigned int yBin,
34  ) :
35  afw::image::Wcs(*parent), // We have to inherit the implementation as well as the interface...
36  _parent(parent), _xBin(xBin), _yBin(yBin), _xy0(xy0),
37  _binnedToOriginal(afw::geom::AffineTransform::makeTranslation(afw::geom::Extent2D(_xy0))*
38  afw::geom::AffineTransform::makeScaling(_xBin, _yBin)),
39  _originalToBinned(_binnedToOriginal.invert())
40 {
41  // Correct CRPIX
43  _wcsInfo->crpix[0] = crpix.getX() + 1; // convert LSST --> FITS
44  _wcsInfo->crpix[1] = crpix.getY() + 1; // convert LSST --> FITS
45 }
46 
47 
48 void BinnedWcs::pixelToSkyImpl(double x, double y, afw::geom::Angle skyTmp[2]) const
49 {
51  skyTmp[0] = coord->getLongitude();
52  skyTmp[1] = coord->getLatitude();
53 }
54 
56 {
57  return _originalToBinned(_parent->skyToPixel(*makeCorrectCoord(sky1, sky2)));
58 }
59 
60 }}} // namespace lsst::meas::algorithms
Extent< double, 2 > Extent2D
Definition: Extent.h:383
virtual afw::geom::Point2D skyToPixelImpl(afw::geom::Angle sky1, afw::geom::Angle sky2) const
Worker routine for skyToPixel.
Definition: BinnedWcs.cc:55
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:104
#define PTR(...)
Definition: base.h:41
afw::geom::AffineTransform const _binnedToOriginal
Definition: BinnedWcs.h:84
boost::shared_ptr< afw::image::Wcs > const _parent
Definition: BinnedWcs.h:81
A class representing an angle.
Definition: Angle.h:102
A base class for image defects.
Definition: cameraGeom.dox:3
afw::geom::AffineTransform const _originalToBinned
Definition: BinnedWcs.h:84
BinnedWcs(boost::shared_ptr< afw::image::Wcs > parent, unsigned int xBin, unsigned int yBin, afw::geom::Point2I xy0)
Definition: BinnedWcs.cc:29
virtual void pixelToSkyImpl(double pixel1, double pixel2, afw::geom::Angle skyTmp[2]) const
Worker routine for pixelToSky.
Definition: BinnedWcs.cc:48
lsst::afw::geom::Point2D getPixelOrigin() const
Returns CRPIX (corrected to LSST convention).
Definition: Wcs.cc:542
std::shared_ptr< afw::coord::Coord > makeCorrectCoord(geom::Angle sky0, geom::Angle sky1) const
Given a sky position, use the values stored in ctype and radesys to return the correct sub-class of C...
Definition: Wcs.cc:846
double x
geom::Point2I & _xy0
Definition: fits_io_mpl.h:82
This is the base class for spherical coordinates.
Definition: Coord.h:63
struct wcsprm * _wcsInfo
Definition: Wcs.h:446
table::PointKey< double > crpix
Definition: Wcs.cc:935