24 #ifndef LSST_MEAS_BASE_ShapeUtilities_h_INCLUDED
25 #define LSST_MEAS_BASE_ShapeUtilities_h_INCLUDED
28 #include "lsst/afw/table/aggregates.h"
30 namespace lsst {
namespace meas {
namespace base {
59 xxSigma(std::sqrt(matrix(0, 0))),
60 yySigma(std::sqrt(matrix(1, 1))),
61 xySigma(std::sqrt(matrix(2, 2))),
92 return afw::geom::ellipses::Quadrupole(
xx,
yy,
xy);
130 afw::table::Schema & schema,
131 std::string
const & name,
132 std::string
const & doc,
134 afw::table::CoordinateType coordType=afw::table::CoordinateType::PIXEL
142 afw::table::QuadrupoleKey
const & shape,
143 afw::table::CovarianceMatrixKey<ErrElement,3>
const & shapeErr
145 _shape(shape), _shapeErr(shapeErr)
160 virtual ShapeResult get(afw::table::BaseRecord
const & record)
const;
163 virtual void set(afw::table::BaseRecord & record,
ShapeResult const & value)
const;
168 return _shape == other._shape && _shapeErr == other._shapeErr;
174 bool isValid()
const {
return _shape.isValid() && _shapeErr.isValid(); }
177 afw::table::QuadrupoleKey
getShape()
const {
return _shape; }
180 afw::table::CovarianceMatrixKey<ErrElement,3>
getShapeErr()
const {
return _shapeErr; }
183 afw::table::Key<ShapeElement>
getIxx()
const {
return _shape.getIxx(); }
186 afw::table::Key<ShapeElement>
getIyy()
const {
return _shape.getIyy(); }
189 afw::table::Key<ShapeElement>
getIxy()
const {
return _shape.getIxy(); }
192 afw::table::QuadrupoleKey _shape;
193 afw::table::CovarianceMatrixKey<ErrElement,3> _shapeErr;
220 #endif // !LSST_MEAS_BASE_ShapeUtilities_h_INCLUDED
afw::table::Key< ShapeElement > getIxx() const
Return a Key for the xx moment.
ShapeResultKey(afw::table::QuadrupoleKey const &shape, afw::table::CovarianceMatrixKey< ErrElement, 3 > const &shapeErr)
Construct from a pair of Keys.
ShapeTrMatrix makeShapeTransformMatrix(afw::geom::LinearTransform const &xform)
Construct a matrix suitable for transforming second moments.
ErrElement yy_xy_Cov
yy,xy term in the uncertainty convariance matrix
Eigen::Matrix< ErrElement, 3, 3, Eigen::DontAlign > ShapeCov
afw::table::CovarianceMatrixKey< ErrElement, 3 > getShapeErr() const
Return a FunctorKey to just the uncertainty matrix.
UncertaintyEnum
An enum used to specify how much uncertainty information measurement algorithms provide.
afw::table::Key< ShapeElement > getIyy() const
Return a Key for the yy moment.
ShapeResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
afw::geom::ellipses::Quadrupole getQuadrupole()
ErrElement xySigma
1-Sigma uncertainty on xy (sqrt of variance)
Shape const getShape() const
Return an afw::geom::ellipses object corresponding to xx, yy, xy.
A FunctorKey for ShapeResult.
ErrElement xx_xy_Cov
xx,xy term in the uncertainty convariance matrix
void setShapeErr(ShapeCov const &matrix)
Set the struct uncertainty elements from the given matrix, with rows and columns ordered (xx...
ErrElement xx_yy_Cov
xx,yy term in the uncertainty convariance matrix
afw::geom::ellipses::Quadrupole Shape
A reusable struct for moments-based shape measurements.
virtual void set(afw::table::BaseRecord &record, ShapeResult const &value) const
Set a ShapeResult in the given record.
bool operator!=(ShapeResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
ShapeResult()
Constructor; initializes everything to NaN.
bool isValid() const
Return True if the shape key is valid.
ShapeResult(ShapeElement xx_, ShapeElement yy_, ShapeElement xy_, ShapeCov const &matrix)
Constructor; initializes everything from values.
afw::table::QuadrupoleKey getShape() const
Return a FunctorKey to just the shape value.
ShapeResult(ShapeElement xx_, ShapeElement yy_, ShapeElement xy_, ErrElement xxSigma_, ErrElement yySigma_, ErrElement xySigma_)
Constructor; initializes everything from values.
ErrElement yySigma
1-Sigma uncertainty on yy (sqrt of variance)
bool operator==(ShapeResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
ErrElement xxSigma
1-Sigma uncertainty on xx (sqrt of variance)
void setShape(Shape const &shape)
Set struct elements from the given Quadrupole object.
Eigen::Matrix< ShapeElement, 3, 3, Eigen::DontAlign > ShapeTrMatrix
ShapeCov const getShapeErr() const
Return the 3x3 symmetric covariance matrix, with rows and columns ordered (xx, yy, xy)
afw::table::Key< ShapeElement > getIxy() const
Return a Key for the xy moment.
static ShapeResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc, UncertaintyEnum uncertainty, afw::table::CoordinateType coordType=afw::table::CoordinateType::PIXEL)
Add the appropriate fields to a Schema, and return a ShapeResultKey that manages them.