22 #include "pybind11/pybind11.h" 
   23 #include "pybind11/stl.h" 
   28 using namespace pybind11::literals;
 
   32 namespace algorithms {
 
   35 template <
typename PixelT>
 
   36 static void declareFunctions(
py::module &mod) {
 
   37     using MaskedImageT = afw::image::MaskedImage<PixelT, afw::image::MaskPixel, afw::image::VariancePixel>;
 
   39     mod.def(
"createKernelFromPsfCandidates", createKernelFromPsfCandidates<PixelT>, 
"psfCells"_a, 
"dims"_a,
 
   40             "xy0"_a, 
"nEigenComponents"_a, 
"spatialOrder"_a, 
"ksize"_a, 
"nStarPerCell"_a = -1,
 
   41             "constantWeight"_a = 
true, 
"border"_a = 3);
 
   42     mod.def(
"countPsfCandidates", countPsfCandidates<PixelT>, 
"psfCells"_a, 
"nStarPerCell"_a = -1);
 
   43     mod.def(
"fitSpatialKernelFromPsfCandidates",
 
   45                                         double const, 
double const))fitSpatialKernelFromPsfCandidates<PixelT>,
 
   46             "kernel"_a, 
"psfCells"_a, 
"nStarPerCell"_a = -1, 
"tolerance"_a = 1e-5, 
"lambda"_a = 0.0);
 
   47     mod.def(
"fitSpatialKernelFromPsfCandidates",
 
   49                                         int const, 
double const,
 
   50                                         double const))fitSpatialKernelFromPsfCandidates<PixelT>,
 
   51             "kernel"_a, 
"psfCells"_a, 
"doNonLinearFit"_a, 
"nStarPerCell"_a = -1, 
"tolerance"_a = 1e-5,
 
   53     mod.def(
"subtractPsf", subtractPsf<MaskedImageT>, 
"psf"_a, 
"data"_a, 
"x"_a, 
"y"_a,
 
   55     mod.def(
"fitKernelParamsToImage", fitKernelParamsToImage<MaskedImageT>, 
"kernel"_a, 
"image"_a, 
"pos"_a);
 
   56     mod.def(
"fitKernelToImage", fitKernelToImage<MaskedImageT>, 
"kernel"_a, 
"image"_a, 
"pos"_a);
 
   60     declareFunctions<float>(mod);