22 #include "pybind11/pybind11.h"
23 #include "pybind11/eigen.h"
24 #include "pybind11/stl.h"
35 using namespace pybind11::literals;
51 template <
typename PixelT>
53 using ImageT = afw::image::Image<PixelT>;
55 mod, (
"KernelPca" + suffix).c_str());
57 cls.def(py::init<bool>(),
"constantWeight"_a =
true);
59 cls.def(
"analyze", &KernelPca<ImageT>::analyze);
69 template <
typename PixelT>
72 afw::math::CandidateVisitor>
73 cls(mod, (
"KernelPcaVisitor" + suffix).c_str());
77 using KernelImageT =
typename KernelPcaVisitor<PixelT>::ImageT;
80 cls.def(
"getEigenKernels", &KernelPcaVisitor<PixelT>::getEigenKernels);
81 cls.def(
"processCandidate", &KernelPcaVisitor<PixelT>::processCandidate,
"candidate"_a);
82 cls.def(
"subtractMean", &KernelPcaVisitor<PixelT>::subtractMean);
83 cls.def(
"returnMean", &KernelPcaVisitor<PixelT>::returnMean);
85 mod.def(
"makeKernelPcaVisitor", &makeKernelPcaVisitor<PixelT>,
"imagePca"_a);
91 py::module::import(
"lsst.afw.image");
92 py::module::import(
"lsst.afw.math");
94 declareKernelPca<afw::math::Kernel::Pixel>(mod,
"D");
95 declareKernelPcaVisitor<float>(mod,
"F");