38FlagDefinitionList flagDefinitions;
43 flagDefinitions.add(
"flag_noGoodPixels",
"no good pixels in the annulus");
51 _resultKey(
FluxResultKey::addFields(schema, name,
"background in annulus around source")),
52 _flagHandler(
FlagHandler::addFields(schema, name, getFlagDefinitions())),
53 _centroidExtractor(schema, name),
66 auto const psf = exposure.getPsf();
72 float const psfSigma = psf->computeShape(center).getDeterminantRadius();
82 auto const&
annulus =
outer->clippedTo(image.getBBox())->intersectNot(*inner);
83 auto const&
imageValues =
annulus->flatten(image.getImage()->getArray(), image.getXY0());
84 auto const&
maskValues =
annulus->flatten(image.getMask()->getArray(), image.getXY0());
99 if (values.
size() == 0) {
121 if (
mapper.getInputSchema().getNames().count(
mapper.getInputSchema().join(name, flag.
name)) == 0)
124 mapper.getInputSchema().find<afw::table::Flag>(name +
"_" + flag.
name).key;
#define LSST_EXCEPT(type,...)
static std::shared_ptr< geom::SpanSet > fromShape(int r, Stencil s=Stencil::CIRCLE, lsst::geom::Point2I offset=lsst::geom::Point2I())
vector-type utility class to build a collection of FlagDefinitions
Utility class for handling flag fields that indicate the failure modes of an algorithm.
void handleFailure(afw::table::BaseRecord &record, MeasurementError const *error=nullptr) const
Handle an expected or unexpected Exception thrown by a measurement algorithm.
void setValue(afw::table::BaseRecord &record, std::size_t i, bool value) const
Set the flag field corresponding to the given flag index.
A FunctorKey for FluxResult.
LocalBackgroundAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema, std::string const &logName="")
static FlagDefinition const FAILURE
static FlagDefinition const NO_PSF
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
Called to measure a single child source in an image.
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=nullptr) const
Handle an exception thrown by the current algorithm by setting flags in the given record.
static FlagDefinitionList const & getFlagDefinitions()
static FlagDefinition const NO_GOOD_PIXELS
Configuration of LocalBackgroundAlgorithm.
std::vector< std::string > badMaskPlanes
"Mask planes that indicate pixels that should be excluded from the measurement" ;
float annulusInner
"Inner radius for background annulus as a multiple of the PSF sigma" ;
float annulusOuter
"Outer radius for background annulus as a multiple of the PSF sigma" ;
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
A reusable result struct for instFlux measurements.