23 #include "pybind11/pybind11.h"
33 using namespace pybind11::literals;
41 using PyBlendenessAlgorithm =
42 py::class_<BlendednessAlgorithm, std::shared_ptr<BlendednessAlgorithm>, SimpleAlgorithm>;
43 using PyBlendenessControl = py::class_<BlendednessControl>;
45 PyBlendenessControl declareBlendednessControl(
py::module &mod) {
46 PyBlendenessControl
cls(mod,
"BlendednessControl");
53 cls.def(py::init<>());
58 PyBlendenessAlgorithm declareBlendednessAlgorithm(
py::module &mod) {
59 PyBlendenessAlgorithm
cls(mod,
"BlendednessAlgorithm");
61 cls.def(py::init<BlendednessAlgorithm::Control const &, std::string const &, afw::table::Schema &>(),
62 "ctrl"_a,
"name"_a,
"schema"_a);
64 cls.attr(
"FAILURE") = py::cast(BlendednessAlgorithm::FAILURE);
65 cls.attr(
"NO_CENTROID") = py::cast(BlendednessAlgorithm::NO_CENTROID);
66 cls.attr(
"NO_SHAPE") = py::cast(BlendednessAlgorithm::NO_SHAPE);
68 cls.def_static(
"computeAbsExpectation", &BlendednessAlgorithm::computeAbsExpectation,
"data"_a,
70 cls.def_static(
"computeAbsBias", &BlendednessAlgorithm::computeAbsBias,
"mu"_a,
"variance"_a);
71 cls.def(
"measureChildPixels", &BlendednessAlgorithm::measureChildPixels,
"image"_a,
"child"_a);
72 cls.def(
"measureParentPixels", &BlendednessAlgorithm::measureParentPixels,
"image"_a,
"child"_a);
82 py::module::import(
"lsst.afw.table");
83 py::module::import(
"lsst.meas.base.algorithm");
84 py::module::import(
"lsst.meas.base.flagHandler");
86 auto clsBlendednessControl = declareBlendednessControl(mod);
87 auto clsBlendednessAlgorithm = declareBlendednessAlgorithm(mod);
89 clsBlendednessAlgorithm.attr(
"Control") = clsBlendednessControl;
91 python::declareAlgorithm<BlendednessAlgorithm, BlendednessControl>(clsBlendednessAlgorithm,
92 clsBlendednessControl);