22#include "pybind11/pybind11.h"
24#include "ndarray/pybind11.h"
29using namespace pybind11::literals;
35 py::module::import(
"lsst.geom");
36 py::module::import(
"lsst.afw.geom");
37 py::module::import(
"lsst.afw.image");
39 py::class_<ShapeletFunction, std::shared_ptr<ShapeletFunction>> clsShapeletFunction(mod,
44 clsShapeletFunction.def(py::init<int, BasisTypeEnum>(),
"order"_a,
"basisType"_a);
45 clsShapeletFunction.def(py::init<
int,
BasisTypeEnum, ndarray::Array<double, 1, 1>
const &>(),
"order"_a,
46 "basisType"_a,
"coefficients"_a);
47 clsShapeletFunction.def(py::init<int, BasisTypeEnum, double, geom::Point2D const &>(),
"order"_a,
50 ndarray::Array<double, 1, 1>
const &>(),
51 "order"_a,
"basisType"_a,
"radius"_a,
"center"_a,
"coefficients"_a);
52 clsShapeletFunction.def(py::init<int, BasisTypeEnum, afw::geom::ellipses::Ellipse const &>(),
"order"_a,
53 "basisType"_a,
"ellipse"_a);
55 ndarray::Array<double const, 1, 1>
const &>(),
56 "order"_a,
"basisType"_a,
"ellipse"_a,
"coefficients"_a);
57 clsShapeletFunction.def(py::init<ShapeletFunction>());
62 py::return_value_policy::reference_internal);
67 clsShapeletFunction.def(
"getCoefficients", (ndarray::Array<double, 1, 1>
const (
ShapeletFunction::*)()) &
74 py::class_<ShapeletFunctionEvaluator, std::shared_ptr<ShapeletFunctionEvaluator>>
75 clsShapeletFunctionEvaluator(mod,
"ShapeletFunctionEvaluator");
77 clsShapeletFunctionEvaluator.def(py::init<ShapeletFunction const &>(),
"function"_a);
79 clsShapeletFunctionEvaluator.def(
"__call__",
81 ShapeletFunctionEvaluator::operator());
82 clsShapeletFunctionEvaluator.def(
84 ShapeletFunctionEvaluator::operator());
85 clsShapeletFunctionEvaluator.def(
87 ShapeletFunctionEvaluator::operator());
89 ndarray::Array<double const, 1>
const &,
90 ndarray::Array<double const, 1>
const &)
const) &
91 ShapeletFunctionEvaluator::operator());
93 clsShapeletFunctionEvaluator.def(
98 clsShapeletFunctionEvaluator.def(
An ellipse defined by an arbitrary BaseCore and a center point.
A class to represent a 2-dimensional array of pixels.
Evaluates a ShapeletFunction.
afw::geom::ellipses::Ellipse computeMoments() const
Return the unweighted dipole and quadrupole moments of the function as an ellipse.
void update(ShapeletFunction const &function)
Update the evaluator from the given function.
void addToImage(ndarray::Array< double, 2, 1 > const &array, geom::Point2I const &xy0=geom::Point2I()) const
Add the function to the given image-like array.
double integrate() const
Compute the definite integral or integral moments.
A 2-d function defined by an expansion onto a Gauss-Laguerre or Gauss-Hermite basis.
Evaluator evaluate() const
Construct a helper object that can efficiently evaluate the function.
int getOrder() const
Return the maximum order (inclusive), either or .
BasisTypeEnum getBasisType() const
Return the basis type (HERMITE or LAGUERRE).
afw::geom::ellipses::Ellipse const & getEllipse() const
Get the ellipse (const).
void changeBasisType(BasisTypeEnum basisType)
Change the basis type and convert coefficients in-place correspondingly.
ndarray::Array< double, 1, 1 > const getCoefficients()
Return the coefficient vector.
void shiftInPlace(geom::Extent2D const &offset)
Shift the shapelet function by shifting the basis ellipse.
ShapeletFunction convolve(ShapeletFunction const &other) const
Convolve the shapelet function.
void setEllipse(afw::geom::ellipses::Ellipse const &ellipse)
Set the ellipse.
void normalize(double value=1.0)
Normalize the integral of the shapelet function to the given value.
void transformInPlace(geom::AffineTransform const &transform)
Transform the shapelet function by transforming the basis ellipse.
static double const FLUX_FACTOR
PYBIND11_MODULE(basisEvaluator, mod)