23 #include <pybind11/pybind11.h> 24 #include <pybind11/operators.h> 25 #include <pybind11/stl.h> 27 #include "numpy/arrayobject.h" 28 #include "ndarray/pybind11.h" 29 #include "ndarray/converter.h" 31 #include "lsst/pex/config/python.h" 38 namespace py = pybind11;
42 using ClsField = py::class_<ChebyshevBoundedField, std::shared_ptr<ChebyshevBoundedField>,
45 template <
typename PixelT>
53 py::module mod(
"_chebyshevBoundedField",
"Python wrapper for afw _chebyshevBoundedField library");
55 if (_import_array() < 0) {
56 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
61 py::class_<ChebyshevBoundedFieldControl> clsChebyshevBoundedFieldControl(mod,
62 "ChebyshevBoundedFieldControl");
63 ClsField clsChebyshevBoundedField(mod,
"ChebyshevBoundedField");
69 clsChebyshevBoundedFieldControl.def(py::init<>());
70 clsChebyshevBoundedField.def(
84 clsChebyshevBoundedField.def_static(
85 "fit", (std::shared_ptr<ChebyshevBoundedField>(*)(
87 ndarray::Array<double const, 1>
const &, ndarray::Array<double const, 1>
const &,
90 clsChebyshevBoundedField.def_static(
91 "fit", (std::shared_ptr<ChebyshevBoundedField>(*)(
93 ndarray::Array<double const, 1>
const &, ndarray::Array<double const, 1>
const &,
94 ndarray::Array<double const, 1>
const &, Control
const &)) &
95 ChebyshevBoundedField::fit);
100 declareTemplates<double>(clsChebyshevBoundedField);
101 declareTemplates<float>(clsChebyshevBoundedField);
A control object used when fitting ChebyshevBoundedField to data (see ChebyshevBoundedField::fit) ...
ndarray::Array< double const, 2, 2 > getCoefficients() const
Return the coefficient matrix.
std::shared_ptr< ChebyshevBoundedField > truncate(Control const &ctrl) const
Return a new ChebyshevBoudedField with maximum orders set by the given control object.
An integer coordinate rectangle.
int computeSize() const
Return the number of nonzero coefficients in the Chebyshev function defined by this object...
An abstract base class for 2-d functions defined on an integer bounding boxes.
py::class_< ChebyshevBoundedField, std::shared_ptr< ChebyshevBoundedField >, BoundedField > ClsField
static std::shared_ptr< ChebyshevBoundedField > fit(afw::geom::Box2I const &bbox, ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y, ndarray::Array< double const, 1 > const &z, Control const &ctrl)
Fit a Chebyshev approximation to non-gridded data with equal weights.
A class to represent a 2-dimensional array of pixels.
PYBIND11_PLUGIN(_approximate)
void declareTemplates(ClsField &cls)