24#include <pybind11/pybind11.h>
27#include <pybind11/stl.h>
36using namespace pybind11::literals;
44template <
typename ReturnT>
51 [](
auto &mod,
auto &cls) {
52 cls.def(py::init<std::vector<double> const &>(),
"params"_a);
53 cls.def(py::init<unsigned int>(),
"order"_a);
55 cls.def(
"__call__", &PolynomialFunction1<ReturnT>::operator(),
"x"_a);
56 cls.def(
"clone", &PolynomialFunction1<ReturnT>::clone);
57 cls.def(
"isLinearCombination", &PolynomialFunction1<ReturnT>::isLinearCombination);
58 cls.def(
"getOrder", &PolynomialFunction1<ReturnT>::getOrder);
59 cls.def(
"toString", &PolynomialFunction1<ReturnT>::toString,
"prefix"_a =
"");
64 (
"PolynomialFunction2" + suffix).c_str()),
65 [](
auto &mod,
auto &cls) {
66 cls.def(py::init<std::vector<double> const &>(),
"params"_a);
67 cls.def(py::init<unsigned int>(),
"order"_a);
69 cls.def(
"__call__", &PolynomialFunction2<ReturnT>::operator(),
"x"_a,
"y"_a);
70 cls.def(
"clone", &PolynomialFunction2<ReturnT>::clone);
71 cls.def(
"getOrder", &PolynomialFunction2<ReturnT>::getOrder);
72 cls.def(
"getDFuncDParameters", &PolynomialFunction2<ReturnT>::getDFuncDParameters);
73 cls.def(
"toString", &PolynomialFunction2<ReturnT>::toString,
"prefix"_a =
"");
74 cls.def(
"isPersistable", &PolynomialFunction2<ReturnT>::isPersistable);
78template <
typename ReturnT>
85 [](
auto &mod,
auto &cls) {
86 cls.def(py::init<std::vector<double>, double, double>(),
"params"_a,
"minX"_a = -1,
88 cls.def(py::init<unsigned int, double, double>(),
"order"_a,
"minX"_a = -1,
"maxX"_a = 1);
90 cls.def(
"__call__", &Chebyshev1Function1<ReturnT>::operator(),
"x"_a);
91 cls.def(
"clone", &Chebyshev1Function1<ReturnT>::clone);
92 cls.def(
"getMinX", &Chebyshev1Function1<ReturnT>::getMinX);
93 cls.def(
"getMaxX", &Chebyshev1Function1<ReturnT>::getMaxX);
94 cls.def(
"getOrder", &Chebyshev1Function1<ReturnT>::getOrder);
95 cls.def(
"isLinearCombination", &Chebyshev1Function1<ReturnT>::isLinearCombination);
96 cls.def(
"toString", &Chebyshev1Function1<ReturnT>::toString,
"prefix"_a =
"");
102 (
"Chebyshev1Function2" + suffix).c_str()),
103 [](
auto &mod,
auto &cls) {
104 cls.def(py::init<std::vector<double>, lsst::geom::Box2D const &>(),
"params"_a,
105 "xyRange"_a = lsst::geom::Box2D(lsst::geom::Point2D(-1.0, -1.0),
106 lsst::geom::Point2D(1.0, 1.0)));
107 cls.def(py::init<unsigned int, lsst::geom::Box2D const &>(),
"order"_a,
108 "xyRange"_a = lsst::geom::Box2D(lsst::geom::Point2D(-1.0, -1.0),
109 lsst::geom::Point2D(1.0, 1.0)));
111 cls.def(
"__call__", &Chebyshev1Function2<ReturnT>::operator(),
"x"_a,
"y"_a);
112 cls.def(
"clone", &Chebyshev1Function2<ReturnT>::clone);
113 cls.def(
"getXYRange", &Chebyshev1Function2<ReturnT>::getXYRange);
114 cls.def(
"truncate", &Chebyshev1Function2<ReturnT>::truncate,
"order"_a);
115 cls.def(
"toString", &Chebyshev1Function2<ReturnT>::toString,
"prefix"_a =
"");
116 cls.def(
"isPersistable", &Chebyshev1Function2<ReturnT>::isPersistable);
120template <
typename ReturnT>
125 [](
auto &mod,
auto &cls) {
126 cls.def(py::init<double>(),
"sigma"_a);
128 cls.def(
"__call__", &GaussianFunction1<ReturnT>::operator(),
"x"_a);
129 cls.def(
"clone", &GaussianFunction1<ReturnT>::clone);
130 cls.def(
"toString", &GaussianFunction1<ReturnT>::toString,
"prefix"_a =
"");
135 [](
auto &mod,
auto &cls) {
138 cls.def(py::init<double, double, double>(),
"sigma1"_a,
"sigma2"_a,
141 cls.def(
"__call__", &GaussianFunction2<ReturnT>::operator(),
"x"_a,
"y"_a);
142 cls.def(
"clone", &GaussianFunction2<ReturnT>::clone);
143 cls.def(
"toString", &GaussianFunction2<ReturnT>::toString,
"prefix"_a =
"");
144 cls.def(
"isPersistable", &GaussianFunction2<ReturnT>::isPersistable);
151 [](
auto &mod,
auto &cls) {
152 cls.def(py::init<double, double, double>(),
"sigma1"_a,
"sigma2"_a = 0,
"ampl"_a = 0);
154 cls.def(
"__call__", &DoubleGaussianFunction2<ReturnT>::operator(),
"x"_a,
"y"_a);
155 cls.def(
"clone", &DoubleGaussianFunction2<ReturnT>::clone);
156 cls.def(
"toString", &DoubleGaussianFunction2<ReturnT>::toString,
"prefix"_a =
"");
157 cls.def(
"isPersistable", &DoubleGaussianFunction2<ReturnT>::isPersistable);
161template <
typename ReturnT>
169 [](
auto &mod,
auto &cls) {
170 cls.def(py::init<double>(),
"xo"_a);
172 cls.def(
"__call__", &IntegerDeltaFunction1<ReturnT>::operator(),
"x"_a);
173 cls.def(
"clone", &IntegerDeltaFunction1<ReturnT>::clone);
174 cls.def(
"toString", &IntegerDeltaFunction1<ReturnT>::toString,
"prefix"_a =
"");
181 [](
auto &mod,
auto &cls) {
182 cls.def(py::init<double, double>(),
"xo"_a,
"yo"_a);
184 cls.def(
"__call__", &IntegerDeltaFunction2<ReturnT>::operator(),
"x"_a,
"y"_a);
185 cls.def(
"clone", &IntegerDeltaFunction2<ReturnT>::clone);
186 cls.def(
"toString", &IntegerDeltaFunction2<ReturnT>::toString,
"prefix"_a =
"");
190template <
typename ReturnT>
196 [](
auto &mod,
auto &cls) {
197 cls.def(py::init<unsigned int, double>(),
"n"_a,
"xOffset"_a = 0.0);
199 cls.def(
"__call__", &LanczosFunction1<ReturnT>::operator(),
"x"_a);
200 cls.def(
"clone", &LanczosFunction1<ReturnT>::clone);
201 cls.def(
"getOrder", &LanczosFunction1<ReturnT>::getOrder);
202 cls.def(
"toString", &LanczosFunction1<ReturnT>::toString,
"prefix"_a =
"");
208 [](
auto &mod,
auto &cls) {
210 cls.def(py::init<unsigned int, double, double>(),
"n"_a,
"xOffset"_a = 0.0,
213 cls.def(
"__call__", &LanczosFunction2<ReturnT>::operator(),
"x"_a,
"y"_a);
214 cls.def(
"clone", &LanczosFunction2<ReturnT>::clone);
215 cls.def(
"getOrder", &LanczosFunction2<ReturnT>::getOrder);
216 cls.def(
"toString", &LanczosFunction2<ReturnT>::toString,
"prefix"_a =
"");
221 wrappers.addInheritanceDependency(
"lsst.geom");
222 declarePolynomialFunctions<float>(wrappers,
"F");
223 declareChebyshevFunctions<float>(wrappers,
"F");
224 declareGaussianFunctions<float>(wrappers,
"F");
225 declareIntegerDeltaFunctions<float>(wrappers,
"F");
226 declareLanczosFunctions<float>(wrappers,
"F");
228 declarePolynomialFunctions<double>(wrappers,
"D");
229 declareChebyshevFunctions<double>(wrappers,
"D");
230 declareGaussianFunctions<double>(wrappers,
"D");
231 declareIntegerDeltaFunctions<double>(wrappers,
"D");
232 declareLanczosFunctions<double>(wrappers,
"D");
PYBIND11_DECLARE_HOLDER_TYPE(MyType, std::shared_ptr< MyType >)
Base class for 2-dimensional polynomials of the form:
1-dimensional weighted sum of Chebyshev polynomials of the first kind.
2-dimensional weighted sum of Chebyshev polynomials of the first kind.
double Guassian (sum of two Gaussians)
A Function taking one argument.
A Function taking two arguments.
1-dimensional integer delta function.
2-dimensional integer delta function.
1-dimensional Lanczos function
2-dimensional separable Lanczos function
1-dimensional polynomial function.
2-dimensional polynomial function with cross terms
void declareChebyshevFunctions(lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
void declarePolynomialFunctions(lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
void declareIntegerDeltaFunctions(lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
void declareGaussianFunctions(lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
void wrapFunctionLibrary(lsst::utils::python::WrapperCollection &wrappers)
void declareLanczosFunctions(lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
A base class for image defects.