25#include "pybind11/pybind11.h"
27#include "pybind11/eigen.h"
28#include "pybind11/stl.h"
35using namespace pybind11::literals;
42 using PyPhotometryMappingBase = py::class_<PhotometryMappingBase, std::shared_ptr<PhotometryMappingBase>>;
44 wrappers.
wrapType(PyPhotometryMappingBase(wrappers.module,
"PhotometryMappingBase"), [](
auto &mod,
auto &cls) {
45 cls.def(
"getNpar", &PhotometryMappingBase::getNpar);
46 cls.def(
"transform", &PhotometryMappingBase::transform);
47 cls.def(
"transformError", &PhotometryMappingBase::transformError);
48 cls.def(
"computeParameterDerivatives",
49 [](PhotometryMappingBase const &self, MeasuredStar const &star, double instFlux) {
50 Eigen::VectorXd derivatives(self.getNpar());
51 self.computeParameterDerivatives(star, instFlux, derivatives);
57 cls.def(
"getMappingIndices", [](PhotometryMappingBase
const &self) {
59 self.getMappingIndices(indices);
69 using PyPhotometryMapping = py::class_<PhotometryMapping, std::shared_ptr<PhotometryMapping>, PhotometryMappingBase>;
71 wrappers.
wrapType(PyPhotometryMapping(wrappers.module,
"PhotometryMapping"), [](
auto &mod,
auto &cls) {
72 cls.def(py::init<std::shared_ptr<PhotometryTransform>>(),
"transform"_a);
74 cls.def(
"offsetParams", &PhotometryMapping::offsetParams);
75 cls.def(
"getTransform", &PhotometryMapping::getTransform);
76 cls.def(
"getTransformErrors", &PhotometryMapping::getTransformErrors);
81 using PyChipVisitPhotometryMapping =
82 py::class_<ChipVisitPhotometryMapping, std::shared_ptr<ChipVisitPhotometryMapping>, PhotometryMappingBase>;
85 PyChipVisitPhotometryMapping(wrappers.module,
"ChipVisitPhotometryMapping"), [](
auto &mod,
auto &cls) {
86 cls.def(
"setWhatToFit", &ChipVisitPhotometryMapping::setWhatToFit);
87 cls.def(
"getChipMapping", &ChipVisitPhotometryMapping::getChipMapping);
88 cls.def(
"getVisitMapping", &ChipVisitPhotometryMapping::getVisitMapping);
89 cls.def(
"getNParChip", &ChipVisitPhotometryMapping::getNParChip);
90 cls.def(
"getNParVisit", &ChipVisitPhotometryMapping::getNParVisit);
95 using PyChipVisitFluxMapping =
96 py::class_<ChipVisitFluxMapping, std::shared_ptr<ChipVisitFluxMapping>, ChipVisitPhotometryMapping>;
98 wrappers.
wrapType(PyChipVisitFluxMapping(wrappers.module,
"ChipVisitFluxMapping"), [](
auto &mod,
auto &cls) {
99 cls.def(py::init<std::shared_ptr<PhotometryMapping>, std::shared_ptr<PhotometryMapping>>(),
100 "chipMapping"_a,
"visitMapping"_a);
105 using PyChipVisitMagnitudeMapping = py::class_<ChipVisitMagnitudeMapping, std::shared_ptr<ChipVisitMagnitudeMapping>,
106 ChipVisitPhotometryMapping>;
108 wrappers.
wrapType(PyChipVisitMagnitudeMapping(wrappers.module,
"ChipVisitMagnitudeMapping"), [](
auto &mod,
auto &cls) {
109 cls.def(py::init<std::shared_ptr<PhotometryMapping>, std::shared_ptr<PhotometryMapping>>(),
110 "chipMapping"_a,
"visitMapping"_a);
116 declarePhotometryMappingBase(wrappers);
117 declarePhotometryMapping(wrappers);
118 declareChipVisitPhotometryMapping(wrappers);
119 declareChipVisitFluxMapping(wrappers);
120 declareChipVisitMagnitudeMapping(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...
virtual Eigen::VectorXd getParameters()=0
void setIndex(Eigen::Index i)
Set the index of this mapping in the grand fit.
Eigen::Index getIndex() const
Get the index of this mapping in the grand fit.
void wrapPhotometryMappings(WrapperCollection &wrappers)