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)
72 if (footprint->getPeaks().empty()) {
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()->getCentroidSlot().getMeasKey().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()->getCentroidSlot().getFlagKey().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()->getCentroidSlot().getFlagKey().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()->getCentroidSlot().getMeasKey().isValid()) {
154 (boost::format(
"%s requires a shape, but the shape slot is not defined") % _name).str());
163 if (!record.
getTable()->getShapeSlot().getFlagKey().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(),
table::Key< std::string > name
#define LSST_EXCEPT(type,...)
double const getIxy() const
double const getIxx() const
double const getIyy() const
std::shared_ptr< SourceTable const > getTable() const
bool getShapeFlag() const
CentroidSlotDefinition::MeasValue getCentroid() const
bool getCentroidFlag() const
ShapeSlotDefinition::MeasValue getShape() const
std::shared_ptr< Footprint > getFootprint() const
Exception to be thrown when a measurement algorithm experiences a fatal error.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
std::size_t getFailureFlagNumber() const
Get the index of the General Failure flag, if one is defined.
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.