22 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
33 using namespace pybind11::literals;
47 using Class = BaselineUtils<ImagePixelT, MaskPixelT, VariancePixelT>;
49 py::class_<Class, std::shared_ptr<Class>>
cls(mod, (
"BaselineUtils" + suffix).c_str());
50 cls.def_static(
"symmetrizeFootprint", &Class::symmetrizeFootprint,
"foot"_a,
"cx"_a,
"cy"_a);
55 cls.def_static(
"buildSymmetricTemplate", [](MaskedImageT
const& img,
58 bool minZero,
bool patchEdges) {
62 result = Class::buildSymmetricTemplate(img, foot, pk,
sigma1, minZero, patchEdges, &patchedEdges);
63 return py::make_tuple(
result.first,
result.second, patchedEdges);
65 cls.def_static(
"medianFilter", &Class::medianFilter,
"img"_a,
"outimg"_a,
"halfsize"_a);
66 cls.def_static(
"makeMonotonic", &Class::makeMonotonic,
"img"_a,
"pk"_a);
78 int strayFluxOptions,
double clipStrayFluxFraction) {
84 HeavyFootprintPtrList strays;
86 strays, strayFluxOptions, clipStrayFluxFraction);
88 return py::make_tuple(
result, strays);
90 cls.def_static(
"hasSignificantFluxAtEdge", &Class::hasSignificantFluxAtEdge,
"img"_a,
"sfoot"_a,
92 cls.def_static(
"getSignificantEdgePixels", &Class::getSignificantEdgePixels,
"img"_a,
"sfoot"_a,
96 cls.attr(
"ASSIGN_STRAYFLUX") = py::cast(Class::ASSIGN_STRAYFLUX);
97 cls.attr(
"STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY") =
98 py::cast(Class::STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY);
99 cls.attr(
"STRAYFLUX_TO_POINT_SOURCES_ALWAYS") = py::cast(Class::STRAYFLUX_TO_POINT_SOURCES_ALWAYS);
100 cls.attr(
"STRAYFLUX_R_TO_FOOTPRINT") = py::cast(Class::STRAYFLUX_R_TO_FOOTPRINT);
101 cls.attr(
"STRAYFLUX_NEAREST_FOOTPRINT") = py::cast(Class::STRAYFLUX_NEAREST_FOOTPRINT);
102 cls.attr(
"STRAYFLUX_TRIM") = py::cast(Class::STRAYFLUX_TRIM);
108 py::module::import(
"lsst.afw.image");
109 py::module::import(
"lsst.afw.detection");
111 declareBaselineUtils<float>(mod,
"F");