74 "1-sigma uncertainty on x position",
"pixel");
76 "1-sigma uncertainty on y position",
"pixel");
79 "uncertainty covariance in x and y",
"pixel^2"));
127 auto &s =
mapper.editOutputSchema();
136 sigma[0] = s.addField<
ErrElement>(s.join(
name,
"raSigma"),
"Uncertainty on RA",
"rad");
137 sigma[1] = s.addField<
ErrElement>(s.join(
name,
"decSigma"),
"Uncertainty on dec",
"rad");
138 cov[0] = s.addField<
ErrElement>(s.join(
name,
"ra_dec_Cov"),
"Uncertainty covariance in RA and dec",
153 for (; inSrc != inputCatalog.
end() && outSrc != outputCatalog.
end(); ++inSrc, ++outSrc) {
158 if (centroidResultKey.getCentroidErr().isValid()) {
166 .cast<ErrElement>());
175 double maxDistFromPeak)
176 : _doFootprintCheck(doFootprintCheck), _maxDistFromPeak(maxDistFromPeak) {
177 _resetKey = schema.
addField<afw::table::Flag>(schema.
join(name,
"flag_resetToPeak"),
178 "set if CentroidChecker reset the centroid");
179 _failureKey = schema.
find<afw::table::Flag>(schema.
join(name,
"flag")).
key;
190 if (!_doFootprintCheck && _maxDistFromPeak < 0.0) {
197 if (footprint->getPeaks().empty()) {
202 double distsq = (x - footX) * (x - footX) + (y - footY) * (y - footY);
204 ((_maxDistFromPeak > 0) && (distsq > _maxDistFromPeak * _maxDistFromPeak))) {
205 record.
set(_xKey, footX);
206 record.
set(_yKey, footY);
207 record.
set(_failureKey,
true);
208 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)
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.
lsst::geom::SpherePoint pixelToSky(lsst::geom::Point2D const &pixel) const
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
static PointKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
CentroidElement x
x (column) coordinate of the measured position
void setCentroid(Centroid const ¢roid)
Set the struct fields from the given Point object.
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 ...
AngleUnit constexpr radians
afw::table::Key< double > sigma
virtual void set(BaseRecord &record, Eigen::Matrix< T, N, N > const &value) const
CentroidResult()
Constructor; initializes everything to NaN.
Eigen::Matrix< ErrElement, 2, 2, Eigen::DontAlign > CentroidCov
SchemaItem< T > find(std::string const &name) const
ErrElement x_y_Cov
x,y term in the uncertainty convariance matrix
virtual void set(BaseRecord &record, lsst::geom::SpherePoint const &value) const
lsst::geom::AffineTransform linearizePixelToSky(lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const
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...
geom::Point< CentroidElement, 2 > Centroid
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
Algorithm provides no uncertainy information at all.
static CoordKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
A FunctorKey for CentroidResult.
void set(Key< T > const &key, U const &value)
CentroidElement y
y (row) coordinate of the measured position
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)
bool isValid() const noexcept
Key< T > addField(Field< T > const &field, bool doReplace=false)
CatalogIterator< typename Internal::iterator > iterator
void setCentroidErr(CentroidCov const &matrix)
Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x...