23 #include "pybind11/pybind11.h"
24 #include "pybind11/stl.h"
35 using namespace pybind11::literals;
43 using PyFluxAlgorithm = py::class_<PsfFluxAlgorithm, std::shared_ptr<PsfFluxAlgorithm>, SimpleAlgorithm>;
44 using PyFluxControl = py::class_<PsfFluxControl>;
45 using PyFluxTransform = py::class_<PsfFluxTransform, std::shared_ptr<PsfFluxTransform>,
BaseTransform>;
47 PyFluxControl declareFluxControl(
py::module &mod) {
48 PyFluxControl
cls(mod,
"PsfFluxControl");
52 cls.def(py::init<>());
57 PyFluxAlgorithm declareFluxAlgorithm(
py::module &mod) {
58 PyFluxAlgorithm
cls(mod,
"PsfFluxAlgorithm");
60 cls.attr(
"FAILURE") = py::cast(PsfFluxAlgorithm::FAILURE);
61 cls.attr(
"NO_GOOD_PIXELS") = py::cast(PsfFluxAlgorithm::NO_GOOD_PIXELS);
62 cls.attr(
"EDGE") = py::cast(PsfFluxAlgorithm::EDGE);
64 cls.def(py::init<PsfFluxAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
65 "ctrl"_a,
"name"_a,
"schema"_a);
69 "ctrl"_a,
"name"_a,
"schema"_a,
"logName"_a);
73 PyFluxTransform declareFluxTransform(
py::module &mod) {
74 PyFluxTransform
cls(mod,
"PsfFluxTransform");
76 cls.def(py::init<PsfFluxTransform::Control const &, std::string const &, afw::table::SchemaMapper &>(),
77 "ctrl"_a,
"name"_a,
"mapper"_a);
85 py::module::import(
"lsst.afw.table");
86 py::module::import(
"lsst.meas.base.algorithm");
87 py::module::import(
"lsst.meas.base.flagHandler");
88 py::module::import(
"lsst.meas.base.fluxUtilities");
89 py::module::import(
"lsst.meas.base.transform");
91 auto clsFluxControl = declareFluxControl(mod);
92 auto clsFluxAlgorithm = declareFluxAlgorithm(mod);
93 auto clsFluxTransform = declareFluxTransform(mod);
95 clsFluxAlgorithm.attr(
"Control") = clsFluxControl;
96 clsFluxTransform.attr(
"Control") = clsFluxControl;
98 python::declareAlgorithm<PsfFluxAlgorithm, PsfFluxControl, PsfFluxTransform>(
99 clsFluxAlgorithm, clsFluxControl, clsFluxTransform);