22 #include "pybind11/pybind11.h"
23 #include "pybind11/eigen.h"
24 #include "pybind11/stl.h"
27 #include "ndarray/pybind11.h"
36 using namespace pybind11::literals;
51 template <
typename PixelT>
54 afw::math::SpatialCellImageCandidate>
55 cls(mod, (
"KernelCandidate" + suffix).c_str());
57 using CandidateSwitch =
typename KernelCandidate<PixelT>::CandidateSwitch;
59 py::enum_<CandidateSwitch>(
cls,
"CandidateSwitch")
60 .value(
"ORIG", CandidateSwitch::ORIG)
61 .value(
"PCA", CandidateSwitch::PCA)
62 .value(
"RECENT", CandidateSwitch::RECENT)
66 std::shared_ptr<afw::image::MaskedImage<PixelT>>
const &, daf::base::PropertySet
const &>(),
67 "xCenter"_a,
"yCenter"_a,
"templateMaskedImage"_a,
"scienceMaskedImage"_a,
"ps"_a);
70 std::shared_ptr<afw::image::MaskedImage<PixelT>>
const &, daf::base::PropertySet
const &>(),
71 "source"_a,
"templateMaskedImage"_a,
"scienceMaskedImage"_a,
"ps"_a);
73 cls.def(
"getCandidateRating", &KernelCandidate<PixelT>::getCandidateRating);
74 cls.def(
"getSource", &KernelCandidate<PixelT>::getSource);
75 cls.def(
"getTemplateMaskedImage", &KernelCandidate<PixelT>::getTemplateMaskedImage);
76 cls.def(
"getScienceMaskedImage", &KernelCandidate<PixelT>::getScienceMaskedImage);
77 cls.def(
"getKernel", &KernelCandidate<PixelT>::getKernel,
"cand"_a);
78 cls.def(
"getBackground", &KernelCandidate<PixelT>::getBackground,
"cand"_a);
79 cls.def(
"getKsum", &KernelCandidate<PixelT>::getKsum,
"cand"_a);
80 cls.def(
"getKernelImage", &KernelCandidate<PixelT>::getKernelImage,
"cand"_a);
81 cls.def(
"getImage", &KernelCandidate<PixelT>::getImage);
82 cls.def(
"getKernelSolution", &KernelCandidate<PixelT>::getKernelSolution,
"cand"_a);
83 cls.def(
"getDifferenceImage",
84 (afw::image::MaskedImage<PixelT> (KernelCandidate<PixelT>::*)(CandidateSwitch)) &
85 KernelCandidate<PixelT>::getDifferenceImage,
87 cls.def(
"getDifferenceImage", (afw::image::MaskedImage<PixelT> (KernelCandidate<PixelT>::*)(
89 KernelCandidate<PixelT>::getDifferenceImage,
90 "kernel"_a,
"background"_a);
91 cls.def(
"isInitialized", &KernelCandidate<PixelT>::isInitialized);
93 KernelCandidate<PixelT>::build,
97 KernelCandidate<PixelT>::build,
98 "basisList"_a,
"hMat"_a);
99 mod.def(
"makeKernelCandidate",
101 float const,
float const,
std::shared_ptr<afw::image::MaskedImage<PixelT>>
const &,
102 std::shared_ptr<afw::image::MaskedImage<PixelT>>
const &, daf::base::PropertySet
const &)) &
104 "xCenter"_a,
"yCenter"_a,
"templateMaskedImage"_a,
"scienceMaskedImage"_a,
"ps"_a);
105 mod.def(
"makeKernelCandidate",
109 std::shared_ptr<afw::image::MaskedImage<PixelT>>
const &, daf::base::PropertySet
const &)) &
111 "source"_a,
"templateMaskedImage"_a,
"scienceMaskedImage"_a,
"ps"_a);
117 py::module::import(
"lsst.afw.image");
118 py::module::import(
"lsst.afw.math");
119 py::module::import(
"lsst.afw.table");
120 py::module::import(
"lsst.daf.base");
122 declareKernelCandidate<float>(mod,
"F");