lsst.meas.algorithms  15.0-12-g7952b551
CoaddBoundedField.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2014 LSST Corporation.
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_MEAS_ALGORITHMS_CoaddBoundedField_h_INCLUDED
25 #define LSST_MEAS_ALGORITHMS_CoaddBoundedField_h_INCLUDED
26 
27 #include "lsst/geom/Box.h"
29 #include "lsst/afw/geom/SkyWcs.h"
31 
32 namespace lsst {
33 namespace meas {
34 namespace algorithms {
35 
39  PTR(afw::geom::polygon::Polygon const) validPolygon_, double weight_ = 1.0)
40  : field(field_), wcs(wcs_), validPolygon(validPolygon_), weight(weight_) {}
41 
43  bool operator==(CoaddBoundedFieldElement const& rhs) const {
44  return (field == rhs.field) && (wcs == rhs.wcs) && (validPolygon == rhs.validPolygon) &&
45  (weight == rhs.weight);
46  }
48  bool operator!=(CoaddBoundedFieldElement const& rhs) const { return !(*this == rhs); };
49 
53  double weight;
54 };
55 
56 class CoaddBoundedField : public afw::table::io::PersistableFacade<CoaddBoundedField>,
58 public:
61 
63  ElementVector const& elements);
64 
65  explicit CoaddBoundedField(geom::Box2I const& bbox, PTR(afw::geom::SkyWcs const) coaddWcs,
66  ElementVector const& elements, double default_);
67 
69  virtual double evaluate(geom::Point2D const& position) const;
70 
74  virtual bool isPersistable() const { return true; }
75 
76  // Factory used to read CoaddPsf from an InputArchive; defined only in the source file.
77  class Factory;
78 
79  virtual PTR(afw::math::BoundedField) operator*(double const scale) const;
80 
82  virtual bool operator==(BoundedField const& rhs) const;
83 
84 protected:
85  // See afw::table::io::Persistable::getPersistenceName
86  virtual std::string getPersistenceName() const;
87 
88  // See afw::table::io::Persistable::getPythonModule
89  virtual std::string getPythonModule() const;
90 
91  // See afw::table::io::Persistable::write
92  virtual void write(OutputArchiveHandle& handle) const;
93 
94 private:
95  bool _throwOnMissing; // instead of using _default, raise an exception
96  double _default; // when none of the elements contribute at a point, return this value
97  PTR(afw::geom::SkyWcs const) _coaddWcs; // coordinate system this field is defined in
98  ElementVector _elements; // vector of constituent fields being coadded
99 
100  virtual std::string toString() const {
102  os << "CoaddBoundedField with " << _elements.size() << " elements, default " << _default;
103  return os.str();
104  }
105 };
106 
107 } // namespace algorithms
108 } // namespace meas
109 } // namespace lsst
110 
111 #endif // !LSST_MEAS_ALGORITHMS_CoaddBoundedField_h_INCLUDED
Struct used to hold one Exposure&#39;s data in a CoaddBoundedField.
boost::shared_ptr< afw::geom::SkyWcs const > wcs
geom::Box2D bbox
bool operator!=(CoaddBoundedFieldElement const &rhs) const
Elements are equal if all their components are equal.
def scale(algorithm, min, max=None, frame=None)
#define PTR(...)
afw::table::Key< double > default_
STL class.
bool operator==(CoaddBoundedFieldElement const &rhs) const
Elements are equal if all their components are equal.
CoaddBoundedFieldElement(boost::shared_ptr< afw::math::BoundedField > field_, boost::shared_ptr< afw::geom::SkyWcs const > wcs_, boost::shared_ptr< afw::geom::polygon::Polygon const > validPolygon_, double weight_=1.0)
constexpr Angle operator*(Angle a, Angle d) noexcept
T str(T... args)
afw::table::Key< int > coaddWcs
T size(T... args)
io::OutputArchiveHandle OutputArchiveHandle
std::ostream * os
virtual bool isPersistable() const
Return true if the CoaddBoundedField persistable (always true).
boost::shared_ptr< afw::math::BoundedField > field
boost::shared_ptr< afw::geom::polygon::Polygon const > validPolygon