Class SafeShapeExtractor¶
Defined in File InputUtilities.h
Class Documentation¶
-
class
SafeShapeExtractor
¶ Utility class for measurement algorithms that extracts an ellipse from the Shape slot and handles errors in a safe and consistent way.
Public Functions
-
SafeShapeExtractor
(afw::table::Schema &schema, std::string const &name)¶ Construct the extractor, creating a flag alias that indicates failure in the input centroid by linking to the slot shape flag.
- Parameters
[out] schema
: Schema to which the alias should be added. The “slot_Shape” alias must already be present in the Schema’s AliasMap.[in] name
: The name of the algorithm; the flag alias added will be “<name>_flag_badShape”.
-
afw::geom::ellipses::Quadrupole
operator()
(afw::table::SourceRecord &record, FlagHandler const &flags) const¶ Extract a shape from the given record.
We use the Shape slot if it is not NaN, and throw MeasurementError if it is (with only the general failure code attached to the MeasurementError).
If the Shape slot is not defined, we throw FatalAlgorithmError, as this indicates a configuration problem.
If the Shape slot value is NaN and is not flagged (or there is no Shape slot flag), we throw RuntimeError, which should cause the measurement framework to log a warning and set the current algorithm’s general failure flag if it is allowed to propagate out of the algorithm implementation.
If the Shape slot is flagged and we nevertheless obtain a usable ellipse, we set the current algorithm’s general failure flag, but return the ellipse as well, allowing it to continue while indicating that the result may not be reliable. A singular ellipse (i.e. one with a non-positive quadrupole matrix determinant) is treated the same as a NaN ellipse; it is not considered usable.
-