25#include "pybind11/pybind11.h"
27#include "pybind11/eigen.h"
28#include "ndarray/pybind11.h"
29#include "ndarray/eigen.h"
35using namespace pybind11::literals;
42 using PyPhotometryTransform = py::class_<PhotometryTransform, std::shared_ptr<PhotometryTransform>>;
44 wrappers.
wrapType(PyPhotometryTransform(wrappers.module,
"PhotometryTransform"), [](
auto &mod,
auto &cls) {
46 (double (PhotometryTransform::*)(double, double, double) const) &PhotometryTransform::transform,
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);
53 cls.def(
"clone", &PhotometryTransform::clone);
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);
68 using PyPhotometryTransformSpatiallyInvariant = py::class_<PhotometryTransformSpatiallyInvariant, std::shared_ptr<PhotometryTransformSpatiallyInvariant>,
72 PyPhotometryTransformSpatiallyInvariant(
73 wrappers.module,
"PhotometryTransformSpatiallyInvariant"), [](
auto &mod,
auto &cls) {});
77 using PyFluxTransformSpatiallyInvariant = py::class_<FluxTransformSpatiallyInvariant, std::shared_ptr<FluxTransformSpatiallyInvariant>,
78 PhotometryTransformSpatiallyInvariant, PhotometryTransform>;
81 PyFluxTransformSpatiallyInvariant(
82 wrappers.module,
"FluxTransformSpatiallyInvariant"), [](
auto &mod,
auto &cls) {
83 cls.def(py::init<double>(),
"value"_a = 1);
88 using PyMagnitudeTransformSpatiallyInvariant = py::class_<MagnitudeTransformSpatiallyInvariant, std::shared_ptr<MagnitudeTransformSpatiallyInvariant>,
89 PhotometryTransformSpatiallyInvariant, PhotometryTransform>;
92 PyMagnitudeTransformSpatiallyInvariant(
93 wrappers.module,
"MagnitudeTransformSpatiallyInvariant"), [](
auto &mod,
auto &cls) {
94 cls.def(py::init<double>(),
"value"_a = 0);
99 using PyPhotometryTransformChebyshev =
100 py::class_<PhotometryTransformChebyshev, std::shared_ptr<PhotometryTransformChebyshev>, PhotometryTransform>;
102 wrappers.
wrapType(PyPhotometryTransformChebyshev(
103 wrappers.module,
"PhotometryTransformChebyshev"), [](
auto &mod,
auto &cls) {
104 cls.def(
"getCoefficients", &PhotometryTransformChebyshev::getCoefficients);
105 cls.def(
"getOrder", &PhotometryTransformChebyshev::getOrder);
106 cls.def(
"getBBox", &PhotometryTransformChebyshev::getBBox);
107 cls.def(
"integrate", py::overload_cast<>(&PhotometryTransformChebyshev::integrate, py::const_));
109 py::overload_cast<geom::Box2D const &>(&PhotometryTransformChebyshev::integrate, py::const_),
115 using PyFluxTransformChebyshev =
116 py::class_<FluxTransformChebyshev, std::shared_ptr<FluxTransformChebyshev>, PhotometryTransformChebyshev>;
118 wrappers.
wrapType(PyFluxTransformChebyshev(wrappers.module,
"FluxTransformChebyshev"), [](
auto &mod,
auto &cls) {
119 cls.def(py::init<size_t, geom::Box2D const &>(),
"order"_a,
"bbox"_a);
120 cls.def(py::init<ndarray::Array<double, 2, 2> const &, geom::Box2D const &>(),
"coefficients"_a,
126 using PyMagnitudeTransformChebyshev = py::class_<MagnitudeTransformChebyshev, std::shared_ptr<MagnitudeTransformChebyshev>,
127 PhotometryTransformChebyshev>;
130 PyMagnitudeTransformChebyshev(wrappers.module,
"MagnitudeTransformChebyshev"), [](
auto &mod,
auto &cls) {
131 cls.def(py::init<size_t, geom::Box2D const &>(),
"order"_a,
"bbox"_a);
132 cls.def(py::init<ndarray::Array<double, 2, 2> const &, geom::Box2D const &>(),
"coefficients"_a,
139 declarePhotometryTransform(wrappers);
140 declarePhotometryTransformSpatiallyInvariant(wrappers);
141 declareFluxTransformSpatiallyInvariant(wrappers);
142 declareMagnitudeTransformSpatiallyInvariant(wrappers);
143 declarePhotometryTransformChebyshev(wrappers);
144 declareFluxTransformChebyshev(wrappers);
145 declareMagnitudeTransformChebyshev(wrappers);
A helper class for subdividing pybind11 module across multiple translation units (i....
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
void addOutputOp(PyClass &cls, std::string const &method)
Add __str__ or __repr__ method implemented by operator<<.
void wrapPhotometryTransform(WrapperCollection &wrappers)