22 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
29 #include "numpy/arrayobject.h"
30 #include "ndarray/pybind11.h"
32 #include "lsst/afw/math/Kernel.h"
33 #include "lsst/afw/math/SpatialCell.h"
35 #include "lsst/pex/policy/Policy.h"
37 namespace py = pybind11;
38 using namespace pybind11::literals;
54 template <
typename PixelT>
55 void declareBuildSingleKernelVisitor(py::module& mod, std::string
const& suffix) {
56 py::class_<BuildSingleKernelVisitor<PixelT>, std::shared_ptr<BuildSingleKernelVisitor<PixelT>>,
57 afw::math::CandidateVisitor>
58 cls(mod, (
"BuildSingleKernelVisitor" + suffix).c_str());
60 cls.def(py::init<afw::math::KernelList, pex::policy::Policy>(),
"basisList"_a,
"policy"_a);
61 cls.def(py::init<afw::math::KernelList, pex::policy::Policy, Eigen::MatrixXd const&>(),
"basisList"_a,
62 "policy"_a,
"hMat"_a);
64 cls.def(
"setSkipBuilt", &BuildSingleKernelVisitor<PixelT>::setSkipBuilt,
"skip"_a);
65 cls.def(
"getNRejected", &BuildSingleKernelVisitor<PixelT>::getNRejected);
66 cls.def(
"getNProcessed", &BuildSingleKernelVisitor<PixelT>::getNProcessed);
67 cls.def(
"reset", &BuildSingleKernelVisitor<PixelT>::reset);
68 cls.def(
"processCandidate", &BuildSingleKernelVisitor<PixelT>::processCandidate,
"candidate"_a);
70 mod.def(
"makeBuildSingleKernelVisitor",
71 (std::shared_ptr<BuildSingleKernelVisitor<PixelT>>(*)(afw::math::KernelList
const&,
72 pex::policy::Policy
const&)) &
74 "basisList"_a,
"policy"_a);
75 mod.def(
"makeBuildSingleKernelVisitor",
76 (std::shared_ptr<BuildSingleKernelVisitor<PixelT>>(*)(
77 afw::math::KernelList
const&, pex::policy::Policy
const&, Eigen::MatrixXd
const&)) &
78 makeBuildSingleKernelVisitor<PixelT>,
79 "basisList"_a,
"policy"_a,
"hMat"_a);
85 py::module::import(
"lsst.afw.math");
86 py::module::import(
"lsst.pex.policy");
88 py::module mod(
"buildSingleKernelVisitor");
91 if (_import_array() < 0) {
92 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
96 declareBuildSingleKernelVisitor<float>(mod,
"F");
template std::shared_ptr< BuildSingleKernelVisitor< PixelT > > makeBuildSingleKernelVisitor< PixelT >(lsst::afw::math::KernelList const &, lsst::pex::policy::Policy const &)
Declaration of BuildSingleKernelVisitor.
PYBIND11_PLUGIN(basisLists)