22 #include "pybind11/pybind11.h"
25 #include "numpy/arrayobject.h"
26 #include "ndarray/pybind11.h"
28 #include "lsst/afw/image/Image.h"
29 #include "lsst/afw/image/MaskedImage.h"
30 #include "lsst/afw/math/Function.h"
31 #include "lsst/afw/math/Kernel.h"
34 namespace py = pybind11;
35 using namespace pybind11::literals;
52 template <
typename PixelT,
typename BackgroundT>
53 void declareConvolveAndSubtract(py::module &mod) {
54 mod.def(
"convolveAndSubtract",
55 (afw::image::MaskedImage<PixelT>(*)(afw::image::MaskedImage<PixelT>
const &,
56 afw::image::MaskedImage<PixelT>
const &,
57 afw::math::Kernel
const &, BackgroundT,
bool)) &
59 "templateImage"_a,
"scienceMaskedImage"_a,
"convolutionKernel"_a,
"background"_a,
62 mod.def(
"convolveAndSubtract",
63 (afw::image::MaskedImage<PixelT>(*)(afw::image::Image<PixelT>
const &,
64 afw::image::MaskedImage<PixelT>
const &,
65 afw::math::Kernel
const &, BackgroundT,
bool)) &
67 "templateImage"_a,
"scienceMaskedImage"_a,
"convolutionKernel"_a,
"background"_a,
74 py::module::import(
"lsst.afw.image");
75 py::module::import(
"lsst.afw.math");
77 py::module mod(
"imageSubtract");
80 if (_import_array() < 0) {
81 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
85 declareConvolveAndSubtract<float, double>(mod);
86 declareConvolveAndSubtract<float, afw::math::Function2<double>
const &>(mod);
lsst::afw::image::MaskedImage< PixelT > convolveAndSubtract(lsst::afw::image::MaskedImage< PixelT > const &templateImage, lsst::afw::image::MaskedImage< PixelT > const &scienceMaskedImage, lsst::afw::math::Kernel const &convolutionKernel, BackgroundT background, bool invert=true)
Execute fundamental task of convolving template and subtracting it from science image.
PYBIND11_PLUGIN(basisLists)
Image Subtraction helper functions.