37 : _name(name), _isCentroider(isCentroider) {
45 if (slotFlagName != schema.
join(name,
"flag")) {
47 schema.
getAliasMap()->set(schema.
join(name,
"flag",
"badInitialCentroid"), slotFlagName);
50 if (aliasedFlagName == slotFlagName) {
53 (
boost::format(
"Alias for '%s' must be defined before initializing '%s' plugin.") %
54 aliasedFlagName % name)
57 schema.
getAliasMap()->set(schema.
join(name,
"flag",
"badCentroid"), slotFlagName);
69 (
boost::format(
"%s: Centroid slot value is NaN, but no Footprint attached to record") % name)
75 (
boost::format(
"%s: Centroid slot value is NaN, but Footprint has no Peaks") % name).
str());
77 result.setX(
footprint->getPeaks().front().getFx());
78 result.setY(
footprint->getPeaks().front().getFy());
86 if (!record.
getTable()->getCentroidKey().isValid()) {
88 return extractPeak(record, _name);
92 (
boost::format(
"%s requires a centroid, but the centroid slot is not defined") % _name)
98 if (!record.
getTable()->getCentroidFlagKey().isValid()) {
100 return extractPeak(record, _name);
105 "%s: Centroid slot value is NaN, but there is no Centroid slot flag " 106 "(is the executionOrder for %s lower than that of the slot Centroid?)") %
114 (
boost::format(
"%s: Centroid slot value is NaN, but the Centroid slot flag is not set " 115 "(is the executionOrder for %s lower than that of the slot Centroid?)") %
119 result = extractPeak(record, _name);
120 if (!_isCentroider) {
124 }
else if (!_isCentroider && record.
getTable()->getCentroidFlagKey().isValid() &&
140 if (aliasedFlagName == slotFlagName) {
142 (
boost::format(
"Alias for '%s' must be defined before initializing '%s' plugin.") %
143 aliasedFlagName % name)
146 schema.
getAliasMap()->set(schema.
join(name,
"flag",
"badShape"), slotFlagName);
151 if (!record.
getTable()->getShapeKey().isValid()) {
154 (
boost::format(
"%s requires a shape, but the shape slot is not defined") % _name).
str());
163 if (!record.
getTable()->getShapeFlagKey().isValid()) {
166 (
boost::format(
"%s: Shape slot value is NaN, but there is no Shape slot flag " 167 "(is the executionOrder for %s lower than that of the slot Shape?)") %
174 (
boost::format(
"%s: Shape slot value is NaN, but the Shape slot flag is not set " 175 "(is the executionOrder for %s lower than that of the slot Shape?)") %
181 (
boost::format(
"%s: Shape needed, and Shape slot measurement failed.") % _name).
str(),
An ellipse core with quadrupole moments as parameters.
Defines the fields and offsets for a table.
ShapeSlotDefinition::MeasValue getShape() const
Get the value of the Shape slot measurement.
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
bool getShapeFlag() const
Return true if the measurement in the Shape slot failed.
std::shared_ptr< Footprint > getFootprint() const
void setValue(afw::table::BaseRecord &record, std::size_t i, bool value) const
Set the flag field corresponding to the given flag index.
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Exception to be thrown when a measurement algorithm experiences a fatal error.
std::size_t getFailureFlagNumber() const
Get the index of the General Failure flag, if one is defined.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
double const getIxy() const
double const getIyy() const
A base class for image defects.
std::shared_ptr< SourceTable const > getTable() const
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
bool getCentroidFlag() const
Return true if the measurement in the Centroid slot failed.
Reports errors in the logical structure of the program.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
std::shared_ptr< AliasMap > getAliasMap() const
Return the map of aliases.
Record class that contains measurements made on a single exposure.
double const getIxx() const
CentroidSlotDefinition::MeasValue getCentroid() const
Get the value of the Centroid slot measurement.
Reports errors that are due to events beyond the control of the program.