32 namespace lsst {
namespace meas {
namespace base {
36 template <
typename MaskedImageT>
39 explicit FootprintFlux(MaskedImageT
const& mimage
40 ) : lsst::afw::detection::FootprintFunctor<MaskedImageT>(mimage),
50 void operator()(
typename MaskedImageT::xy_locator loc,
54 typename MaskedImageT::Image::Pixel ival = loc.image(0, 0);
55 typename MaskedImageT::Variance::Pixel vval = loc.variance(0, 0);
61 double getSum()
const {
return _sum; }
64 double getSumVar()
const {
return _sumVar; }
71 template <
typename MaskedImageT,
typename WeightImageT>
74 FootprintWeightFlux(MaskedImageT
const& mimage,
75 typename WeightImageT::Ptr wimage
88 if (bbox.getDimensions() !=
_wimage->getDimensions()) {
89 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
90 (
boost::format(
"Footprint at %d,%d -- %d,%d is wrong size for "
91 "%d x %d weight image") %
92 bbox.getMinX() % bbox.getMinY() % bbox.getMaxX() % bbox.getMaxY() %
99 void operator()(
typename MaskedImageT::xy_locator iloc,
103 typename MaskedImageT::Image::Pixel ival = iloc.image(0, 0);
104 typename MaskedImageT::Variance::Pixel vval = iloc.variance(0, 0);
105 typename WeightImageT::Pixel wval = (*_wimage)(x -
_x0, y -
_y0);
111 double getSum()
const {
return _sum; }
113 double getSumVar()
const {
return _sumVar; }
129 getSum2() :
sum(0.0),
sum2(0.0) {}
144 std::string
const & name,
148 FluxResultKey::addFields(schema, name,
"flux from Naive Flux algorithm")
150 _centroidExtractor(schema, name)
152 static boost::array<FlagDefinition,N_FLAGS>
const flagDefs = {{
153 {
"flag",
"general failure flag, set if anything went wrong"},
154 {
"flag_edge",
"source is too close to the edge of the field to compute the given aperture"}
168 double const xcen = center.getX();
169 double const ycen = center.getY();
179 FootprintFlux<afw::image::Exposure<float>::MaskedImageT> fluxFunctor(mimage);
186 fluxFunctor.apply(foot);
187 }
catch (pex::exceptions::LengthError &) {
195 result.
flux = fluxFunctor.getSum();
196 result.
fluxSigma = ::sqrt(fluxFunctor.getSumVar());
Defines the fields and offsets for a table.
SafeCentroidExtractor _centroidExtractor
WeightImageT::Ptr const & _wimage
Eigen matrix objects that present a view into an ndarray::Array.
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
int positionToIndex(double pos)
Convert image position to nearest integer index.
A class to contain the data, WCS, and other information needed to describe an image of the sky...
geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
< unspecified-expression-type > operator+(ExpressionBase< Operand > const &operand, Scalar const &scalar)
Exception to be thrown when a measurement algorithm experiences a known failure mode.
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=NULL) const
An integer coordinate rectangle.
FlagDefinition getDefinition(int i) const
MaskedImageT getMaskedImage()
Return the MaskedImage.
Flux flux
Measured flux in DN.
void setValue(afw::table::BaseRecord &record, int i, bool value) const
FluxResultKey _fluxResultKey
A FunctorKey for FluxResult.
#define LSST_EXCEPT(type,...)
A C++ control class to handle NaiveFluxAlgorithm's configuration.
NaiveFluxAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
void handleFailure(afw::table::BaseRecord &record, MeasurementError const *error=NULL) const
Record class that contains measurements made on a single exposure.
FluxErrElement fluxSigma
1-Sigma error (sqrt of variance) on flux in DN.
static FlagHandler addFields(afw::table::Schema &schema, std::string const &prefix, FlagDefinition const *begin, FlagDefinition const *end)
double radius
"Size of the circular aperture, in pixels" ;
A reusable result struct for flux measurements.