lsst.meas.algorithms  14.0-14-gbf7a6f8a
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 
28 #include "lsst/afw/image/Wcs.h"
30 
31 namespace lsst { namespace meas { namespace algorithms {
32 
35 
38  PTR(afw::image::Wcs const) wcs_,
39  PTR(afw::geom::polygon::Polygon const) validPolygon_,
40  double weight_=1.0
41  ) : field(field_), wcs(wcs_), validPolygon(validPolygon_),
42  weight(weight_) {}
43 
45  bool operator==(CoaddBoundedFieldElement const& rhs) const {
46  return (field == rhs.field) && (wcs == rhs.wcs)
47  && (validPolygon == rhs.validPolygon) && (weight == rhs.weight);
48  }
50  bool operator!=(CoaddBoundedFieldElement const& rhs) const { return !(*this == rhs); };
51 
55  double weight;
56 };
57 
59  public afw::table::io::PersistableFacade<CoaddBoundedField>,
61 {
62 public:
63 
66 
67  explicit CoaddBoundedField(
68  afw::geom::Box2I const & bbox,
70  ElementVector const & elements
71  );
72 
73  explicit CoaddBoundedField(
74  afw::geom::Box2I const & bbox,
76  ElementVector const & elements,
77  double default_
78  );
79 
81  virtual double evaluate(afw::geom::Point2D const & position) const;
82 
86  virtual bool isPersistable() const { return true; }
87 
88  // Factory used to read CoaddPsf from an InputArchive; defined only in the source file.
89  class Factory;
90 
91  virtual PTR(afw::math::BoundedField) operator*(double const scale) const;
92 
94  virtual bool operator==(BoundedField const& rhs) const;
95 
96 protected:
97 
98  // See afw::table::io::Persistable::getPersistenceName
99  virtual std::string getPersistenceName() const;
100 
101  // See afw::table::io::Persistable::getPythonModule
102  virtual std::string getPythonModule() const;
103 
104  // See afw::table::io::Persistable::write
105  virtual void write(OutputArchiveHandle & handle) const;
106 
107 private:
108 
109  bool _throwOnMissing; // instead of using _default, raise an exception
110  double _default; // when none of the elements contribute at a point, return this value
111  PTR(afw::image::Wcs const) _coaddWcs; // coordinate system this field is defined in
112  ElementVector _elements; // vector of constituent fields being coadded
113 
114  virtual std::string toString() const {
116  os << "CoaddBoundedField with " << _elements.size() << " elements, default " << _default;
117  return os.str();
118  }
119 };
120 
121 }}} // namespace lsst::meas::algorithms
122 
123 #endif // !LSST_MEAS_ALGORITHMS_CoaddBoundedField_h_INCLUDED
Struct used to hold one Exposure&#39;s data in a CoaddBoundedField.
boost::shared_ptr< afw::image::Wcs const > wcs
afw::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(...)
STL class.
bool operator==(CoaddBoundedFieldElement const &rhs) const
Elements are equal if all their components are equal.
tbl::Key< double > default_
T str(T... args)
CoaddBoundedFieldElement(boost::shared_ptr< afw::math::BoundedField > field_, boost::shared_ptr< afw::image::Wcs const > wcs_, boost::shared_ptr< afw::geom::polygon::Polygon const > validPolygon_, double weight_=1.0)
T size(T... args)
constexpr Angle operator*(Angle a, Angle d) noexcept
io::OutputArchiveHandle OutputArchiveHandle
virtual bool isPersistable() const
Return true if the CoaddBoundedField persistable (always true).
boost::shared_ptr< afw::math::BoundedField > field
tbl::Key< int > coaddWcs
boost::shared_ptr< afw::geom::polygon::Polygon const > validPolygon