LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
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
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
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
Extent< double, 2 > Extent2D
Definition: Extent.h:361
geom::Point2I & _xy0
Definition: fits_io_mpl.h:78
struct wcsprm * _wcsInfo
Definition: Wcs.h:410
table::PointKey< double > crpix
Definition: Wcs.cc:1031