24 #ifndef LSST_MEAS_BASE_CentroidUtilities_h_INCLUDED
25 #define LSST_MEAS_BASE_CentroidUtilities_h_INCLUDED
28 #include "lsst/afw/table/aggregates.h"
31 namespace lsst {
namespace meas {
namespace base {
50 xSigma(std::sqrt(matrix(0, 0))),
51 ySigma(std::sqrt(matrix(1, 1))),
74 return afw::geom::Point<CentroidElement>(
x,
y);
109 afw::table::Schema & schema,
110 std::string
const & name,
111 std::string
const & doc,
120 afw::table::PointKey<CentroidElement>
const & centroid,
121 afw::table::CovarianceMatrixKey<ErrElement,2>
const & centroidErr
123 _centroid(centroid), _centroidErr(centroidErr)
138 virtual CentroidResult get(afw::table::BaseRecord
const & record)
const;
141 virtual void set(afw::table::BaseRecord & record,
CentroidResult const & value)
const;
146 return _centroid == other._centroid && _centroidErr == other._centroidErr;
152 bool isValid()
const {
return _centroid.isValid() && _centroidErr.isValid(); }
155 afw::table::PointKey<CentroidElement>
getCentroid()
const {
return _centroid; }
158 afw::table::CovarianceMatrixKey<ErrElement,2>
getCentroidErr()
const {
return _centroidErr; }
161 afw::table::Key<CentroidElement>
getX()
const {
return _centroid.getX(); }
164 afw::table::Key<CentroidElement>
getY()
const {
return _centroid.getY(); }
167 afw::table::PointKey<CentroidElement> _centroid;
168 afw::table::CovarianceMatrixKey<ErrElement,2> _centroidErr;
195 virtual void operator()(afw::table::SourceCatalog
const & inputCatalog,
196 afw::table::BaseCatalog & outputCatalog,
197 afw::image::Wcs
const & wcs,
198 afw::image::Calib
const & calib)
const;
200 afw::table::CoordKey _coordKey;
201 afw::table::CovarianceMatrixKey<ErrElement,2> _coordErrKey;
223 CentroidChecker(afw::table::Schema & schema, std::string
const & name,
bool inside=
true,
double maxDistFromPeak=-1.0);
230 afw::table::SourceRecord & record
234 bool _doFootprintCheck;
235 double _maxDistFromPeak;
236 afw::table::Key<afw::table::Flag> _resetKey;
237 afw::table::Key<afw::table::Flag> _failureKey;
238 afw::table::Key<CentroidElement> _xKey;
239 afw::table::Key<CentroidElement> _yKey;
243 #endif // !LSST_MEAS_BASE_CentroidUtilities_h_INCLUDED
bool operator!=(CentroidResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
ErrElement ySigma
1-Sigma uncertainty on y (sqrt of variance)
UncertaintyEnum
An enum used to specify how much uncertainty information measurement algorithms provide.
afw::table::Key< CentroidElement > getY() const
Return a Key for the y coordinate.
A reusable struct for centroid measurements.
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...
Centroid const getCentroid() const
Return a Point object containing the measured x and y.
ErrElement xSigma
1-Sigma uncertainty on x (sqrt of variance)
CentroidResult(CentroidElement x_, CentroidElement y_, CentroidCov const &matrix)
Constructor; initializes everything from values.
CentroidElement x
x (column) coordinate of the measured position
bool isValid() const
Return True if the centroid key is valid.
void setCentroid(Centroid const ¢roid)
Set the struct fields from the given Point object.
afw::table::CovarianceMatrixKey< ErrElement, 2 > getCentroidErr() const
Return a FunctorKey to just the uncertainty matrix.
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 ...
CentroidResultKey(afw::table::PointKey< CentroidElement > const ¢roid, afw::table::CovarianceMatrixKey< ErrElement, 2 > const ¢roidErr)
Construct from a pair of Keys.
CentroidResult(CentroidElement x_, CentroidElement y_, ErrElement xSigma_, ErrElement ySigma_)
Constructor; initializes everything from values.
CentroidResult()
Constructor; initializes everything to NaN.
afw::geom::Point< CentroidElement > getPoint()
Return the 2D point type corresponding to this result.
ErrElement x_y_Cov
x,y term in the uncertainty convariance matrix
afw::table::Key< CentroidElement > getX() const
Return a Key for the x coordinate.
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...
virtual void set(afw::table::BaseRecord &record, CentroidResult const &value) const
Set a CentroidResult in the given record.
afw::table::PointKey< CentroidElement > getCentroid() const
Return a FunctorKey to just the centroid value.
CentroidCov const getCentroidErr() const
Return the 2x2 symmetric covariance matrix, with rows and columns ordered (x, y)
A FunctorKey for CentroidResult.
CentroidElement y
y (row) coordinate of the measured position
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.
bool operator==(CentroidResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
void setCentroidErr(CentroidCov const &matrix)
Set the struct uncertainty fields from the given matrix, with rows and columns ordered (x...