lsst.meas.base  14.0-21-gb9e430a+2
Algorithm.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_BASE_Algorithm_h_INCLUDED
25 #define LSST_MEAS_BASE_Algorithm_h_INCLUDED
26 
27 #include "lsst/log/Log.h"
28 
29 #include "lsst/afw/table/fwd.h"
30 #include "lsst/afw/geom/SkyWcs.h"
34 
35 namespace lsst { namespace meas { namespace base {
36 
43 public:
44 
61  virtual void fail(
62  afw::table::SourceRecord & measRecord,
63  MeasurementError * error=nullptr
64  ) const = 0;
65 
66  virtual ~BaseAlgorithm() {}
67 
69  return _logName;
70  }
71 protected:
73 };
74 
85 class SingleFrameAlgorithm : public virtual BaseAlgorithm {
86 public:
87 
96  virtual void measure(
97  afw::table::SourceRecord & measRecord,
98  afw::image::Exposure<float> const & exposure
99  ) const = 0;
100 
111  virtual void measureN(
112  afw::table::SourceCatalog const & measCat,
113  afw::image::Exposure<float> const & exposure
114  ) const;
115 
116 };
117 
136 class ForcedAlgorithm : public virtual BaseAlgorithm {
137 public:
138 
147  virtual void measureForced(
148  afw::table::SourceRecord & measRecord,
149  afw::image::Exposure<float> const & exposure,
150  afw::table::SourceRecord const & refRecord,
151  afw::geom::SkyWcs const & refWcs
152  ) const = 0;
153 
164  virtual void measureNForced(
165  afw::table::SourceCatalog const & measCat,
166  afw::image::Exposure<float> const & exposure,
167  afw::table::SourceCatalog const & refRecord,
168  afw::geom::SkyWcs const & refWcs
169  ) const;
170 
171 };
172 
186 public:
187 
188  virtual void measureForced(
189  afw::table::SourceRecord & measRecord,
190  afw::image::Exposure<float> const & exposure,
191  afw::table::SourceRecord const & refRecord,
192  afw::geom::SkyWcs const & refWcs
193  ) const {
194  measure(measRecord, exposure);
195  }
196 
197  virtual void measureNForced(
198  afw::table::SourceCatalog const & measCat,
199  afw::image::Exposure<float> const & exposure,
200  afw::table::SourceCatalog const & refRecord,
201  afw::geom::SkyWcs const & refWcs
202  ) const {
203  measureN(measCat, exposure);
204  }
205 
206 };
207 
208 }}} // namespace lsst::meas::base
209 
210 #endif // !LSST_MEAS_BASE_Algorithm_h_INCLUDED
virtual void measureNForced(afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure, afw::table::SourceCatalog const &refRecord, afw::geom::SkyWcs const &refWcs) const
Called to simultaneously measure all children in a deblend family, in a single image.
Definition: Algorithm.h:197
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=nullptr) const =0
Handle an exception thrown by the current algorithm by setting flags in the given record...
Base class for algorithms that measure the properties of sources on single image. ...
Definition: Algorithm.h:85
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Definition: exceptions.h:48
Base class for algorithms that measure the properties of sources on one image, using previous measure...
Definition: Algorithm.h:136
STL class.
Ultimate abstract base class for all C++ measurement algorithms.
Definition: Algorithm.h:42
std::string getLogName() const
Definition: Algorithm.h:68
virtual void measureForced(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure, afw::table::SourceRecord const &refRecord, afw::geom::SkyWcs const &refWcs) const
Called to measure a single child source in an image.
Definition: Algorithm.h:188
An abstract base classes for which the same implementation can be used for both SingleFrameAlgorithm ...
Definition: Algorithm.h:185