22 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
27 #include "ndarray/pybind11.h"
34 using namespace pybind11::literals;
42 static void declarePolynomialTransform(
py::module &mod) {
43 py::class_<PolynomialTransform, std::shared_ptr<PolynomialTransform>> cls(mod,
"PolynomialTransform");
45 cls.def(py::init<ndarray::Array<double const, 2, 0>
const &,
46 ndarray::Array<double const, 2, 0>
const &>(),
47 "xCoeffs"_a,
"yCoeffs"_a);
48 cls.def(py::init<PolynomialTransform const &>(),
"other"_a);
50 cls.def_static(
"convert",
51 (PolynomialTransform(*)(ScaledPolynomialTransform
const &)) & PolynomialTransform::convert,
53 cls.def_static(
"convert",
54 (PolynomialTransform(*)(SipForwardTransform
const &)) & PolynomialTransform::convert,
56 cls.def_static(
"convert",
57 (PolynomialTransform(*)(SipReverseTransform
const &)) & PolynomialTransform::convert,
60 cls.def(
"__call__", &PolynomialTransform::operator(),
"in"_a);
62 cls.def(
"getOrder", &PolynomialTransform::getOrder);
63 cls.def(
"getXCoeffs", &PolynomialTransform::getXCoeffs);
64 cls.def(
"getYCoeffs", &PolynomialTransform::getYCoeffs);
65 cls.def(
"linearize", &PolynomialTransform::linearize);
68 static void declareScaledPolynomialTransform(
py::module &mod) {
69 py::class_<ScaledPolynomialTransform, std::shared_ptr<ScaledPolynomialTransform>> cls(
70 mod,
"ScaledPolynomialTransform");
74 "poly"_a,
"inputScaling"_a,
"outputScalingInverse"_a);
75 cls.def(py::init<ScaledPolynomialTransform const &>(),
"other"_a);
79 (ScaledPolynomialTransform(*)(PolynomialTransform
const &)) & ScaledPolynomialTransform::convert,
83 (ScaledPolynomialTransform(*)(SipForwardTransform
const &)) & ScaledPolynomialTransform::convert,
87 (ScaledPolynomialTransform(*)(SipReverseTransform
const &)) & ScaledPolynomialTransform::convert,
90 cls.def(
"__call__", &ScaledPolynomialTransform::operator(),
"in"_a);
92 cls.def(
"getPoly", &ScaledPolynomialTransform::getPoly, py::return_value_policy::reference_internal);
93 cls.def(
"getInputScaling", &ScaledPolynomialTransform::getInputScaling,
94 py::return_value_policy::reference_internal);
95 cls.def(
"getOutputScalingInverse", &ScaledPolynomialTransform::getOutputScalingInverse,
96 py::return_value_policy::reference_internal);
97 cls.def(
"linearize", &ScaledPolynomialTransform::linearize);
103 declarePolynomialTransform(mod);
104 declareScaledPolynomialTransform(mod);
std::unique_ptr< AstrometryTransform > compose(AstrometryTransform const &left, AstrometryTransform const &right)
Returns a pointer to a composition of transforms, representing left(right()).
PYBIND11_MODULE(polynomialTransform, mod)
A base class for image defects.