25 #include "pybind11/pybind11.h"
26 #include "pybind11/eigen.h"
27 #include "ndarray/pybind11.h"
28 #include "ndarray/eigen.h"
36 using namespace pybind11::literals;
42 void declarePhotometryTransform(
py::module &mod) {
43 py::class_<PhotometryTransform, std::shared_ptr<PhotometryTransform>> cls(mod,
"PhotometryTransform");
47 "x"_a,
"y"_a,
"value"_a);
48 cls.def(
"transformError",
49 (
double (PhotometryTransform::*)(
double,
double,
double,
double)
const) &
50 PhotometryTransform::transformError,
51 "x"_a,
"y"_a,
"value"_a,
"valueErr"_a);
52 cls.def(
"offsetParams", &PhotometryTransform::offsetParams);
54 cls.def(
"getNpar", &PhotometryTransform::getNpar);
55 cls.def(
"getParameters", &PhotometryTransform::getParameters);
56 cls.def(
"computeParameterDerivatives",
57 [](PhotometryTransform
const &
self,
double x,
double y,
double instFlux) {
58 Eigen::VectorXd derivatives(
self.getNpar());
59 self.computeParameterDerivatives(
x,
y, instFlux, derivatives);
67 void declarePhotometryTransformSpatiallyInvariant(
py::module &mod) {
68 py::class_<PhotometryTransformSpatiallyInvariant, std::shared_ptr<PhotometryTransformSpatiallyInvariant>,
70 cls(mod,
"PhotometryTransformSpatiallyInvariant");
73 void declareFluxTransformSpatiallyInvariant(
py::module &mod) {
74 py::class_<FluxTransformSpatiallyInvariant, std::shared_ptr<FluxTransformSpatiallyInvariant>,
75 PhotometryTransformSpatiallyInvariant, PhotometryTransform>
76 cls(mod,
"FluxTransformSpatiallyInvariant");
78 cls.def(py::init<double>(),
"value"_a = 1);
81 void declareMagnitudeTransformSpatiallyInvariant(
py::module &mod) {
82 py::class_<MagnitudeTransformSpatiallyInvariant, std::shared_ptr<MagnitudeTransformSpatiallyInvariant>,
83 PhotometryTransformSpatiallyInvariant, PhotometryTransform>
84 cls(mod,
"MagnitudeTransformSpatiallyInvariant");
86 cls.def(py::init<double>(),
"value"_a = 0);
89 void declarePhotometryTransformChebyshev(
py::module &mod) {
90 py::class_<PhotometryTransformChebyshev, std::shared_ptr<PhotometryTransformChebyshev>,
92 cls(mod,
"PhotometryTransformChebyshev");
94 cls.def(
"getCoefficients", &PhotometryTransformChebyshev::getCoefficients);
95 cls.def(
"getOrder", &PhotometryTransformChebyshev::getOrder);
96 cls.def(
"getBBox", &PhotometryTransformChebyshev::getBBox);
103 void declareFluxTransformChebyshev(
py::module &mod) {
104 py::class_<FluxTransformChebyshev, std::shared_ptr<FluxTransformChebyshev>, PhotometryTransformChebyshev>
105 cls(mod,
"FluxTransformChebyshev");
107 cls.def(py::init<size_t, geom::Box2D const &>(),
"order"_a,
"bbox"_a);
108 cls.def(py::init<ndarray::Array<double, 2, 2>
const &,
geom::Box2D const &>(),
"coefficients"_a,
112 void declareMagnitudeTransformChebyshev(
py::module &mod) {
113 py::class_<MagnitudeTransformChebyshev, std::shared_ptr<MagnitudeTransformChebyshev>,
114 PhotometryTransformChebyshev>
115 cls(mod,
"MagnitudeTransformChebyshev");
117 cls.def(py::init<size_t, geom::Box2D const &>(),
"order"_a,
"bbox"_a);
118 cls.def(py::init<ndarray::Array<double, 2, 2>
const &,
geom::Box2D const &>(),
"coefficients"_a,
123 declarePhotometryTransform(mod);
125 declarePhotometryTransformSpatiallyInvariant(mod);
126 declareFluxTransformSpatiallyInvariant(mod);
127 declareMagnitudeTransformSpatiallyInvariant(mod);
128 declarePhotometryTransformChebyshev(mod);
129 declareFluxTransformChebyshev(mod);
130 declareMagnitudeTransformChebyshev(mod);
A floating-point coordinate rectangle geometry.
PYBIND11_MODULE(_cameraGeom, mod)
auto integrate(UnaryFunctionT func, Arg const a, Arg const b, double eps=1.0e-6)
The 1D integrator.
void addOutputOp(PyClass &cls, std::string const &method)
Add __str__ or __repr__ method implemented by operator<<.
A base class for image defects.