22 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
27 namespace py = pybind11;
28 using namespace pybind11::literals;
32 namespace algorithms {
35 template <
typename PixelT>
36 static void declareFunctions(py::module &mod) {
37 using MaskedImageT = lsst::afw::image::MaskedImage<PixelT, lsst::afw::image::MaskPixel,
38 lsst::afw::image::VariancePixel>;
40 mod.def(
"createKernelFromPsfCandidates", createKernelFromPsfCandidates<PixelT>,
"psfCells"_a,
"dims"_a,
41 "xy0"_a,
"nEigenComponents"_a,
"spatialOrder"_a,
"ksize"_a,
"nStarPerCell"_a = -1,
42 "constantWeight"_a =
true,
"border"_a = 3);
43 mod.def(
"countPsfCandidates", countPsfCandidates<PixelT>,
"psfCells"_a,
"nStarPerCell"_a = -1);
44 mod.def(
"fitSpatialKernelFromPsfCandidates",
45 (std::pair<bool, double>(*)(lsst::afw::math::Kernel *, lsst::afw::math::SpatialCellSet
const &,
46 int const,
double const,
47 double const))fitSpatialKernelFromPsfCandidates<PixelT>,
48 "kernel"_a,
"psfCells"_a,
"nStarPerCell"_a = -1,
"tolerance"_a = 1e-5,
"lambda"_a = 0.0);
49 mod.def(
"fitSpatialKernelFromPsfCandidates",
50 (std::pair<bool, double>(*)(lsst::afw::math::Kernel *, lsst::afw::math::SpatialCellSet
const &,
51 bool const,
int const,
double const,
52 double const))fitSpatialKernelFromPsfCandidates<PixelT>,
53 "kernel"_a,
"psfCells"_a,
"doNonLinearFit"_a,
"nStarPerCell"_a = -1,
"tolerance"_a = 1e-5,
55 mod.def(
"subtractPsf", subtractPsf<MaskedImageT>,
"psf"_a,
"data"_a,
"x"_a,
"y"_a,
56 "psfFlux"_a = std::numeric_limits<double>::quiet_NaN());
57 mod.def(
"fitKernelParamsToImage", fitKernelParamsToImage<MaskedImageT>,
"kernel"_a,
"image"_a,
"pos"_a);
58 mod.def(
"fitKernelToImage", fitKernelToImage<MaskedImageT>,
"kernel"_a,
"image"_a,
"pos"_a);
64 py::module mod(
"spatialModelPsf");
67 declareFunctions<float>(mod);
Class used by SpatialCell for spatial PSF fittig.
PYBIND11_PLUGIN(binnedWcs)