23 #include <pybind11/pybind11.h>
24 #include <pybind11/stl.h>
28 #include "numpy/arrayobject.h"
29 #include "ndarray/pybind11.h"
30 #include "ndarray/converter.h"
36 namespace py = pybind11;
38 using namespace lsst::afw::math;
39 using namespace py::literals;
48 template <
typename PixelT>
50 cls.def(
"fillImage", &BoundedField::fillImage<PixelT>,
"image"_a,
"overlapOnly"_a =
false);
51 cls.def(
"addToImage", &BoundedField::addToImage<PixelT>,
"image"_a,
"scaleBy"_a = 1.0,
52 "overlapOnly"_a =
false);
53 cls.def(
"multiplyImage", &BoundedField::multiplyImage<PixelT>,
"image"_a,
"overlapOnly"_a =
false);
54 cls.def(
"divideImage", &BoundedField::divideImage<PixelT>,
"image"_a,
"overlapOnly"_a =
false);
58 py::module mod(
"_boundedField",
"Python wrapper for afw _boundedField library");
60 if (_import_array() < 0) {
61 PyErr_SetString(PyExc_ImportError,
"numpy.core.multiarray failed to import");
65 PyClass
cls(mod,
"BoundedField");
67 cls.def(
"__mul__", &BoundedField::operator*);
68 cls.def(
"__truediv__", &BoundedField::operator/);
72 (ndarray::Array<double, 1, 1> (
BoundedField::*)(ndarray::Array<double const, 1>
const &,
73 ndarray::Array<double const, 1>
const &)
const) &
74 BoundedField::evaluate);
82 declareTemplates<double>(
cls);
83 declareTemplates<float>(
cls);
86 std::ostringstream os;
91 std::ostringstream os;
92 os <<
"BoundedField(" <<
self <<
")";
virtual double evaluate(geom::Point2D const &position) const =0
Evaluate the field at the given point.
virtual double integrate() const
Compute the integral of this function over its bounding-box.
virtual double mean() const
Compute the mean of this function over its bounding-box.
geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
A base class for objects that can be persisted via afw::table::io Archive classes.
An abstract base class for 2-d functions defined on an integer bounding boxes.
PYBIND11_PLUGIN(_approximate)
void declareTemplates(ClsField &cls)