LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
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
int y
Extent< double, 2 > Extent2D
Definition: Extent.h:361
boost::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:907
virtual void pixelToSkyImpl(double pixel1, double pixel2, afw::geom::Angle skyTmp[2]) const
Definition: BinnedWcs.cc:48
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
afw::geom::AffineTransform const _binnedToOriginal
Definition: BinnedWcs.h:84
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
boost::shared_ptr< afw::image::Wcs > const _parent
Definition: BinnedWcs.h:81
A class representing an Angle.
Definition: Angle.h:103
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
lsst::afw::geom::Point2D getPixelOrigin() const
Returns CRPIX (corrected to LSST convention).
Definition: Wcs.cc:579
double x
#define PTR(...)
Definition: base.h:41
virtual afw::geom::Point2D skyToPixelImpl(afw::geom::Angle sky1, afw::geom::Angle sky2) const
Definition: BinnedWcs.cc:55
geom::Point2I & _xy0
Definition: fits_io_mpl.h:78
This is the base class for spherical coordinates.
Definition: Coord.h:69
struct wcsprm * _wcsInfo
Definition: Wcs.h:410
table::PointKey< double > crpix
Definition: Wcs.cc:1031