24 #include "boost/array.hpp"
31 #include "lsst/afw/detection/FootprintArray.cc"
34 namespace lsst {
namespace meas {
namespace base {
38 std::string
const & name,
42 FluxResultKey::addFields(schema, name,
"flux derived from linear least-squares fit of PSF model")
44 _centroidExtractor(schema, name)
46 static boost::array<FlagDefinition,N_FLAGS>
const flagDefs = {{
47 {
"flag",
"general failure flag"},
48 {
"flag_noGoodPixels",
"not enough non-rejected pixels in data to attempt the fit"},
49 {
"flag_edge",
"object was too close to the edge of the image to use the full PSF model"}
62 "PsfFlux algorithm requires a Psf with every exposure"
69 if (fitBBox != psfImage->getBBox()) {
81 badBits |= exposure.
getMaskedImage().getMask()->getPlaneBitMask(*i);
115 PsfPixel
alpha = model.matrix().squaredNorm();
117 result.
flux = model.matrix().dot(data.matrix().cast<PsfPixel>()) /
alpha;
120 result.
fluxSigma = std::sqrt(model.square().matrix().dot(variance.matrix().cast<PsfPixel>()))
123 throw LSST_EXCEPT(PixelValueError,
"Invalid pixel value detected in image.");
Defines the fields and offsets for a table.
std::vector< std::string > badMaskPlanes
"Mask planes that indicate pixels that should be excluded from the fit" ;
void flattenArray(Footprint const &fp, ndarray::Array< T, N, C > const &src, ndarray::Array< U, N-1, D > const &dest, lsst::afw::geom::Point2I const &xy0=lsst::afw::geom::Point2I())
Flatten the first two dimensions of an array.
geom::Point2I getXY0() const
geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Eigen matrix objects that present a view into an ndarray::Array.
Eigen3 view into an ndarray::Array.
A class to contain the data, WCS, and other information needed to describe an image of the sky...
boost::uint16_t MaskPixel
PixelT Pixel
A pixel in this ImageBase.
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=NULL) const
Exception to be thrown when a measurement algorithm experiences a known failure mode.
An integer coordinate rectangle.
FlagDefinition getDefinition(int i) const
MaskedImageT getMaskedImage()
Return the MaskedImage.
math::Kernel::Pixel Pixel
Pixel type of Image returned by computeImage.
Flux flux
Measured flux in DN.
PsfFluxAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
void setValue(afw::table::BaseRecord &record, int i, bool value) const
FluxResultKey _fluxResultKey
A FunctorKey for FluxResult.
boost::shared_ptr< lsst::afw::detection::Psf > getPsf()
Return the Exposure's Psf object.
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
#define LSST_EXCEPT(type,...)
SafeCentroidExtractor _centroidExtractor
lsst::afw::image::VariancePixel VarPixel
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.
void clip(Box2I const &other)
Shrink this to ensure that other.contains(*this).
A polymorphic base class for representing an image's Point Spread Function.
FluxErrElement fluxSigma
1-Sigma error (sqrt of variance) on flux in DN.
A C++ control class to handle PsfFluxAlgorithm's configuration.
static FlagHandler addFields(afw::table::Schema &schema, std::string const &prefix, FlagDefinition const *begin, FlagDefinition const *end)
A reusable result struct for flux measurements.