23 #include "pybind11/pybind11.h"
33 using namespace pybind11::literals;
41 using PyFluxAlgorithm =
42 py::class_<GaussianFluxAlgorithm, std::shared_ptr<GaussianFluxAlgorithm>, SimpleAlgorithm>;
43 using PyFluxControl = py::class_<GaussianFluxControl>;
44 using PyFluxTransform =
45 py::class_<GaussianFluxTransform, std::shared_ptr<GaussianFluxTransform>,
BaseTransform>;
47 PyFluxControl declareFluxControl(
py::module &mod) {
48 PyFluxControl
cls(mod,
"GaussianFluxControl");
55 PyFluxAlgorithm declareFluxAlgorithm(
py::module &mod) {
56 PyFluxAlgorithm
cls(mod,
"GaussianFluxAlgorithm");
58 cls.def(py::init<GaussianFluxAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
59 "ctrl"_a,
"name"_a,
"schema"_a);
61 cls.attr(
"FAILURE") = py::cast(GaussianFluxAlgorithm::FAILURE);
64 cls.def(
"fail", &GaussianFluxAlgorithm::fail,
"measRecord"_a,
"error"_a =
nullptr);
69 PyFluxTransform declareFluxTransform(
py::module &mod) {
70 PyFluxTransform
cls(mod,
"GaussianFluxTransform");
73 afw::table::SchemaMapper &>(),
74 "ctrl"_a,
"name"_a,
"mapper"_a);
82 py::module::import(
"lsst.afw.table");
83 py::module::import(
"lsst.meas.base.algorithm");
84 py::module::import(
"lsst.meas.base.flagHandler");
85 py::module::import(
"lsst.meas.base.transform");
87 auto clsFluxControl = declareFluxControl(mod);
88 auto clsFluxAlgorithm = declareFluxAlgorithm(mod);
89 auto clsFluxTransform = declareFluxTransform(mod);
91 clsFluxAlgorithm.attr(
"Control") = clsFluxControl;
92 clsFluxTransform.attr(
"Control") = clsFluxControl;
94 python::declareAlgorithm<GaussianFluxAlgorithm, GaussianFluxControl, GaussianFluxTransform>(
95 clsFluxAlgorithm, clsFluxControl, clsFluxTransform);