24 #include <pybind11/pybind11.h>
25 #include <pybind11/stl.h>
33 namespace py = pybind11;
34 using namespace pybind11::literals;
42 template <
typename ReturnT>
45 py::class_<PolynomialFunction1<ReturnT>, std::shared_ptr<PolynomialFunction1<ReturnT>>,
47 clsPolynomialFunction1(mod, (
"PolynomialFunction1" + suffix).c_str());
49 clsPolynomialFunction1.def(py::init<std::vector<double>
const &>(),
"params"_a);
50 clsPolynomialFunction1.def(py::init<unsigned int>(),
"order"_a);
59 py::class_<PolynomialFunction2<ReturnT>, std::shared_ptr<PolynomialFunction2<ReturnT>>,
61 clsPolynomialFunction2(mod, (
"PolynomialFunction2" + suffix).c_str());
63 clsPolynomialFunction2.def(py::init<std::vector<double>
const &>(),
"params"_a);
64 clsPolynomialFunction2.def(py::init<unsigned int>(),
"order"_a);
74 template <
typename ReturnT>
77 py::class_<Chebyshev1Function1<ReturnT>, std::shared_ptr<Chebyshev1Function1<ReturnT>>,
79 clsChebyshev1Function1(mod, (
"Chebyshev1Function1" + suffix).c_str());
81 clsChebyshev1Function1.def(py::init<std::vector<double>,
double,
double>(),
"params"_a,
"minX"_a = -1,
83 clsChebyshev1Function1.def(py::init<unsigned int, double, double>(),
"order"_a,
"minX"_a = -1,
95 py::class_<Chebyshev1Function2<ReturnT>, std::shared_ptr<Chebyshev1Function2<ReturnT>>,
97 clsChebyshev1Function2(mod, (
"Chebyshev1Function2" + suffix).c_str());
99 clsChebyshev1Function2.def(py::init<std::vector<double>,
geom::Box2D const &>(),
"params"_a,
101 clsChebyshev1Function2.def(py::init<unsigned int, geom::Box2D const &>(),
"order"_a,
112 template <
typename ReturnT>
115 py::class_<GaussianFunction1<ReturnT>, std::shared_ptr<GaussianFunction1<ReturnT>>,
Function1<ReturnT>>
116 clsGaussianFunction1(mod, (
"GaussianFunction1" + suffix).c_str());
118 clsGaussianFunction1.def(py::init<double>(),
"sigma"_a);
125 py::class_<GaussianFunction2<ReturnT>, std::shared_ptr<GaussianFunction2<ReturnT>>,
Function2<ReturnT>>
126 clsGaussianFunction2(mod, (
"GaussianFunction2" + suffix).c_str());
128 clsGaussianFunction2.def(py::init<double, double, double>(),
"sigma1"_a,
"sigma2"_a,
"angle"_a = 0.0);
136 py::class_<DoubleGaussianFunction2<ReturnT>, std::shared_ptr<DoubleGaussianFunction2<ReturnT>>,
138 clsDoubleGaussianFunction2(mod, (
"DoubleGaussianFunction2" + suffix).c_str());
140 clsDoubleGaussianFunction2.def(py::init<double, double, double>(),
"sigma1"_a,
"sigma2"_a = 0,
149 template <
typename ReturnT>
152 py::class_<IntegerDeltaFunction1<ReturnT>, std::shared_ptr<IntegerDeltaFunction1<ReturnT>>,
154 clsIntegerDeltaFunction1(mod, (
"IntegerDeltaFunction1" + suffix).c_str());
156 clsIntegerDeltaFunction1.def(py::init<double>(),
"xo"_a);
163 py::class_<IntegerDeltaFunction2<ReturnT>, std::shared_ptr<IntegerDeltaFunction2<ReturnT>>,
165 clsIntegerDeltaFunction2(mod, (
"IntegerDeltaFunction2" + suffix).c_str());
167 clsIntegerDeltaFunction2.def(py::init<double, double>(),
"xo"_a,
"yo"_a);
174 template <
typename ReturnT>
177 py::class_<LanczosFunction1<ReturnT>, std::shared_ptr<LanczosFunction1<ReturnT>>,
Function1<ReturnT>>
178 clsLanczosFunction1(mod, (
"LanczosFunction1" + suffix).c_str());
180 clsLanczosFunction1.def(py::init<unsigned int, double>(),
"n"_a,
"xOffset"_a = 0.0);
188 py::class_<LanczosFunction2<ReturnT>, std::shared_ptr<LanczosFunction2<ReturnT>>,
Function2<ReturnT>>
189 clsLanczosFunction2(mod, (
"LanczosFunction2" + suffix).c_str());
191 clsLanczosFunction2.def(py::init<unsigned int, double, double>(),
"n"_a,
"xOffset"_a = 0.0,
201 py::module mod(
"_functionLibrary",
"Python wrapper for afw _functionLibrary library");
203 declarePolynomialFunctions<float>(mod,
"F");
204 declareChebyshevFunctions<float>(mod,
"F");
205 declareGaussianFunctions<float>(mod,
"F");
206 declareIntegerDeltaFunctions<float>(mod,
"F");
207 declareLanczosFunctions<float>(mod,
"F");
209 declarePolynomialFunctions<double>(mod,
"D");
210 declareChebyshevFunctions<double>(mod,
"D");
211 declareGaussianFunctions<double>(mod,
"D");
212 declareIntegerDeltaFunctions<double>(mod,
"D");
213 declareLanczosFunctions<double>(mod,
"D");
2-dimensional weighted sum of Chebyshev polynomials of the first kind.
1-dimensional Lanczos function
double Guassian (sum of two Gaussians)
2-dimensional polynomial function with cross terms
1-dimensional weighted sum of Chebyshev polynomials of the first kind.
2-dimensional integer delta function.
2-dimensional separable Lanczos function
A Function taking two arguments.
Base class for 2-dimensional polynomials of the form:
PYBIND11_PLUGIN(_cameraPoint)
void declareLanczosFunctions(py::module &mod, const std::string &suffix)
1-dimensional integer delta function.
PYBIND11_DECLARE_HOLDER_TYPE(MyCoordType, std::shared_ptr< MyCoordType >)
A Function taking one argument.
void declareIntegerDeltaFunctions(py::module &mod, const std::string &suffix)
void declareGaussianFunctions(py::module &mod, const std::string &suffix)
void declareChebyshevFunctions(py::module &mod, const std::string &suffix)
A floating-point coordinate rectangle geometry.
void declarePolynomialFunctions(py::module &mod, const std::string &suffix)
1-dimensional polynomial function.