23 #include <pybind11/pybind11.h>
25 #include <pybind11/stl.h>
27 #include "numpy/arrayobject.h"
28 #include "ndarray/pybind11.h"
29 #include "ndarray/converter.h"
38 namespace py = pybind11;
39 using namespace pybind11::literals;
41 using namespace lsst::afw::geom;
42 using namespace ellipses;
45 py::module mod(
"_ellipse",
"Python wrapper for afw _ellipse library");
47 if (_import_array() < 0) {
48 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
53 py::class_<Ellipse, std::shared_ptr<Ellipse>> clsEllipse(mod,
"Ellipse");
68 clsEllipse.def(py::init<BaseCore const &, Point2D const &>(),
"core"_a,
"center"_a =
Point2D());
69 clsEllipse.def(py::init<Ellipse const &>());
70 clsEllipse.def(py::init<Ellipse::Convolution const &>());
72 py::implicitly_convertible<Ellipse::Convolution, Ellipse>();
78 clsEllipse.def(
"getCenter", (
Point2D & (
Ellipse::*)()) & Ellipse::getCenter);
79 clsEllipse.def(
"setCenter", &Ellipse::setCenter);
80 clsEllipse.def(
"setCore", &Ellipse::setCore);
81 clsEllipse.def(
"normalize", &Ellipse::normalize);
82 clsEllipse.def(
"grow", &Ellipse::grow);
84 clsEllipse.def(
"shift", &Ellipse::shift);
85 clsEllipse.def(
"getParameterVector", &Ellipse::getParameterVector);
86 clsEllipse.def(
"setParameterVector", &Ellipse::setParameterVector);
87 clsEllipse.def(
"transform",
93 return self.getGridTransform();
95 clsEllipse.def(
"computeBBox", &Ellipse::computeBBox);
std::shared_ptr< BaseCore const > getCorePtr() const
Return the ellipse core.
PYBIND11_PLUGIN(_cameraPoint)
Transformer transform(AffineTransform const &transform)
Point< double, 2 > Point2D
An ellipse defined by an arbitrary BaseCore and a center point.