23 #include "pybind11/pybind11.h"
24 #include "pybind11/eigen.h"
28 #include "ndarray/pybind11.h"
34 using namespace pybind11::literals;
42 using PyShapeResult = py::class_<ShapeResult, std::shared_ptr<ShapeResult>>;
43 using PyShapeResultKey = py::class_<ShapeResultKey, std::shared_ptr<ShapeResultKey>>;
46 PyShapeResult
cls(mod,
"ShapeResult");
48 cls.def(py::init<>());
49 cls.def(py::init<ShapeElement, ShapeElement, ShapeElement, ShapeCov const &>(),
"xx"_a,
"yy"_a,
"xy"_a,
51 cls.def(py::init<ShapeElement, ShapeElement, ShapeElement, ErrElement, ErrElement, ErrElement>(),
"xx"_a,
52 "yy"_a,
"xy"_a,
"xxErr"_a,
"yyErr"_a,
"xyErr"_a);
54 cls.def(
"getShape", &ShapeResult::getShape);
55 cls.def(
"getQuadrupole", &ShapeResult::getQuadrupole);
56 cls.def(
"setShape", &ShapeResult::setShape,
"shape"_a);
57 cls.def(
"getShapeErr", &ShapeResult::getShapeErr);
58 cls.def(
"setShapeErr", (
void (ShapeResult::*)(
ShapeCov const &)) & ShapeResult::setShapeErr,
"matrix"_a);
59 cls.def(
"setShapeErr",
61 "xxErr"_a,
"yyErr"_a,
"xyErr"_a);
63 cls.def_readwrite(
"xx", &ShapeResult::xx);
64 cls.def_readwrite(
"yy", &ShapeResult::yy);
65 cls.def_readwrite(
"xy", &ShapeResult::xy);
66 cls.def_readwrite(
"xxErr", &ShapeResult::xxErr);
67 cls.def_readwrite(
"yyErr", &ShapeResult::yyErr);
68 cls.def_readwrite(
"xyErr", &ShapeResult::xyErr);
69 cls.def_readwrite(
"xx_yy_Cov", &ShapeResult::xx_yy_Cov);
70 cls.def_readwrite(
"xx_xy_Cov", &ShapeResult::xx_xy_Cov);
71 cls.def_readwrite(
"yy_xy_Cov", &ShapeResult::yy_xy_Cov);
75 PyShapeResultKey
cls(mod,
"ShapeResultKey");
77 cls.def_static(
"addFields", &ShapeResultKey::addFields,
"schema"_a,
"name"_a,
"doc"_a,
"uncertainty"_a,
78 "coordType"_a = afw::table::CoordinateType::PIXEL);
80 cls.def(py::init<>());
82 afw::table::CovarianceMatrixKey<ErrElement, 3>
const &>(),
83 "shape"_a,
"shapeErr"_a);
84 cls.def(py::init<afw::table::SubSchema const &>(),
"subSchema"_a);
86 cls.def(
"__eq__", &ShapeResultKey::operator==, py::is_operator());
87 cls.def(
"__ne__", &ShapeResultKey::operator!=, py::is_operator());
89 cls.def(
"get", &ShapeResultKey::get,
"record"_a);
92 cls.def(
"getShape", &ShapeResultKey::getShape);
93 cls.def(
"getShapeErr", &ShapeResultKey::getShapeErr);
94 cls.def(
"getIxx", &ShapeResultKey::getIxx);
95 cls.def(
"getIyy", &ShapeResultKey::getIyy);
96 cls.def(
"getIxy", &ShapeResultKey::getIxy);
102 py::module::import(
"lsst.afw.table");
104 declareShapeResult(mod);
105 declareShapeResultKey(mod);