24 #ifndef LSST_MEAS_BASE_SdssShape_h_INCLUDED
25 #define LSST_MEAS_BASE_SdssShape_h_INCLUDED
29 #include "lsst/pex/config.h"
30 #include "lsst/afw/image/Exposure.h"
31 #include "lsst/afw/geom/ellipses/Quadrupole.h"
32 #include "lsst/afw/table/aggregates.h"
43 class SdssShapeResult;
52 LSST_CONTROL_FIELD(
background,
double,
"Additional value to add to background");
53 LSST_CONTROL_FIELD(
maxIter,
int,
"Maximum number of iterations");
54 LSST_CONTROL_FIELD(
maxShift,
double,
"Maximum centroid shift, limited to 2-10");
55 LSST_CONTROL_FIELD(
tol1,
float,
"Convergence tolerance for e1,e2");
56 LSST_CONTROL_FIELD(
tol2,
float,
"Convergence tolerance for FWHM");
57 LSST_CONTROL_FIELD(
doMeasurePsf,
bool,
"Whether to also compute the shape of the PSF model");
86 afw::table::Schema & schema,
87 std::string
const & name,
106 virtual SdssShapeResult get(afw::table::BaseRecord
const & record)
const;
109 virtual void set(afw::table::BaseRecord & record,
SdssShapeResult const & value)
const;
112 virtual afw::geom::ellipses::Quadrupole
getPsfShape(afw::table::BaseRecord
const & record)
const;
115 virtual void setPsfShape(afw::table::BaseRecord & record,
116 afw::geom::ellipses::Quadrupole
const & value)
const;
134 afw::table::QuadrupoleKey _psfShapeResult;
135 afw::table::Key<ErrElement> _flux_xx_Cov;
136 afw::table::Key<ErrElement> _flux_yy_Cov;
137 afw::table::Key<ErrElement> _flux_xy_Cov;
186 template <
typename ImageT>
188 ImageT
const & image,
189 afw::geom::Point2D
const & position,
203 template <
typename ImageT>
205 ImageT
const & image,
206 afw::geom::ellipses::Quadrupole
const & shape,
207 afw::geom::Point2D
const & position
211 afw::table::SourceRecord & measRecord,
212 afw::image::Exposure<float>
const & exposure
216 afw::table::SourceRecord & measRecord,
244 std::bitset<SdssShapeAlgorithm::N_FLAGS>
flags;
250 bool getFlag(std::string
const & name)
const {
280 virtual void operator()(afw::table::SourceCatalog
const & inputCatalog,
281 afw::table::BaseCatalog & outputCatalog,
282 afw::image::Wcs
const & wcs,
283 afw::image::Calib
const & calib)
const;
288 afw::table::QuadrupoleKey _outPsfShapeKey;
294 #endif // !LSST_MEAS_BASE_SdssShape_h_INCLUDED
FlagDefinition getDefinition(std::size_t index) const
get a reference to the FlagDefinition with specified index.
bool doMeasurePsf
"Whether to also compute the shape of the PSF model" ;
static Result computeAdaptiveMoments(ImageT const &image, afw::geom::Point2D const &position, bool negative=false, Control const &ctrl=Control())
Compute the adaptive Gaussian-weighted moments of an image.
static FlagDefinitionList const & getFlagDefinitions()
virtual void setPsfShape(afw::table::BaseRecord &record, afw::geom::ellipses::Quadrupole const &value) const
Set a Quadrupole for the Psf at the position of the given record.
static FluxResult computeFixedMomentsFlux(ImageT const &image, afw::geom::ellipses::Quadrupole const &shape, afw::geom::Point2D const &position)
Compute the flux within a fixed Gaussian aperture.
float tol2
"Convergence tolerance for FWHM" ;
FlagHandler const & getFlagHandler() const
static FlagDefinition const SHIFT
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
bool operator!=(SdssShapeResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
A reusable struct for centroid measurements.
double background
"Additional value to add to background" ;
int maxIter
"Maximum number of iterations" ;
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...
Exception to be thrown when a measurement algorithm experiences a known failure mode.
static FlagDefinition const UNWEIGHTED
float tol1
"Convergence tolerance for e1,e2" ;
static FlagDefinition const UNWEIGHTED_BAD
double maxShift
"Maximum centroid shift, limited to 2-10" ;
bool isValid() const
Return True if the key is valid.
ErrElement flux_yy_Cov
flux, yy term in the uncertainty covariance matrix
bool operator==(SdssShapeResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
A FunctorKey for ShapeResult.
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
Called to measure a single child source in an image.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
A reusable struct for moments-based shape measurements.
static unsigned int const N_FLAGS
Result object SdssShapeAlgorithm.
bool getFlag(std::string const &name) const
SdssShapeResult()
Constructor; initializes everything to NaN.
SdssShapeAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
virtual afw::geom::ellipses::Quadrupole getPsfShape(afw::table::BaseRecord const &record) const
Get a Quadrupole for the Psf from the given record.
A C++ control class to handle SdssShapeAlgorithm's configuration.
A FunctorKey for FluxResult.
virtual void set(afw::table::BaseRecord &record, SdssShapeResult const &value) const
Set an SdssShapeResult in the given record.
std::bitset< SdssShapeAlgorithm::N_FLAGS > flags
Status flags (see SdssShapeAlgorithm).
bool getFlag(unsigned int index) const
Flag getter for Swig, which doesn't understand std::bitset.
An abstract base classes for which the same implementation can be used for both SingleFrameAlgorithm ...
static FlagDefinition const MAXITER
static FlagDefinition const PSF_SHAPE_BAD
A FunctorKey that maps SdssShapeResult to afw::table Records.
static FlagDefinition const FAILURE
SdssShapeResultKey ResultKey
A FunctorKey for CentroidResult.
Measure the image moments of source using adaptive Gaussian weights.
SdssShapeResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
vector-type utility class to build a collection of FlagDefinitions
ErrElement flux_xx_Cov
flux, xx term in the uncertainty covariance matrix
static SdssShapeResultKey addFields(afw::table::Schema &schema, std::string const &name, bool doMeasurePsf)
Add the appropriate fields to a Schema, and return a SdssShapeResultKey that manages them...
A reusable result struct for flux measurements.
ErrElement flux_xy_Cov
flux, xy term in the uncertainty covariance matrix