LSSTApplications  18.1.0
LSSTDataManagementBasePackage
PixelScaleBoundedField.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * This file is part of afw.
4  *
5  * Developed for the LSST Data Management System.
6  * This product includes software developed by the LSST Project
7  * (https://www.lsst.org).
8  * See the COPYRIGHT file at the top-level directory of this distribution
9  * for details of code ownership.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
28 #ifndef LSST_AFW_MATH_PixelScaleBoundedField_h_INCLUDED
29 #define LSST_AFW_MATH_PixelScaleBoundedField_h_INCLUDED
30 
31 #include "lsst/afw/geom/SkyWcs.h"
33 #include "lsst/pex/exceptions.h"
34 
35 namespace lsst {
36 namespace afw {
37 namespace math {
38 
48 public:
53  : BoundedField(bbox),
54  _skyWcs(skyWcs),
55  _inverseScale(1.0 / std::pow(skyWcs.getPixelScale().asDegrees(), 2)) {}
56 
57  ~PixelScaleBoundedField() override = default;
58 
63 
65  geom::SkyWcs const &getSkyWcs() const { return _skyWcs; }
67  double getInverseScale() const { return _inverseScale; }
68 
70  double evaluate(lsst::geom::Point2D const &position) const override;
71 
73  bool isPersistable() const noexcept override { return false; }
74 
76  std::shared_ptr<BoundedField> operator*(double const scale) const override {
77  throw LSST_EXCEPT(pex::exceptions::LogicError, "Not implemented");
78  }
79 
81  bool operator==(BoundedField const &rhs) const override;
82 
83 private:
84  geom::SkyWcs const _skyWcs;
85  // Inverse pixel scale (square degrees), for convenience.
86  double const _inverseScale;
87 
88  std::string toString() const override;
89 };
90 
91 } // namespace math
92 } // namespace afw
93 } // namespace lsst
94 
95 #endif // !LSST_AFW_MATH_PixelScaleBoundedField_h_INCLUDED
std::shared_ptr< BoundedField > operator*(double const scale) const override
Return a scaled BoundedField.
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition: SkyWcs.h:117
PixelScaleBoundedField & operator=(PixelScaleBoundedField const &)=delete
bool operator==(BoundedField const &rhs) const override
BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal...
def scale(algorithm, min, max=None, frame=None)
Definition: ds9.py:109
geom::SkyWcs const & getSkyWcs() const
Get the contained SkyWcs.
STL namespace.
double getInverseScale() const
Get the cached inverse pixel scale.
STL class.
A BoundedField that gives the amount a pixel is distorted at each point.
A base class for image defects.
bool isPersistable() const noexcept override
TransformBoundedField is not persistable.
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
table::Box2IKey bbox
Definition: Detector.cc:169
double evaluate(lsst::geom::Point2D const &position) const override
Evaluate the field at the given point.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
An abstract base class for 2-d functions defined on an integer bounding boxes.
Definition: BoundedField.h:55
An integer coordinate rectangle.
Definition: Box.h:54
PixelScaleBoundedField(lsst::geom::Box2I const &bbox, geom::SkyWcs const &skyWcs)
Create a PixelScaleBoundedField from a bounding box and SkyWcs.