27 namespace lsst {
namespace meas {
namespace base {
81 schema.
join(name,
"xSigma"),
"1-sigma uncertainty on x position",
"pixel" 84 schema.
join(name,
"ySigma"),
"1-sigma uncertainty on y position",
"pixel" 89 schema.
join(name,
"x_y_Cov"),
"uncertainty covariance in x and y",
"pixel^2" 141 mapper.addMapping(mapper.getInputSchema().find<afw::table::Flag>(
name +
"_flag").key);
144 auto & s = mapper.editOutputSchema();
153 sigma[0] = s.addField<
ErrElement>(s.join(
name,
"raSigma"),
"Uncertainty on RA",
"rad");
154 sigma[1] = s.addField<
ErrElement>(s.join(
name,
"decSigma"),
"Uncertainty on dec",
"rad");
156 "Uncertainty covariance in RA and dec",
"rad^2");
174 for (; inSrc != inputCatalog.
end() && outSrc != outputCatalog.
end(); ++inSrc, ++outSrc) {
179 if (centroidResultKey.getCentroidErr().isValid()) {
185 transform.transpose()).cast<ErrElement>());
196 bool doFootprintCheck,
197 double maxDistFromPeak
198 ) : _doFootprintCheck(doFootprintCheck), _maxDistFromPeak(maxDistFromPeak)
200 _resetKey = schema.
addField<afw::table::Flag>(schema.
join(name,
"flag_resetToPeak"),
201 "set if CentroidChecker reset the centroid");
202 _failureKey = schema.
find<lsst::afw::table::Flag>(schema.
join(name,
"flag")).key;
215 if (!_doFootprintCheck && _maxDistFromPeak < 0.0) {
222 "No Footprint attached to record");
224 if (footprint->getPeaks().empty()) {
227 "Footprint has no peaks; cannot verify centroid." 232 double distsq = (x - footX) * (x - footX) + (y - footY) * (y - footY);
234 ((_maxDistFromPeak > 0) && (distsq > _maxDistFromPeak*_maxDistFromPeak))) {
235 record.
set(_xKey, footX);
236 record.
set(_yKey, footY);
237 record.
set(_failureKey,
true);
238 record.
set(_resetKey,
true);
Centroid const getCentroid() const
Return a Point object containing the measured x and y.
ErrElement ySigma
1-Sigma uncertainty on y (sqrt of variance)
static PointKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
virtual void set(afw::table::BaseRecord &record, CentroidResult const &value) const
Set a CentroidResult in the given record.
UncertaintyEnum
An enum used to specify how much uncertainty information measurement algorithms provide.
AngleUnit constexpr radians
std::string join(std::string const &a, std::string const &b) const
A reusable struct for centroid measurements.
ErrElement xSigma
1-Sigma uncertainty on x (sqrt of variance)
bool isValid() const
Return True if the centroid key is valid.
The full covariance matrix is provided.
std::shared_ptr< Footprint > getFootprint() const
CentroidElement x
x (column) coordinate of the measured position
SchemaItem< T > find(std::string const &name) const
void setCentroid(Centroid const ¢roid)
Set the struct fields from the given Point object.
Key< T > addField(Field< T > const &field, bool doReplace=false)
Field< T >::Value get(Key< T > const &key) const
CentroidChecker(afw::table::Schema &schema, std::string const &name, bool inside=true, double maxDistFromPeak=-1.0)
Check source record for an centroid algorithm called name, noting if the centroid already set by the ...
static CoordKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
afw::table::Key< double > sigma
CentroidResult()
Constructor; initializes everything to NaN.
ErrElement x_y_Cov
x,y term in the uncertainty convariance matrix
static CentroidResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc, UncertaintyEnum uncertainty)
Add the appropriate fields to a Schema, and return a CentroidResultKey that manages them...
bool operator()(afw::table::SourceRecord &record) const
Set the centroid to the first footprint if the centroid is either more than _dist pixels from the foo...
#define LSST_EXCEPT(type,...)
Base::const_iterator const_iterator
SpherePoint pixelToSky(Point2D const &pixel) const
Algorithm provides no uncertainy information at all.
virtual void set(BaseRecord &record, Eigen::Matrix< T, N, N > const &value) const
A FunctorKey for CentroidResult.
virtual void set(BaseRecord &record, SpherePoint const &value) const
void set(Key< T > const &key, U const &value)
CentroidElement y
y (row) coordinate of the measured position
AffineTransform linearizePixelToSky(SpherePoint const &coord, AngleUnit const &skyUnit) const
Eigen::Matrix< ErrElement, 2, 2, Eigen::DontAlign > CentroidCov
afw::geom::Point< CentroidElement, 2 > Centroid
CentroidResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
virtual CentroidResult get(afw::table::BaseRecord const &record) const
Get a CentroidResult from the given record.
CentroidCov const getCentroidErr() const
Return the 2x2 symmetric covariance matrix, with rows and columns ordered (x, y)
void setCentroidErr(CentroidCov const &matrix)
Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x...