23 #include "pybind11/pybind11.h"
24 #include "pybind11/stl.h"
35 using namespace pybind11::literals;
44 py::class_<LocalBackgroundAlgorithm, std::shared_ptr<LocalBackgroundAlgorithm>, SimpleAlgorithm>;
45 using PyControl = py::class_<LocalBackgroundControl>;
47 py::class_<LocalBackgroundTransform, std::shared_ptr<LocalBackgroundTransform>,
BaseTransform>;
50 PyControl
cls(mod,
"LocalBackgroundControl");
58 cls.def(py::init<>());
64 PyAlgorithm
cls(mod,
"LocalBackgroundAlgorithm");
66 cls.attr(
"FAILURE") = py::cast(LocalBackgroundAlgorithm::FAILURE);
67 cls.attr(
"NO_GOOD_PIXELS") = py::cast(LocalBackgroundAlgorithm::NO_GOOD_PIXELS);
69 cls.def(py::init<LocalBackgroundAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
70 "ctrl"_a,
"name"_a,
"schema"_a);
74 "ctrl"_a,
"name"_a,
"schema"_a,
"logName"_a);
78 PyTransform declareTransform(
py::module &mod) {
79 PyTransform
cls(mod,
"LocalBackgroundTransform");
82 afw::table::SchemaMapper &>(),
83 "ctrl"_a,
"name"_a,
"mapper"_a);
91 py::module::import(
"lsst.afw.table");
92 py::module::import(
"lsst.meas.base.algorithm");
93 py::module::import(
"lsst.meas.base.flagHandler");
94 py::module::import(
"lsst.meas.base.fluxUtilities");
95 py::module::import(
"lsst.meas.base.transform");
97 auto clsControl = declareControl(mod);
99 auto clsTransform = declareTransform(mod);
101 clsAlgorithm.attr(
"Control") = clsControl;
102 clsTransform.attr(
"Control") = clsControl;
104 python::declareAlgorithm<LocalBackgroundAlgorithm, LocalBackgroundControl, LocalBackgroundTransform>(
105 clsAlgorithm, clsControl, clsTransform);