31 namespace lsst {
namespace meas {
namespace base {
35 std::string
const &
name,
39 _isCentroider(isCentroider)
45 std::string aliasedFlagName = schema.
join(
"slot",
"Centroid",
"flag");
46 std::string slotFlagName = schema.
getAliasMap()->apply(aliasedFlagName);
48 if (slotFlagName != schema.
join(name,
"flag")) {
50 schema.
getAliasMap()->set(schema.
join(name,
"flag",
"badInitialCentroid"), slotFlagName);
53 if (aliasedFlagName == slotFlagName) {
55 pex::exceptions::LogicError,
56 (
boost::format(
"Alias for '%s' must be defined before initializing '%s' plugin.")
57 % aliasedFlagName % name).str()
60 schema.
getAliasMap()->set(schema.
join(name,
"flag",
"badCentroid"), slotFlagName);
71 pex::exceptions::RuntimeError,
72 (
boost::format(
"%s: Centroid slot value is NaN, but no Footprint attached to record")
76 if (footprint->getPeaks().empty()) {
78 pex::exceptions::RuntimeError,
79 (
boost::format(
"%s: Centroid slot value is NaN, but Footprint has no Peaks")
83 result.setX(footprint->getPeaks().front().getFx());
84 result.setY(footprint->getPeaks().front().getFy());
94 if (!record.
getTable()->getCentroidKey().isValid()) {
96 return extractPeak(record,
_name);
100 (
boost::format(
"%s requires a centroid, but the centroid slot is not defined") %
_name).str()
105 if (std::isnan(result.getX()) || std::isnan(result.getY())) {
106 if (!record.
getTable()->getCentroidFlagKey().isValid()) {
108 return extractPeak(record,
_name);
111 pex::exceptions::RuntimeError,
112 (
boost::format(
"%s: Centroid slot value is NaN, but there is no Centroid slot flag "
113 "(is the executionOrder for %s lower than that of the slot Centroid?)")
120 pex::exceptions::RuntimeError,
121 (
boost::format(
"%s: Centroid slot value is NaN, but the Centroid slot flag is not set "
122 "(is the executionOrder for %s lower than that of the slot Centroid?)")
126 result = extractPeak(record,
_name);
147 std::string aliasedFlagName = schema.
join(
"slot",
"Shape",
"flag");
148 std::string slotFlagName = schema.
getAliasMap()->apply(aliasedFlagName);
149 if (aliasedFlagName == slotFlagName) {
151 pex::exceptions::LogicError,
152 (
boost::format(
"Alias for '%s' must be defined before initializing '%s' plugin.")
153 % aliasedFlagName % name).str()
156 schema.
getAliasMap()->set(schema.
join(name,
"flag",
"badShape"), slotFlagName);
163 if (!record.
getTable()->getShapeKey().isValid()) {
166 (
boost::format(
"%s requires a shape, but the shape slot is not defined") %
_name).str()
170 if (std::isnan(result.
getIxx()) || std::isnan(result.
getIyy()) || std::isnan(result.
getIxy())
177 if (!record.
getTable()->getShapeFlagKey().isValid()) {
179 pex::exceptions::RuntimeError,
180 (
boost::format(
"%s: Shape slot value is NaN, but there is no Shape slot flag "
181 "(is the executionOrder for %s lower than that of the slot Shape?)")
187 pex::exceptions::RuntimeError,
188 (
boost::format(
"%s: Shape slot value is NaN, but the Shape slot flag is not set "
189 "(is the executionOrder for %s lower than that of the slot Shape?)")
195 (
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.
table::Key< std::string > name
CentroidSlotDefinition::MeasValue getCentroid() const
Get the value of the Centroid slot measurement.
std::string const & _name
afw::table::Schema schema
bool getCentroidFlag() const
Return true if the measurement in the Centroid slot failed.
double const getIyy() const
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
Exception to be thrown when a measurement algorithm experiences a known failure mode.
A coordinate class intended to represent absolute positions.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
if(width!=gim.getWidth()||height!=gim.getHeight()||x0!=gim.getX0()||y0!=gim.getY0())
void setValue(afw::table::BaseRecord &record, std::size_t i, bool value) const
Set the flag field corresponding to the given enum value.
double const getIxy() const
double const getIxx() const
boost::shared_ptr< AliasMap > getAliasMap() const
Return the map of aliases.
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
boost::shared_ptr< SourceTable const > getTable() const
bool getShapeFlag() const
Return true if the measurement in the Shape slot failed.
Record class that contains measurements made on a single exposure.
ShapeSlotDefinition::MeasValue getShape() const
Get the value of the Shape slot measurement.