24 #include "lsst/afw/table/BaseRecord.h" 26 namespace lsst {
namespace meas {
namespace base {
58 xxSigma = std::sqrt(matrix(0, 0));
59 yySigma = std::sqrt(matrix(1, 1));
60 xySigma = std::sqrt(matrix(2, 2));
76 afw::table::Schema & schema,
77 std::string
const & name,
78 std::string
const & doc,
80 afw::table::CoordinateType coordType
83 r._shape = afw::table::QuadrupoleKey::addFields(
90 std::vector< afw::table::Key<ErrElement> > sigma(3);
91 std::vector< afw::table::Key<ErrElement> > cov;
93 schema.join(name,
"xxSigma"),
"1-sigma uncertainty on xx moment",
94 coordType == afw::table::CoordinateType::PIXEL ?
"pixel^2" :
"rad^2" 97 schema.join(name,
"yySigma"),
"1-sigma uncertainty on yy moment",
98 coordType == afw::table::CoordinateType::PIXEL ?
"pixel^2" :
"rad^2" 101 schema.join(name,
"xySigma"),
"1-sigma uncertainty on xy moment",
102 coordType == afw::table::CoordinateType::PIXEL ?
"pixel^2" :
"rad^2" 107 schema.join(name,
"xx_yy_Cov"),
"uncertainty covariance in xx and yy",
108 coordType == afw::table::CoordinateType::PIXEL ?
"pixel^4" :
"rad^4" 113 schema.join(name,
"xx_xy_Cov"),
"uncertainty covariance in xx and xy",
114 coordType == afw::table::CoordinateType::PIXEL ?
"pixel^4" :
"rad^4" 119 schema.join(name,
"yy_xy_Cov"),
"uncertainty covariance in yy and xy",
120 coordType == afw::table::CoordinateType::PIXEL ?
"pixel^4" :
"rad^4" 124 r._shapeErr = afw::table::CovarianceMatrixKey<ErrElement,3>(sigma, cov);
131 std::vector<std::string> getNameVector() {
132 std::vector<std::string> v;
144 static std::vector<std::string> names = getNameVector();
146 _shapeErr = afw::table::CovarianceMatrixKey<ErrElement,3>(s, names);
147 }
catch (pex::exceptions::NotFoundError &) {}
153 if (_shapeErr.isValid()) {
160 record.set(_shape, value.
getShape());
161 if (_shapeErr.isValid()) {
167 typedef afw::geom::LinearTransform LT;
168 Eigen::Matrix<ShapeElement,3,3,Eigen::DontAlign> m;
169 m << xform[LT::XX]*xform[LT::XX], xform[LT::XY]*xform[LT::XY], 2*xform[LT::XX]*xform[LT::XY],
170 xform[LT::YX]*xform[LT::YX], xform[LT::YY]*xform[LT::YY], 2*xform[LT::YX]*xform[LT::YY],
171 xform[LT::XX]*xform[LT::YX], xform[LT::XY]*xform[LT::YY],
172 xform[LT::XX]*xform[LT::YY] + xform[LT::XY]*xform[LT::YX];
virtual void set(afw::table::BaseRecord &record, ShapeResult const &value) const
Set a ShapeResult in the given record.
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
virtual ShapeResult get(afw::table::BaseRecord const &record) const
Get a ShapeResult from the given record.
Eigen::Matrix< ErrElement, 3, 3, Eigen::DontAlign > ShapeCov
UncertaintyEnum
An enum used to specify how much uncertainty information measurement algorithms provide.
Shape const getShape() const
Return an afw::geom::ellipses object corresponding to xx, yy, xy.
ShapeResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
The full covariance matrix is provided.
ErrElement xySigma
1-Sigma uncertainty on xy (sqrt of variance)
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.
ShapeResult()
Constructor; initializes everything to NaN.
Algorithm provides no uncertainy information at all.
ErrElement yySigma
1-Sigma uncertainty on yy (sqrt of variance)
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)
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.