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 Types | Public Member Functions | Protected Attributes | Private Member Functions | List of all members
lsst::meas::algorithms::ApertureFlux Class Reference

A class that knows how to calculate fluxes as a simple sum over a Footprint. More...

#include <ApertureFlux.h>

Inheritance diagram for lsst::meas::algorithms::ApertureFlux:
lsst::meas::algorithms::Algorithm lsst::meas::algorithms::EllipticalApertureFlux

Public Types

typedef std::vector< double > VectorD
 

Public Member Functions

 ApertureFlux (ApertureFluxControl const &ctrl, afw::table::Schema &schema)
 
virtual ~ApertureFlux ()
 
- Public Member Functions inherited from lsst::meas::algorithms::Algorithm
 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 Attributes

afw::table::Key
< afw::table::Array< double > > 
_fluxKey
 
afw::table::Key
< afw::table::Array< double > > 
_errKey
 
afw::table::Key< int > _nProfileKey
 
afw::table::Key< afw::table::Flag > _flagKey
 

Private Member Functions

template<typename PixelT >
void _apply (afw::table::SourceRecord &source, afw::image::Exposure< PixelT > const &exposure, afw::geom::Point2D const &center) const
 Given an image and a pixel position, return a Flux. More...
 
 LSST_MEAS_ALGORITHM_PRIVATE_INTERFACE (ApertureFlux)
 

Additional Inherited Members

- Protected Member Functions inherited from lsst::meas::algorithms::Algorithm
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...
 

Detailed Description

A class that knows how to calculate fluxes as a simple sum over a Footprint.

Implement "Aperture" photometry.

Definition at line 39 of file ApertureFlux.h.

Member Typedef Documentation

typedef std::vector<double> lsst::meas::algorithms::ApertureFlux::VectorD

Definition at line 41 of file ApertureFlux.h.

Constructor & Destructor Documentation

lsst::meas::algorithms::ApertureFlux::ApertureFlux ( ApertureFluxControl const &  ctrl,
afw::table::Schema schema 
)
inline

Definition at line 43 of file ApertureFlux.h.

43  :
44  Algorithm(ctrl),
45  _fluxKey(schema.addField< afw::table::Array<double> >(
46  ctrl.name, "sum of pixels in apertures", "dn", ctrl.radii.size())),
47  _errKey(schema.addField< afw::table::Array<double> >(
48  ctrl.name + ".err", "uncertainty for " + ctrl.name, "dn", ctrl.radii.size())),
49  _nProfileKey(schema.addField<int>(ctrl.name + ".nProfile", "pixels",
50  "Number of points in radial profile")),
51  _flagKey(schema.addField<afw::table::Flag>(ctrl.name + ".flag", "success flag for " + ctrl.name))
52  {}
Algorithm(AlgorithmControl const &ctrl)
Definition: Algorithm.h:236
tbl::Schema schema
Definition: CoaddPsf.cc:324
afw::table::Key< afw::table::Array< double > > _errKey
Definition: ApertureFlux.h:57
afw::table::Key< afw::table::Flag > _flagKey
Definition: ApertureFlux.h:59
afw::table::Key< afw::table::Array< double > > _fluxKey
Definition: ApertureFlux.h:56
afw::table::Key< int > _nProfileKey
Definition: ApertureFlux.h:58
virtual lsst::meas::algorithms::ApertureFlux::~ApertureFlux ( )
inlinevirtual

Definition at line 53 of file ApertureFlux.h.

53 {}

Member Function Documentation

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

Given an image and a pixel position, return a Flux.

< object's column position

< object's row position

Definition at line 182 of file ApertureFlux.cc.

186  {
187  source.set(_flagKey, true); // say we've failed so that's the result if we throw
188  VectorD const & radii = static_cast<ApertureFluxControl const &>(getControl()).radii;
189  int const nradii = radii.size();
190 
191  typedef typename afw::image::Exposure<PixelT>::MaskedImageT MaskedImageT;
192  typedef typename MaskedImageT::Image ImageT;
193 
194  MaskedImageT const& mimage = exposure.getMaskedImage();
195 
196  double const xcen = center.getX();
197  double const ycen = center.getY();
198 
199  int const ixcen = afw::image::positionToIndex(xcen);
200  int const iycen = afw::image::positionToIndex(ycen);
201 
202  // BBox for data image
203  afw::geom::BoxI imageBBox(mimage.getBBox());
204 
205  /* ******************************************************* */
206  // Aperture flux
207  for (int i = 0; i != nradii; ++i) {
208  FootprintFlux<MaskedImageT> fluxFunctor(mimage);
209  afwDet::Footprint const foot(afw::geom::PointI(ixcen, iycen), radii[i], imageBBox);
210  fluxFunctor.apply(foot);
211  source.set(_fluxKey[i], fluxFunctor.getSum());
212  source.set(_errKey[i], ::sqrt(fluxFunctor.getSumVar()));
213  source.set(_nProfileKey, i + 1); // we've measured this many apertures
214  }
215  source.set(_flagKey, false);
216 }
int positionToIndex(double pos)
Convert image position to nearest integer index.
Definition: ImageUtils.h:69
Box2I BoxI
Definition: Box.h:479
AlgorithmControl const & getControl() const
Return a clone of the control object used to construct the algorithm.
Definition: Algorithm.h:120
MaskedImage< PixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > MaskedImageT
Definition: Exposure.h:51
A set of pixels in an Image.
Definition: Footprint.h:73
Point< int, 2 > PointI
Definition: Point.h:273
afw::table::Key< afw::table::Array< double > > _errKey
Definition: ApertureFlux.h:57
afw::table::Key< afw::table::Flag > _flagKey
Definition: ApertureFlux.h:59
afw::table::Key< afw::table::Array< double > > _fluxKey
Definition: ApertureFlux.h:56
afw::table::Key< int > _nProfileKey
Definition: ApertureFlux.h:58
lsst::meas::algorithms::ApertureFlux::LSST_MEAS_ALGORITHM_PRIVATE_INTERFACE ( ApertureFlux  )
private

Member Data Documentation

afw::table::Key< afw::table::Array<double> > lsst::meas::algorithms::ApertureFlux::_errKey
protected

Definition at line 57 of file ApertureFlux.h.

afw::table::Key< afw::table::Flag > lsst::meas::algorithms::ApertureFlux::_flagKey
protected

Definition at line 59 of file ApertureFlux.h.

afw::table::Key< afw::table::Array<double> > lsst::meas::algorithms::ApertureFlux::_fluxKey
protected

Definition at line 56 of file ApertureFlux.h.

afw::table::Key<int> lsst::meas::algorithms::ApertureFlux::_nProfileKey
protected

Definition at line 58 of file ApertureFlux.h.


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