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()->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(),
ShapeSlotDefinition::MeasValue getShape() const
std::string const & _name
std::string join(std::string const &a, std::string const &b) const
bool getShapeFlag() const
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
std::shared_ptr< SourceTable const > getTable() const
bool getCentroidFlag() const
std::unique_ptr< SchemaItem< U > > result
#define LSST_EXCEPT(type,...)
std::shared_ptr< AliasMap > getAliasMap() const
double const getIxx() const
CentroidSlotDefinition::MeasValue getCentroid() const