24 #include "pybind11/pybind11.h" 25 #include "pybind11/stl.h" 27 #include "lsst/pex/config/python.h" 31 namespace py = pybind11;
39 using PyPixelFitRegionControl = py::class_<PixelFitRegionControl, std::shared_ptr<PixelFitRegionControl>>;
40 using PyPixelFitRegion = py::class_<PixelFitRegion, std::shared_ptr<PixelFitRegion>>;
42 PYBIND11_PLUGIN(pixelFitRegion) {
43 py::module::import(
"lsst.afw.image");
44 py::module::import(
"lsst.afw.detection");
45 py::module::import(
"lsst.afw.geom.ellipses");
49 using Control = PixelFitRegionControl;
51 PyPixelFitRegionControl clsControl(mod,
"PixelFitRegionControl");
52 clsControl.def(py::init<>());
53 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, nKronRadii);
54 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, nPsfSigmaMin);
55 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, nPsfSigmaGrow);
56 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, nFitRadiiMin);
57 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, nFitRadiiMax);
58 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, maxArea);
59 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, badMaskPlanes);
60 LSST_DECLARE_CONTROL_FIELD(clsControl,
Control, maxBadPixelFraction);
62 PyPixelFitRegion cls(mod,
"PixelFitRegion");
63 cls.def(py::init<
Control const &, afw::geom::ellipses::Quadrupole
const &,
64 afw::geom::ellipses::Quadrupole
const &,
Scalar,
int>(),
65 "ctrl"_a,
"moments"_a,
"psfMoments"_a,
"kronRadius"_a,
"footprintArea"_a);
66 cls.def(py::init<Control const &, afw::geom::ellipses::Quadrupole const &>(),
"ctrl"_a,
"ellipse"_a);
67 cls.def(
"applyEllipse", &PixelFitRegion::applyEllipse,
"deconvolved"_a,
"psfMoments"_a);
68 cls.def(
"applyMask", &PixelFitRegion::applyMask,
"mask"_a,
"center"_a);
71 cls.def_readonly(
"ellipse", &PixelFitRegion::ellipse);
72 cls.def_readonly(
"footprint", &PixelFitRegion::footprint);
73 cls.def_readonly(
"usedFootprintArea", &PixelFitRegion::usedFootprintArea);
74 cls.def_readonly(
"usedPsfArea", &PixelFitRegion::usedPsfArea);
75 cls.def_readonly(
"maxArea", &PixelFitRegion::maxArea);
76 cls.def_readonly(
"maxBadPixelFraction", &PixelFitRegion::maxBadPixelFraction);
77 cls.def_readonly(
"usedMinEllipse", &PixelFitRegion::usedMinEllipse);
78 cls.def_readonly(
"usedMaxEllipse", &PixelFitRegion::usedMaxEllipse);
double Scalar
Typedefs to be used for probability and parameter values.