lsst.meas.base  14.0-12-g233aa8e+1
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"
33 
34 namespace lsst { namespace meas { namespace base {
35 
42 public:
43 
60  virtual void fail(
61  afw::table::SourceRecord & measRecord,
62  MeasurementError * error=nullptr
63  ) const = 0;
64 
65  virtual ~BaseAlgorithm() {}
66 
68  return _logName;
69  }
70 protected:
72 };
73 
84 class SingleFrameAlgorithm : public virtual BaseAlgorithm {
85 public:
86 
95  virtual void measure(
96  afw::table::SourceRecord & measRecord,
97  afw::image::Exposure<float> const & exposure
98  ) const = 0;
99 
110  virtual void measureN(
111  afw::table::SourceCatalog const & measCat,
112  afw::image::Exposure<float> const & exposure
113  ) const;
114 
115 };
116 
135 class ForcedAlgorithm : public virtual BaseAlgorithm {
136 public:
137 
146  virtual void measureForced(
147  afw::table::SourceRecord & measRecord,
148  afw::image::Exposure<float> const & exposure,
149  afw::table::SourceRecord const & refRecord,
150  afw::image::Wcs const & refWcs
151  ) const = 0;
152 
163  virtual void measureNForced(
164  afw::table::SourceCatalog const & measCat,
165  afw::image::Exposure<float> const & exposure,
166  afw::table::SourceCatalog const & refRecord,
167  afw::image::Wcs const & refWcs
168  ) const;
169 
170 };
171 
185 public:
186 
187  virtual void measureForced(
188  afw::table::SourceRecord & measRecord,
189  afw::image::Exposure<float> const & exposure,
190  afw::table::SourceRecord const & refRecord,
191  afw::image::Wcs const & refWcs
192  ) const {
193  measure(measRecord, exposure);
194  }
195 
196  virtual void measureNForced(
197  afw::table::SourceCatalog const & measCat,
198  afw::image::Exposure<float> const & exposure,
199  afw::table::SourceCatalog const & refRecord,
200  afw::image::Wcs const & refWcs
201  ) const {
202  measureN(measCat, exposure);
203  }
204 
205 };
206 
207 }}} // namespace lsst::meas::base
208 
209 #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::image::Wcs const &refWcs) const
Called to simultaneously measure all children in a deblend family, in a single image.
Definition: Algorithm.h:196
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:84
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:135
STL class.
Ultimate abstract base class for all C++ measurement algorithms.
Definition: Algorithm.h:41
std::string getLogName() const
Definition: Algorithm.h:67
virtual void measureForced(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure, afw::table::SourceRecord const &refRecord, afw::image::Wcs const &refWcs) const
Called to measure a single child source in an image.
Definition: Algorithm.h:187
An abstract base classes for which the same implementation can be used for both SingleFrameAlgorithm ...
Definition: Algorithm.h:184