23#include "pybind11/pybind11.h"
25#include "pybind11/stl.h"
35using namespace pybind11::literals;
44 using PyDipoleCentroidControl = py::class_<DipoleCentroidControl, std::shared_ptr<DipoleCentroidControl>>;
46 wrappers.
wrapType(PyDipoleCentroidControl(wrappers.module,
"DipoleCentroidControl"), [](
auto &mod,
auto &cls) {
47 cls.def(py::init<>());
52 using PyDipoleFluxControl = py::class_<DipoleFluxControl, std::shared_ptr<DipoleFluxControl>>;
54 wrappers.
wrapType(PyDipoleFluxControl(wrappers.module,
"DipoleFluxControl"), [](
auto &mod,
auto &cls) {
55 cls.def(py::init<>());
60 using PyPsfDipoleFluxControl =
61 py::class_<PsfDipoleFluxControl, std::shared_ptr<PsfDipoleFluxControl>,
DipoleFluxControl>;
62 wrappers.
wrapType(PyPsfDipoleFluxControl(wrappers.module,
"PsfDipoleFluxControl"), [](
auto &mod,
auto &cls) {
63 cls.def(py::init<>());
65 LSST_DECLARE_CONTROL_FIELD(cls, PsfDipoleFluxControl, stepSizeCoord);
66 LSST_DECLARE_CONTROL_FIELD(cls, PsfDipoleFluxControl, stepSizeFlux);
67 LSST_DECLARE_CONTROL_FIELD(cls, PsfDipoleFluxControl, errorDef);
68 LSST_DECLARE_CONTROL_FIELD(cls, PsfDipoleFluxControl, maxFnCalls);
74 using PyDipoleCentroidAlgorithm =
75 py::class_<DipoleCentroidAlgorithm, std::shared_ptr<DipoleCentroidAlgorithm>, meas::base::SimpleAlgorithm>;
77 wrappers.
wrapType(PyDipoleCentroidAlgorithm(wrappers.module,
"_DipoleCentroidAlgorithm"), [](
auto &mod,
auto &cls) {
78 cls.attr(
"FAILURE") = py::cast(DipoleCentroidAlgorithm::FAILURE);
79 cls.attr(
"POS_FLAG") = py::cast(DipoleCentroidAlgorithm::POS_FLAG);
80 cls.attr(
"NEG_FLAG") = py::cast(DipoleCentroidAlgorithm::NEG_FLAG);
81 cls.def_static(
"getFlagDefinitions", &DipoleCentroidAlgorithm::getFlagDefinitions,
82 py::return_value_policy::copy);
84 cls.def(
"getPositiveKeys", &DipoleCentroidAlgorithm::getPositiveKeys);
85 cls.def(
"getNegativeKeys", &DipoleCentroidAlgorithm::getNegativeKeys);
91 using PyDipoleFluxAlgorithm =
92 py::class_<DipoleFluxAlgorithm, std::shared_ptr<DipoleFluxAlgorithm>, meas::base::SimpleAlgorithm>;
93 wrappers.
wrapType(PyDipoleFluxAlgorithm(wrappers.module,
"_DipoleFluxAlgorithm"), [](
auto &mod,
auto &cls) {
94 cls.attr(
"FAILURE") = py::cast(DipoleFluxAlgorithm::FAILURE);
95 cls.attr(
"POS_FLAG") = py::cast(DipoleFluxAlgorithm::POS_FLAG);
96 cls.attr(
"NEG_FLAG") = py::cast(DipoleFluxAlgorithm::NEG_FLAG);
97 cls.def_static(
"getFlagDefinitions", &DipoleFluxAlgorithm::getFlagDefinitions,
98 py::return_value_policy::copy);
100 cls.def(
"getPositiveKeys", &DipoleFluxAlgorithm::getPositiveKeys);
101 cls.def(
"getNegativeKeys", &DipoleFluxAlgorithm::getNegativeKeys);
107#pragma GCC diagnostic push
108#pragma GCC diagnostic ignored "-Wdeprecated"
110 using PyNaiveDipoleFlux = py::class_<NaiveDipoleFlux, std::shared_ptr<NaiveDipoleFlux>, DipoleFluxAlgorithm>;
112 wrappers.
wrapType(PyNaiveDipoleFlux(wrappers.module,
"NaiveDipoleFlux"), [](
auto &mod,
auto &cls) {
113 cls.def(py::init<NaiveDipoleFlux::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a,
114 "name"_a,
"schema"_a);
116 cls.def(
"measure", &NaiveDipoleFlux::measure,
"measRecord"_a,
"exposure"_a);
117 cls.def(
"fail", &NaiveDipoleFlux::fail,
"measRecord"_a,
"error"_a = nullptr);
122 using PyNaiveDipoleCentroid =
123 py::class_<NaiveDipoleCentroid, std::shared_ptr<NaiveDipoleCentroid>, DipoleCentroidAlgorithm>;
124 wrappers.
wrapType(PyNaiveDipoleCentroid(wrappers.module,
"NaiveDipoleCentroid"), [](
auto &mod,
auto &cls) {
125 cls.def(py::init<NaiveDipoleCentroid::Control const &, std::string const &, afw::table::Schema &>(),
126 "ctrl"_a,
"name"_a,
"schema"_a);
128 cls.def(
"getCenterKeys", &NaiveDipoleCentroid::getCenterKeys);
129 cls.def(
"getPositiveKeys", &NaiveDipoleCentroid::getPositiveKeys);
130 cls.def(
"getNegativeKeys", &NaiveDipoleCentroid::getNegativeKeys);
132 cls.def(
"measure", &NaiveDipoleCentroid::measure,
"measRecord"_a,
"exposure"_a);
133 cls.def(
"mergeCentroids", &NaiveDipoleCentroid::mergeCentroids,
"source"_a,
"posValue"_a,
"negValue"_a);
134 cls.def(
"fail", &NaiveDipoleCentroid::fail,
"measRecord"_a,
"error"_a = nullptr);
139 using PyPsfDipoleFlux = py::class_<PsfDipoleFlux, std::shared_ptr<PsfDipoleFlux>, DipoleFluxAlgorithm>;
141 wrappers.
wrapType(PyPsfDipoleFlux(wrappers.module,
"PsfDipoleFlux"), [](
auto &mod,
auto &cls) {
142 cls.def(py::init<PsfDipoleFlux::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a,
143 "name"_a,
"schema"_a);
145 cls.def(
"chi2", &PsfDipoleFlux::chi2,
"source"_a,
"exposure"_a,
"negCenterX"_a,
"negCenterY"_a,
146 "negFlux"_a,
"posCenterX"_a,
"posCenterY"_a,
"posFlux"_a);
147 cls.def(
"measure", &PsfDipoleFlux::measure,
"measRecord"_a,
"exposure"_a);
148 cls.def(
"fail", &PsfDipoleFlux::fail,
"measRecord"_a,
"error"_a = nullptr);
155 declareDipoleCentroidControl(wrappers);
156 declareDipoleFluxControl(wrappers);
157 declareDipolePsfFluxControl(wrappers);
158 declareDipoleCentroidAlgorithm(wrappers);
159 declareDipoleFluxAlgorithm(wrappers);
160 declareNaiveDipoleFlux(wrappers);
161 declareNaiveDipoleCentroid(wrappers);
162 declarePsfDipoleFlux(wrappers);
167#pragma GCC diagnostic pop
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 wrapDipoleAlgorithms(WrapperCollection &wrappers)