24 #include <pybind11/pybind11.h>
25 #include <pybind11/stl.h>
27 #include "ndarray/pybind11.h"
36 using namespace py::literals;
42 using utils::python::WrapperCollection;
47 void declareHeavyFootprint(WrapperCollection &wrappers,
std::string const &suffix) {
48 using Class = HeavyFootprint<ImagePixelT>;
51 (
"HeavyFootprint" + suffix).c_str()),
52 [](
auto &mod,
auto &
cls) {
53 cls.def(py::init<Footprint const &,
54 lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT> const
56 HeavyFootprintCtrl const *>(),
57 "foot"_a,
"mimage"_a,
"ctrl"_a = nullptr);
58 cls.def(py::init<Footprint const &, HeavyFootprintCtrl const *>(),
"foot"_a,
61 cls.def(
"isHeavy", &Class::isHeavy);
62 cls.def(
"insert", (void (Class::*)(lsst::afw::image::MaskedImage<ImagePixelT> &) const) &
65 (void (Class::*)(lsst::afw::image::Image<ImagePixelT> &) const) & Class::insert);
66 cls.def(
"getImageArray",
67 (ndarray::Array<ImagePixelT, 1, 1>(Class::*)()) & Class::getImageArray);
68 cls.def(
"getMaskArray", (ndarray::Array<MaskPixelT, 1, 1>(Class::*)()) & Class::getMaskArray);
69 cls.def(
"getVarianceArray",
70 (ndarray::Array<VariancePixelT, 1, 1>(Class::*)()) & Class::getVarianceArray);
71 cls.def(
"getMaskBitsSet", &Class::getMaskBitsSet);
72 cls.def(
"dot", &Class::dot);
75 wrappers.wrap([](
auto &mod) {
76 mod.def(
"makeHeavyFootprint",
79 HeavyFootprintCtrl
const *))
80 makeHeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>,
81 "foot"_a,
"img"_a,
"ctrl"_a =
nullptr);
83 mod.def(
"mergeHeavyFootprints", mergeHeavyFootprints<ImagePixelT, MaskPixelT, VariancePixelT>);
91 declareHeavyFootprint<int>(wrappers,
"I");
92 declareHeavyFootprint<std::uint16_t>(wrappers,
"U");
93 declareHeavyFootprint<float>(wrappers,
"F");
94 declareHeavyFootprint<double>(wrappers,
"D");