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);
106 using PyPsfDipoleFlux = py::class_<PsfDipoleFlux, std::shared_ptr<PsfDipoleFlux>, DipoleFluxAlgorithm>;
108 wrappers.
wrapType(PyPsfDipoleFlux(wrappers.module,
"PsfDipoleFlux"), [](
auto &mod,
auto &cls) {
109 cls.def(py::init<PsfDipoleFlux::Control const &, std::string const &, afw::table::Schema &>(),
"ctrl"_a,
110 "name"_a,
"schema"_a);
112 cls.def(
"chi2", &PsfDipoleFlux::chi2,
"source"_a,
"exposure"_a,
"negCenterX"_a,
"negCenterY"_a,
113 "negFlux"_a,
"posCenterX"_a,
"posCenterY"_a,
"posFlux"_a);
114 cls.def(
"measure", &PsfDipoleFlux::measure,
"measRecord"_a,
"exposure"_a);
115 cls.def(
"fail", &PsfDipoleFlux::fail,
"measRecord"_a,
"error"_a = nullptr);
122 declareDipoleCentroidControl(wrappers);
123 declareDipoleFluxControl(wrappers);
124 declareDipolePsfFluxControl(wrappers);
125 declareDipoleCentroidAlgorithm(wrappers);
126 declareDipoleFluxAlgorithm(wrappers);
127 declarePsfDipoleFlux(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 wrapDipoleAlgorithms(WrapperCollection &wrappers)