LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
LSSTDataManagementBasePackage
Functions
kernel.cc File Reference
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "lsst/afw/math/Kernel.h"
#include "lsst/afw/table/io/python.h"

Go to the source code of this file.

Functions

 PYBIND11_MODULE (kernel, mod)
 

Function Documentation

◆ PYBIND11_MODULE()

PYBIND11_MODULE ( kernel  ,
mod   
)

Definition at line 36 of file kernel.cc.

36  {
37  py::class_<Kernel, std::shared_ptr<Kernel>> clsKernel(mod, "Kernel");
38 
39  lsst::afw::table::io::python::addPersistableMethods<Kernel>(clsKernel);
40 
41  clsKernel.def("clone", &Kernel::clone);
42  clsKernel.def("resized", &Kernel::resized, "width"_a, "height"_a);
43  clsKernel.def("computeImage", &Kernel::computeImage, "image"_a, "doNormalize"_a, "x"_a = 0.0,
44  "y"_a = 0.0);
45  clsKernel.def("getDimensions", &Kernel::getDimensions);
46  clsKernel.def("setDimensions", &Kernel::setDimensions);
47  clsKernel.def("setWidth", &Kernel::setWidth);
48  clsKernel.def("setHeight", &Kernel::setHeight);
49  clsKernel.def("getWidth", &Kernel::getWidth);
50  clsKernel.def("getHeight", &Kernel::getHeight);
51  clsKernel.def("getCtr", &Kernel::getCtr);
52  clsKernel.def("getCtrX", &Kernel::getCtrX);
53  clsKernel.def("getCtrY", &Kernel::getCtrY);
54  clsKernel.def("getBBox", &Kernel::getBBox);
55  clsKernel.def("getNKernelParameters", &Kernel::getNKernelParameters);
56  clsKernel.def("getNSpatialParameters", &Kernel::getNSpatialParameters);
57  clsKernel.def("getSpatialFunction", &Kernel::getSpatialFunction);
58  clsKernel.def("getSpatialFunctionList", &Kernel::getSpatialFunctionList);
59  clsKernel.def("getKernelParameter", &Kernel::getKernelParameter);
60  clsKernel.def("getKernelParameters", &Kernel::getKernelParameters);
61  clsKernel.def("growBBox", &Kernel::growBBox);
62  clsKernel.def("shrinkBBox", &Kernel::shrinkBBox);
63  clsKernel.def("setCtr", &Kernel::setCtr);
64  clsKernel.def("setCtrX", &Kernel::setCtrX);
65  clsKernel.def("setCtrY", &Kernel::setCtrY);
66  clsKernel.def("getSpatialParameters", &Kernel::getSpatialParameters);
67  clsKernel.def("isSpatiallyVarying", &Kernel::isSpatiallyVarying);
68  clsKernel.def("setKernelParameters",
69  (void (Kernel::*)(std::vector<double> const &)) & Kernel::setKernelParameters);
70  clsKernel.def("setKernelParameters",
71  (void (Kernel::*)(std::pair<double, double> const &)) & Kernel::setKernelParameters);
72  clsKernel.def("setSpatialParameters", &Kernel::setSpatialParameters);
73  clsKernel.def("computeKernelParametersFromSpatialModel",
74  &Kernel::computeKernelParametersFromSpatialModel);
75  clsKernel.def("toString", &Kernel::toString, "prefix"_a = "");
76  clsKernel.def("computeCache", &Kernel::computeCache);
77  clsKernel.def("getCacheSize", &Kernel::getCacheSize);
78 
79  py::class_<FixedKernel, std::shared_ptr<FixedKernel>, Kernel> clsFixedKernel(mod, "FixedKernel");
80 
81  clsFixedKernel.def(py::init<>());
82  clsFixedKernel.def(py::init<lsst::afw::image::Image<Kernel::Pixel> const &>(), "image"_a);
83  clsFixedKernel.def(py::init<lsst::afw::math::Kernel const &, lsst::geom::Point2D const &>(),
84  "kernel"_a, "pos"_a);
85  clsFixedKernel.def("clone", &FixedKernel::clone);
86  clsFixedKernel.def("resized", &FixedKernel::resized, "width"_a, "height"_a);
87  clsFixedKernel.def("toString", &FixedKernel::toString, "prefix"_a = "");
88  clsFixedKernel.def("getSum", &FixedKernel::getSum);
89  clsFixedKernel.def("isPersistable", &FixedKernel::isPersistable);
90 
91  py::class_<AnalyticKernel, std::shared_ptr<AnalyticKernel>, Kernel> clsAnalyticKernel(mod,
92  "AnalyticKernel");
93  clsAnalyticKernel.def(py::init<>());
94  // Workaround for NullSpatialFunction and py::arg not playing well with Citizen
95  clsAnalyticKernel.def(py::init<int, int, AnalyticKernel::KernelFunction const &>(), "width"_a, "height"_a,
96  "kernelFunction"_a);
97  clsAnalyticKernel.def(
98  py::init<int, int, AnalyticKernel::KernelFunction const &, Kernel::SpatialFunction const &>(),
99  "width"_a, "height"_a, "kernelFunction"_a, "spatialFunction"_a);
100  clsAnalyticKernel.def(py::init<int, int, AnalyticKernel::KernelFunction const &,
102  "width"_a, "height"_a, "kernelFunction"_a, "spatialFunctionList"_a);
103  clsAnalyticKernel.def("clone", &AnalyticKernel::clone);
104  clsAnalyticKernel.def("resized", &AnalyticKernel::resized, "width"_a, "height"_a);
105  clsAnalyticKernel.def("computeImage", &AnalyticKernel::computeImage, "image"_a, "doNormalize"_a,
106  "x"_a = 0.0, "y"_a = 0.0);
107  clsAnalyticKernel.def("getKernelParameters", &AnalyticKernel::getKernelParameters);
108  clsAnalyticKernel.def("getKernelFunction", &AnalyticKernel::getKernelFunction);
109  clsAnalyticKernel.def("toString", &AnalyticKernel::toString, "prefix"_a = "");
110  clsAnalyticKernel.def("isPersistable", &AnalyticKernel::isPersistable);
111 
112  py::class_<DeltaFunctionKernel, std::shared_ptr<DeltaFunctionKernel>, Kernel> clsDeltaFunctionKernel(
113  mod, "DeltaFunctionKernel");
114 
115  clsDeltaFunctionKernel.def(py::init<int, int, lsst::geom::Point2I const &>(), "width"_a, "height"_a,
116  "point"_a);
117  clsDeltaFunctionKernel.def("clone", &DeltaFunctionKernel::clone);
118  clsDeltaFunctionKernel.def("resized", &DeltaFunctionKernel::resized, "width"_a, "height"_a);
119  clsDeltaFunctionKernel.def("getPixel", &DeltaFunctionKernel::getPixel);
120  clsDeltaFunctionKernel.def("toString", &DeltaFunctionKernel::toString, "prefix"_a = "");
121  clsDeltaFunctionKernel.def("isPersistable", &DeltaFunctionKernel::isPersistable);
122 
123  py::class_<LinearCombinationKernel, std::shared_ptr<LinearCombinationKernel>, Kernel>
124  clsLinearCombinationKernel(mod, "LinearCombinationKernel");
125 
126  clsLinearCombinationKernel.def(py::init<>());
127  clsLinearCombinationKernel.def(py::init<KernelList const &, std::vector<double> const &>(),
128  "kernelList"_a, "kernelParameters"_a);
129  clsLinearCombinationKernel.def(py::init<KernelList const &, Kernel::SpatialFunction const &>(),
130  "kernelList"_a, "spatialFunction"_a);
131  clsLinearCombinationKernel.def(
132  py::init<KernelList const &, std::vector<Kernel::SpatialFunctionPtr> const &>(), "kernelList"_a,
133  "spatialFunctionList"_a);
134  clsLinearCombinationKernel.def("clone", &LinearCombinationKernel::clone);
135  clsLinearCombinationKernel.def("resized", &LinearCombinationKernel::resized, "width"_a, "height"_a);
136  clsLinearCombinationKernel.def("getKernelParameters", &LinearCombinationKernel::getKernelParameters);
137  clsLinearCombinationKernel.def("getKernelList", &LinearCombinationKernel::getKernelList);
138  clsLinearCombinationKernel.def("getKernelSumList", &LinearCombinationKernel::getKernelSumList);
139  clsLinearCombinationKernel.def("getNBasisKernels", &LinearCombinationKernel::getNBasisKernels);
140  clsLinearCombinationKernel.def("checkKernelList", &LinearCombinationKernel::checkKernelList);
141  clsLinearCombinationKernel.def("isDeltaFunctionBasis", &LinearCombinationKernel::isDeltaFunctionBasis);
142  clsLinearCombinationKernel.def("refactor", &LinearCombinationKernel::refactor);
143  clsLinearCombinationKernel.def("toString", &LinearCombinationKernel::toString, "prefix"_a = "");
144  clsLinearCombinationKernel.def("isPersistable", &LinearCombinationKernel::isPersistable);
145 
146  py::class_<SeparableKernel, std::shared_ptr<SeparableKernel>, Kernel> clsSeparableKernel(
147  mod, "SeparableKernel");
148 
149  clsSeparableKernel.def(py::init<>());
150  // Workaround for NullSpatialFunction and py::arg not playing well with Citizen
151  clsSeparableKernel.def(py::init<int, int, SeparableKernel::KernelFunction const &,
153  "width"_a, "height"_a, "kernelColFunction"_a, "kernelRowFunction"_a);
154  clsSeparableKernel.def(
155  py::init<int, int, SeparableKernel::KernelFunction const &,
157  "width"_a, "height"_a, "kernelColFunction"_a, "kernelRowFunction"_a, "spatialFunction"_a);
158  clsSeparableKernel.def(py::init<int, int, SeparableKernel::KernelFunction const &,
161  "width"_a, "height"_a, "kernelColFunction"_a, "kernelRowFunction"_a,
162  "spatialFunctionList"_a);
163  clsSeparableKernel.def("clone", &SeparableKernel::clone);
164  clsSeparableKernel.def("resized", &SeparableKernel::resized, "width"_a, "height"_a);
165  clsSeparableKernel.def("computeVectors", &SeparableKernel::computeVectors);
166  clsSeparableKernel.def("getKernelParameter", &SeparableKernel::getKernelParameter);
167  clsSeparableKernel.def("getKernelParameters", &SeparableKernel::getKernelParameters);
168  clsSeparableKernel.def("getKernelColFunction", &SeparableKernel::getKernelColFunction);
169  clsSeparableKernel.def("getKernelRowFunction", &SeparableKernel::getKernelRowFunction);
170  clsSeparableKernel.def("toString", &SeparableKernel::toString, "prefix"_a = "");
171  clsSeparableKernel.def("computeCache", &SeparableKernel::computeCache);
172  clsSeparableKernel.def("getCacheSize", &SeparableKernel::getCacheSize);
173 }
def init()
Definition: tests.py:75
A Function taking two arguments.
Definition: Function.h:261
void setSpatialParameters(afw::math::Kernel *kernel, std::vector< double > const &coeffs)
Fit a Kernel&#39;s spatial variability from a set of stars.
A Function taking one argument.
Definition: Function.h:204
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition: Kernel.h:112
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:59