22 #include "pybind11/pybind11.h" 26 namespace py = pybind11;
31 namespace algorithms {
34 template <
typename PixelT>
35 void declarePsfCandidate(py::module& mod, std::string
const& suffix) {
36 using Class = PsfCandidate<PixelT>;
38 py::class_<Class, std::shared_ptr<Class>, lsst::afw::math::SpatialCellImageCandidate> cls(
39 mod, (
"PsfCandidate" + suffix).c_str());
41 cls.def(py::init<std::shared_ptr<afw::table::SourceRecord>
const&,
42 std::shared_ptr<afw::image::Exposure<PixelT>
const>>(),
43 "source"_a,
"parentExposure"_a);
44 cls.def(py::init<std::shared_ptr<afw::table::SourceRecord>
const&,
45 std::shared_ptr<afw::image::Exposure<PixelT>
const>,
double,
double>(),
46 "source"_a,
"parentExposure"_a,
"xCenter"_a,
"yCenter"_a);
52 cls.def(
"_getCandidateRating", &Class::getCandidateRating);
53 cls.def(
"getSource", &Class::getSource);
54 cls.def(
"getAmplitude", &Class::getAmplitude);
55 cls.def(
"setAmplitude", &Class::setAmplitude);
56 cls.def(
"getVar", &Class::getVar);
57 cls.def(
"setVar", &Class::setVar);
58 cls.def(
"getMaskedImage", (std::shared_ptr<afw::image::MaskedImage<PixelT>
const> (Class::*)()
const) &
59 Class::getMaskedImage);
60 cls.def(
"getMaskedImage",
61 (std::shared_ptr<afw::image::MaskedImage<PixelT>
const> (Class::*)(
int,
int)
const) &
62 Class::getMaskedImage,
63 "width"_a,
"height"_a);
64 cls.def(
"getOffsetImage", &Class::getOffsetImage);
65 cls.def_static(
"getBorderWidth", &Class::getBorderWidth);
66 cls.def_static(
"setBorderWidth", &Class::setBorderWidth);
67 cls.def_static(
"setPixelThreshold", &Class::setPixelThreshold);
68 cls.def_static(
"getPixelThreshold", &Class::getPixelThreshold);
69 cls.def_static(
"setMaskBlends", &Class::setMaskBlends);
70 cls.def_static(
"getMaskBlends", &Class::getMaskBlends);
72 mod.def(
"makePsfCandidate", makePsfCandidate<PixelT>,
"source"_a,
"image"_a);
78 py::module mod(
"psfCandidate");
80 declarePsfCandidate<float>(mod,
"F");
PYBIND11_PLUGIN(psfCandidate)
Class used by SpatialCell for spatial PSF fittig.