22 #include "pybind11/pybind11.h" 23 #include "pybind11/stl.h" 25 #include "ndarray/pybind11.h" 37 template <
typename PyClass>
38 void declareMultiShapeletFunctionMembers(PyClass &
cls) {
39 using Class = MultiShapeletFunction;
41 cls.def(py::init<>());
42 cls.def(py::init<Class const &>());
43 cls.def(py::init<typename Class::ComponentList const &>());
44 cls.def(py::init<ShapeletFunction const &>());
46 cls.def(
"getComponents", [](Class
const &
self) {
50 for (
size_t i = 0; i <
components.size(); ++i) {
56 cls.def(
"addComponent",
57 [](Class &
self,
typename Class::Component
const &c) {
self.getComponents().push_back(c); });
58 cls.def(
"normalize", &Class::normalize,
"value"_a = 1.0);
59 cls.def(
"shiftInPlace", &Class::shiftInPlace);
60 cls.def(
"transformInPlace", &Class::transformInPlace);
61 cls.def(
"convolve", (Class (Class::*)(ShapeletFunction
const &)
const) &
Class::convolve);
62 cls.def(
"convolve", (Class (Class::*)(Class
const &)
const) & Class::convolve);
63 cls.def(
"evaluate", &Class::evaluate);
66 template <
typename PyClass>
67 void declareMultiShapeletFunctionEvaluatorMembers(PyClass &cls) {
68 using Class = MultiShapeletFunctionEvaluator;
70 cls.def(py::init<MultiShapeletFunction const &>());
72 cls.def(
"__call__", (
double (Class::*)(
double,
double)
const) & Class::operator());
73 cls.def(
"__call__", (
double (Class::*)(
afw::geom::Point2D const &)
const) & Class::operator());
74 cls.def(
"__call__", (
double (Class::*)(
afw::geom::Extent2D const &)
const) & Class::operator());
76 (ndarray::Array<double, 1, 1> (Class::*)(ndarray::Array<double const, 1>
const &,
77 ndarray::Array<double const, 1>
const &)
const) &
81 (
void (Class::*)(ndarray::Array<double, 2, 1>
const &,
afw::geom::Point2I const &)
const) &
84 cls.def(
"addToImage", (
void (Class::*)(afw::image::Image<double> &)
const) & Class::addToImage,
88 cls.def(
"computeMoments", &Class::computeMoments);
89 cls.def(
"update", &Class::update);
95 py::module::import(
"lsst.afw.geom");
96 py::module::import(
"lsst.afw.image");
98 py::class_<MultiShapeletFunction, std::shared_ptr<MultiShapeletFunction>> clsMultiShapeletFunction(
99 mod,
"MultiShapeletFunction");
100 py::class_<MultiShapeletFunctionEvaluator, std::shared_ptr<MultiShapeletFunctionEvaluator>>
101 clsMultiShapeletFunctionEvaluator(mod,
"MultiShapeletFunctionEvaluator");
103 declareMultiShapeletFunctionMembers(clsMultiShapeletFunction);
104 declareMultiShapeletFunctionEvaluatorMembers(clsMultiShapeletFunctionEvaluator);
table::Key< table::Array< int > > components
PYBIND11_MODULE(multiShapeletFunction, mod)
Point< double, 2 > Point2D
A base class for image defects.
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, ConvolutionControl const &convolutionControl=ConvolutionControl())
Convolve an Image or MaskedImage with a Kernel, setting pixels of an existing output image...
void addToImage(boost::shared_ptr< afw::image::Image< double > > image, std::vector< boost::shared_ptr< afw::image::Image< double > >> const &imgVector, std::vector< double > const &weightVector)
Extent< double, 2 > Extent2D
UnaryFunctionT::result_type integrate(UnaryFunctionT func, typename UnaryFunctionT::argument_type const a, typename UnaryFunctionT::argument_type const b, double eps=1.0e-6)
The 1D integrator.