LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
lsst::meas::algorithms::Algorithm Class Referenceabstract

Base class for source measurement algorithms. More...

#include <Algorithm.h>

Inheritance diagram for lsst::meas::algorithms::Algorithm:
lsst::ip::diffim::DipoleCentroidAlgorithm lsst::ip::diffim::DipoleFluxAlgorithm lsst::meas::algorithms::ApertureFlux lsst::meas::algorithms::CentroidAlgorithm lsst::meas::algorithms::FluxAlgorithm lsst::meas::algorithms::ShapeAlgorithm lsst::ip::diffim::NaiveDipoleCentroid lsst::ip::diffim::NaiveDipoleFlux lsst::ip::diffim::PsfDipoleFlux lsst::meas::algorithms::EllipticalApertureFlux lsst::meas::algorithms::SincFlux

Public Member Functions

 Algorithm (AlgorithmControl const &ctrl)
 
virtual ~Algorithm ()
 
AlgorithmControl const & getControl () const
 Return a clone of the control object used to construct the algorithm. More...
 
template<typename PixelT >
void apply (afw::table::SourceRecord &source, afw::image::Exposure< PixelT > const &exposure, afw::geom::Point2D const &center) const
 Run the algorithm, filling appropriate fields in the given source. More...
 

Protected Member Functions

template<typename PixelT >
void _apply (afw::table::SourceRecord &source, afw::image::Exposure< PixelT > const &exposure, afw::geom::Point2D const &center) const
 Simulated virtual function that all algorithms must implement. More...
 

Private Member Functions

virtual void _applyT (lsst::afw::table::SourceRecord &, lsst::afw::image::Exposure< float > const &, lsst::afw::geom::Point2D const &center) const =0
 
virtual void _applyT (lsst::afw::table::SourceRecord &, lsst::afw::image::Exposure< double > const &, lsst::afw::geom::Point2D const &center) const =0
 

Private Attributes

boost::shared_ptr
< AlgorithmControl const > 
_ctrl
 

Detailed Description

Base class for source measurement algorithms.

Algorithm simulates template virtual functions, with the following mechanism:

Algorithm subclasses will generally declare and define "_applyT" using the macro LSST_MEAS_ALGORITHM_PRIVATE_INTERFACE (in the private or protected section of the class declaration). Similarly, LSST_MEAS_ALGORITHM_PRIVATE_IMPLEMENTATION (at namespace scope in the same source file that contains the implementation of "_apply") will ensure that the needed versions of "_apply" are instantiated.

Algorithms should generally be immutable; this will prevent letting Python have access to CONST_PTR(Algorithm) objects from causing problems.

Most algorithms will have a constructor that takes a control object, a non-const reference to an afw::table::Schema, and a PTR(daf::base::PropertyList). This is effectively enforced by the signature of AlgorithmControl::makeAlgorithm.

Definition at line 106 of file Algorithm.h.

Constructor & Destructor Documentation

lsst::meas::algorithms::Algorithm::Algorithm ( AlgorithmControl const &  ctrl)
inlineexplicit

Definition at line 236 of file Algorithm.h.

236 : _ctrl(ctrl.clone()) {}
boost::shared_ptr< AlgorithmControl const > _ctrl
Definition: Algorithm.h:157
virtual lsst::meas::algorithms::Algorithm::~Algorithm ( )
inlinevirtual

Definition at line 111 of file Algorithm.h.

111 {}

Member Function Documentation

template<typename PixelT >
void lsst::meas::algorithms::Algorithm::_apply ( afw::table::SourceRecord source,
afw::image::Exposure< PixelT > const &  exposure,
afw::geom::Point2D const &  center 
) const
inlineprotected

Simulated virtual function that all algorithms must implement.

Definition at line 142 of file Algorithm.h.

146  {
147  // This declaration is exposition only; subclasses must implement to allow the
148  // LSST_MEAS_ALGORITHM_PRIVATE_INTERFACE macro to do its work.
149  BOOST_STATIC_ASSERT(sizeof(PixelT) < 0);
150  }
virtual void lsst::meas::algorithms::Algorithm::_applyT ( lsst::afw::table::SourceRecord ,
lsst::afw::image::Exposure< float > const &  ,
lsst::afw::geom::Point2D const &  center 
) const
privatepure virtual
virtual void lsst::meas::algorithms::Algorithm::_applyT ( lsst::afw::table::SourceRecord ,
lsst::afw::image::Exposure< double > const &  ,
lsst::afw::geom::Point2D const &  center 
) const
privatepure virtual
template<typename PixelT >
void lsst::meas::algorithms::Algorithm::apply ( afw::table::SourceRecord source,
afw::image::Exposure< PixelT > const &  exposure,
afw::geom::Point2D const &  center 
) const
inline

Run the algorithm, filling appropriate fields in the given source.

This is the public interface to the algorithm; it delegates to virtual functions that are overloaded for all the allowed template types. These in turn delegate the templated _apply function.

Definition at line 130 of file Algorithm.h.

134  {
135  this->_applyT(source, exposure, center);
136  }
virtual void _applyT(lsst::afw::table::SourceRecord &, lsst::afw::image::Exposure< float > const &, lsst::afw::geom::Point2D const &center) const =0
AlgorithmControl const& lsst::meas::algorithms::Algorithm::getControl ( ) const
inline

Return a clone of the control object used to construct the algorithm.

The returned reference can be considered completely immutable, and should never be changed. Subclasses that reimplement to cast to a derived type should use returnCopy (in p_lsstSwig.i) to prevent dangling references and keep Python from const-casting the result.

Definition at line 120 of file Algorithm.h.

120 { return *_ctrl; }
boost::shared_ptr< AlgorithmControl const > _ctrl
Definition: Algorithm.h:157

Member Data Documentation

boost::shared_ptr< AlgorithmControl const> lsst::meas::algorithms::Algorithm::_ctrl
private

Definition at line 157 of file Algorithm.h.


The documentation for this class was generated from the following file: