LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
lsst::shapelet Namespace Reference

Namespaces

namespace  constants
 
namespace  generator
 
namespace  multiShapeletFunction
 
namespace  radialProfile
 
namespace  shapeletFunction
 
namespace  tests
 
namespace  tractor
 
namespace  version
 

Classes

class  BasisEvaluator
 Evaluates a standard shapelet Basis. More...
 
class  ConversionMatrix
 Conversions between shapelet basis types. More...
 
class  GaussHermiteConvolution
 A parametrized matrix that performs a convolution in shapelet space. More...
 
class  GaussHermiteEvaluator
 A class to evaluate HERMITE shapelet-related quantities. More...
 
class  GaussHermiteProjection
 
class  HermiteTransformMatrix
 A class that computes a matrix that applies a linear transform to a 2-d Hermite polynomial expansion. More...
 
class  MatrixBuilder
 Class that evaluates a (multi-)shapelet basis at predefined points. More...
 
class  MatrixBuilderFactory
 A factory class for MatrixBuilder, providing more control over workspace memory. More...
 
class  MatrixBuilderWorkspace
 Reusable, shareable workspace for MatrixBuilder. More...
 
class  MultiShapeletBasis
 A basis formed from a linear combination of shapelet bases that differ only in radius. More...
 
class  MultiShapeletBasisComponent
 Simple struct that represents one shapelet expansion in a MultiShapeletBasis. More...
 
class  MultiShapeletFunction
 A multi-scale shapelet function. More...
 
class  MultiShapeletFunctionEvaluator
 Evaluates a MultiShapeletFunction. More...
 
class  MultiShapeletFunctionKey
 Class that maps MultiShapeletFunction objects to fields in afw::table objects. More...
 
class  PackedIndex
 An iterator-like object to help in traversing "packed" shapelet or Hermite polynomial matrix or vector dimensions. More...
 
class  RadialProfile
 Registry and utility class for multi-Gaussian approximations to radial profiles. More...
 
class  ShapeletFunction
 A 2-d function defined by an expansion onto a Gauss-Laguerre or Gauss-Hermite basis. More...
 
class  ShapeletFunctionEvaluator
 Evaluates a ShapeletFunction. More...
 
class  ShapeletFunctionKey
 Class that maps ShapeletFunction objects to fields in afw::table objects. More...
 

Typedefs

typedef afw::geom::ellipses::Quadrupole EllipseCore
 
typedef ndarray::Array< double, 1 > Array1d
 Typedef for a commonly-used array type.
 

Enumerations

enum  BasisTypeEnum { HERMITE , LAGUERRE }
 An enum that sets whether to use real-valued polar shapelets or Cartesian shapelets. More...
 

Functions

int computeOffset (int order)
 Return the offset of the given order in a coefficient vector.
 
int computeSize (int order)
 Return the size of the coefficient vector for the given order.
 
int computeOrder (int size)
 Infer the order of a shapelet expansion from the number of coefficients.
 
double intSqrt (int n)
 Compute the square root of an integer number.
 
double rationalSqrt (int n, int d)
 Compute the square root of a rational number i.e. sqrt(n/d)
 
void wrapConstants (WrapperCollection &wrappers)
 
void wrapMatrixBuilder (WrapperCollection &wrappers)
 
void wrapGaussHermiteConvolution (WrapperCollection &wrappers)
 
void wrapFunctorKeys (WrapperCollection &wrappers)
 
void wrapShapeletFunction (WrapperCollection &wrappers)
 
void wrapGaussHermiteProjection (WrapperCollection &wrappers)
 
void wrapMultiShapeletFunction (WrapperCollection &wrappers)
 
void wrapHermiteTransformMatrix (WrapperCollection &wrappers)
 
void wrapMultiShapeletBasis (WrapperCollection &wrappers)
 
void wrapBasisEvaluator (WrapperCollection &wrappers)
 
void wrapRadialProfile (WrapperCollection &wrappers)
 
 PYBIND11_MODULE (_shapeletLib, mod)
 

Variables

double const BASIS_NORMALIZATION
 Normalization factor for 1-d orthonormal shapelets: pi^(-1/4)
 

Detailed Description

lsst.shapelet

Typedef Documentation

◆ Array1d

typedef ndarray::Array<double,1> lsst::shapelet::Array1d

Typedef for a commonly-used array type.

Note
Serves as a workaround for ambiguities in the C++ standard itself: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325

Definition at line 121 of file constants.h.

◆ EllipseCore

Definition at line 44 of file constants.h.

Enumeration Type Documentation

◆ BasisTypeEnum

An enum that sets whether to use real-valued polar shapelets or Cartesian shapelets.

The conversion between the two bases is theoretically exact, but of course subject to round-off error here.

Enumerator
HERMITE 

Cartesian shapelets or Gauss-Hermite functions, as defined in Refregier, 2003.

That is, \( \psi(x, y)_{n_x, n_y} = \frac{H_{n_x}(x) H_{n_y}(y) e^{-\frac{x^2 + y^2}{2}}} {\sigma 2^{n_x + n_y} \sqrt{\pi n_x! n_y!}} \) where \(H_n(x)\) is a Hermite polynomial.

The ordering of coefficients [n_x, n_y] is (row-major packed): [0,0], [0,1], [1,0], [0,2], [1,1], [2,0], [0,3], [1,2], [2,1], [3,0], [0,4], [1,3], [2,2], [3,1], [4,0] etc.

LAGUERRE 

Polar shapelets or Gauss-Laguerre functions, as defined in Bernstein and Jarvis, 2002.

That is, \( \psi(x, y, \sigma)_{p, q} = (-1)^q \sqrt{\frac{q!}{p!}} (x + i y)^{p-q} e^{-\frac{x^2 + y^2}{2}} L^{(p-q)}_q(x^2 + y^2) \) where \(L^{(m)}_n(r)\) is an associated Laguerre polynomial.

The ordering of coefficients [p, q] is (row-major packed): [0,0], Re([1,0]), Im([1,0]), Re([2,0]), Im([2,0]), [1,1], Re([3,0]), Im([3,0], Re([2,1]), Im([2,1]), Re([4,0]), Im([4,0], Re([3,1]), Im([3,1]), [2,2] etc.

Elements with p < q are redundant in representing real-valued functions, while those with p == q are inherently real.

Definition at line 52 of file constants.h.

52 {
53 HERMITE,
71 LAGUERRE,
91};

Function Documentation

◆ computeOffset()

int lsst::shapelet::computeOffset ( int order)
inline

Return the offset of the given order in a coefficient vector.

Definition at line 94 of file constants.h.

94{ return order * (order + 1) / 2; }
table::Key< int > order

◆ computeOrder()

int lsst::shapelet::computeOrder ( int size)
inline

Infer the order of a shapelet expansion from the number of coefficients.

Exceptions
InvalidParameterErrorif the number of coefficients does not correspond to any shapelet order.

Definition at line 104 of file constants.h.

104 {
105 int order = (std::sqrt(8*size + 1) - 3)/2;
106 if (computeSize(order) != size) {
107 throw LSST_EXCEPT(
109 "Invalid size for shapelet coefficient matrix"
110 );
111 }
112 return order;
113}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
Reports invalid arguments.
Definition Runtime.h:66
T sqrt(T... args)

◆ computeSize()

int lsst::shapelet::computeSize ( int order)
inline

Return the size of the coefficient vector for the given order.

Definition at line 97 of file constants.h.

97{ return computeOffset(order + 1); }
int computeOffset(int order)
Return the offset of the given order in a coefficient vector.
Definition constants.h:94

◆ intSqrt()

double lsst::shapelet::intSqrt ( int n)
inline

Compute the square root of an integer number.

Definition at line 124 of file constants.h.

124 {
125 return std::sqrt(double(n));
126}

◆ PYBIND11_MODULE()

lsst::shapelet::PYBIND11_MODULE ( _shapeletLib ,
mod  )

Definition at line 46 of file _shapeletLib.cc.

46 {
47 WrapperCollection wrappers(mod, "lsst.shapelet");
48
49 wrappers.addInheritanceDependency("lsst.afw.table");
50
51 wrappers.addSignatureDependency("lsst.geom");
52 wrappers.addSignatureDependency("lsst.afw.geom");
53 wrappers.addSignatureDependency("lsst.afw.image");
54
55 wrapConstants(wrappers);
56 wrapMatrixBuilder(wrappers);
58 wrapFunctorKeys(wrappers);
59 wrapShapeletFunction(wrappers);
63 wrapMultiShapeletBasis(wrappers);
64 wrapBasisEvaluator(wrappers);
65 wrapRadialProfile(wrappers);
66 wrappers.finish();
67}
A helper class for subdividing pybind11 module across multiple translation units (i....
Definition python.h:242
void wrapGaussHermiteProjection(WrapperCollection &wrappers)
void wrapRadialProfile(WrapperCollection &wrappers)
void wrapShapeletFunction(WrapperCollection &wrappers)
void wrapBasisEvaluator(WrapperCollection &wrappers)
void wrapMultiShapeletFunction(WrapperCollection &wrappers)
void wrapConstants(WrapperCollection &wrappers)
Definition constants.cc:33
void wrapFunctorKeys(WrapperCollection &wrappers)
void wrapHermiteTransformMatrix(WrapperCollection &wrappers)
void wrapGaussHermiteConvolution(WrapperCollection &wrappers)
void wrapMatrixBuilder(WrapperCollection &wrappers)
void wrapMultiShapeletBasis(WrapperCollection &wrappers)

◆ rationalSqrt()

double lsst::shapelet::rationalSqrt ( int n,
int d )
inline

Compute the square root of a rational number i.e. sqrt(n/d)

Definition at line 129 of file constants.h.

129 {
130 return std::sqrt(double(n) / double(d));
131}

◆ wrapBasisEvaluator()

void lsst::shapelet::wrapBasisEvaluator ( WrapperCollection & wrappers)

Definition at line 35 of file basisEvaluator.cc.

35 {
36 using PyBasisEvaluator = py::class_<BasisEvaluator, std::shared_ptr<BasisEvaluator>>;
37
38 wrappers.wrapType(PyBasisEvaluator(wrappers.module, "BasisEvaluator"), [](auto &mod, auto &cls) {
39 /* Constructors */
40 cls.def(py::init<int, BasisTypeEnum>(), "order"_a, "basisType"_a);
41
42 /* Members */
43 cls.def("getOrder", &BasisEvaluator::getOrder);
44 cls.def("getBasisType", &BasisEvaluator::getBasisType);
45
46 /* fillEvaluation has default constructed Array1d objects as keyword
47 * arguments.
48 * Unfortunately, for some reason array.isEmpty() == false even with 0
49 * elements,
50 * which leads to a segfault.
51 * Thus we must delegate through lambdas instead. */
52 cls.def("fillEvaluation", [](BasisEvaluator &self, Array1d const &array, double x,
53 double y) { return self.fillEvaluation(array, x, y); },
54 "array"_a, "x"_a, "y"_a);
55 cls.def(
56 "fillEvaluation",
57 [](BasisEvaluator &self, Array1d const &array, double x, double y, Array1d const &dx,
58 Array1d const &dy) { return self.fillEvaluation(array, x, y, dx, dy); },
59 "array"_a, "x"_a, "y"_a, "dx"_a, "dy"_a);
60 cls.def("fillEvaluation",
61 [](BasisEvaluator &self, Array1d const &array, geom::Point2D const &point) {
62 return self.fillEvaluation(array, point);
63 },
64 "array"_a, "point"_a);
65 cls.def(
66 "fillEvaluation",
67 [](BasisEvaluator &self, Array1d const &array, geom::Point2D const &point, Array1d const &dx,
68 Array1d const &dy) { return self.fillEvaluation(array, point, dx, dy); },
69 "array"_a, "point"_a, "dx"_a, "dy"_a);
70 cls.def("fillEvaluation",
71 [](BasisEvaluator &self, Array1d const &array, geom::Extent2D const &extent) {
72 return self.fillEvaluation(array, extent);
73 },
74 "array"_a, "extent"_a);
75 cls.def(
76 "fillEvaluation",
77 [](BasisEvaluator &self, Array1d const &array, geom::Extent2D const &extent,
78 Array1d const &dx, Array1d const &dy) { return self.fillEvaluation(array, extent, dx, dy); },
79 "array"_a, "extent"_a, "dx"_a, "dy"_a);
80 cls.def("fillIntegration", &BasisEvaluator::fillIntegration, "array"_a, "xMoment"_a = 0,
81 "yMoment"_a = 0);
82 });
83}
int y
Definition SpanSet.cc:48
Evaluates a standard shapelet Basis.
ndarray::Array< double, 1 > Array1d
Typedef for a commonly-used array type.
Definition constants.h:121

◆ wrapConstants()

void lsst::shapelet::wrapConstants ( WrapperCollection & wrappers)

Definition at line 33 of file constants.cc.

33 {
34
35 wrappers.wrapType(py::enum_<BasisTypeEnum>(wrappers.module, "BasisTypeEnum"), [](auto &mod, auto &enm) {
36 enm.value("HERMITE", BasisTypeEnum::HERMITE);
37 enm.value("LAGUERRE", BasisTypeEnum::LAGUERRE);
38 enm.export_values();
39
40 mod.def("computeOffset", computeOffset);
41 mod.def("computeSize", computeSize);
42 mod.def("computeOrder", computeOrder);
43 mod.def("intSqrt", intSqrt);
44 mod.def("rationalSqrt", rationalSqrt);
45 });
46}

◆ wrapFunctorKeys()

void lsst::shapelet::wrapFunctorKeys ( WrapperCollection & wrappers)

Definition at line 35 of file functorKeys.cc.

35 {
36 using PyShapeletFunctionKey = py::class_<ShapeletFunctionKey, std::shared_ptr<ShapeletFunctionKey>>;
37
38 wrappers.wrapType(PyShapeletFunctionKey(wrappers.module, "ShapeletFunctionKey"), [](auto &mod, auto &cls) {
39 cls.def(py::init<>());
40 cls.def(
41 py::init<afw::table::EllipseKey const &, afw::table::ArrayKey<double> const &, BasisTypeEnum>(),
42 "ellipse"_a, "coefficients"_a, "basisType"_a = HERMITE);
43 cls.def(py::init<afw::table::SubSchema const &, BasisTypeEnum>(), "s"_a,
44 "basisType"_a = HERMITE);
45
46 cls.def("__eq__", &ShapeletFunctionKey::operator==, py::is_operator());
47 cls.def("__ne__", &ShapeletFunctionKey::operator!=, py::is_operator());
48
49 cls.def_static("addFields", &ShapeletFunctionKey::addFields, "schema"_a, "name"_a,
50 "doc"_a, "ellipseUnit"_a, "coeffUnit"_a, "order"_a,
51 "basisType"_a = HERMITE);
52
53 cls.def("get", &ShapeletFunctionKey::get);
54 cls.def("set", &ShapeletFunctionKey::set);
55 cls.def("isValid", &ShapeletFunctionKey::isValid);
56 cls.def("getEllipse", &ShapeletFunctionKey::getEllipse);
57 cls.def("getCoefficients", &ShapeletFunctionKey::getCoefficients);
58 cls.def("getOrder", &ShapeletFunctionKey::getOrder);
59 cls.def("getBasisType", &ShapeletFunctionKey::getBasisType);
60 });
61
62 using PyMultiShapeletFunctionKey = py::class_<MultiShapeletFunctionKey, std::shared_ptr<MultiShapeletFunctionKey>>;
63
64 wrappers.wrapType(PyMultiShapeletFunctionKey(wrappers.module, "MultiShapeletFunctionKey"), [](auto &mod, auto &cls) {
65 cls.def(py::init<>());
66 cls.def(py::init<afw::table::SubSchema const &, BasisTypeEnum>(), "s"_a,
67 "basisType"_a = HERMITE);
68 cls.def(py::init<std::vector<std::shared_ptr<ShapeletFunctionKey>> const &>(),
69 "components"_a);
70
71 cls.def_static("addFields", MultiShapeletFunctionKey::addFields, "schema"_a,
72 "name"_a, "doc"_a, "ellipseUnit"_a, "coeffUnit"_a, "orders"_a,
73 "basisType"_a = HERMITE);
74
75 cls.def("__eq__", &MultiShapeletFunctionKey::operator==, py::is_operator());
76 cls.def("__ne__", &MultiShapeletFunctionKey::operator!=, py::is_operator());
77 cls.def("__getitem__",
78 [](MultiShapeletFunctionKey &self, int i) { return self[i]; });
79
80 cls.def("get", &MultiShapeletFunctionKey::get);
81 cls.def("set", &MultiShapeletFunctionKey::set);
82 cls.def("isValid", &MultiShapeletFunctionKey::isValid);
83 });
84}

◆ wrapGaussHermiteConvolution()

void lsst::shapelet::wrapGaussHermiteConvolution ( WrapperCollection & wrappers)

Definition at line 36 of file gaussHermiteConvolution.cc.

36 {
37 using PyGaussHermiteConvolution = py::class_<GaussHermiteConvolution, std::shared_ptr<GaussHermiteConvolution>>;
38 wrappers.wrapType(PyGaussHermiteConvolution(wrappers.module, "GaussHermiteConvolution"), [](auto &mod, auto &cls) {
39 cls.def(py::init<int, ShapeletFunction const &>(), "colOrder"_a, "psf"_a);
40
41 cls.def("computeRowOrder", &GaussHermiteConvolution::computeRowOrder);
42 cls.def("evaluate", &GaussHermiteConvolution::evaluate);
43 cls.def("getColOrder", &GaussHermiteConvolution::getColOrder);
44 cls.def("getRowOrder", &GaussHermiteConvolution::getRowOrder);
45 });
46}

◆ wrapGaussHermiteProjection()

void lsst::shapelet::wrapGaussHermiteProjection ( WrapperCollection & wrappers)

Definition at line 34 of file gaussHermiteProjection.cc.

34 {
35 using PyGaussHermiteProjection = py::class_<GaussHermiteProjection, std::shared_ptr<GaussHermiteProjection>>;
36
37 wrappers.wrapType(PyGaussHermiteProjection(wrappers.module, "GaussHermiteProjection"), [](auto &mod, auto &cls) {
38 cls.def(py::init<int>(), "maxOrder"_a);
39
40 cls.def("compute",
41 (Eigen::MatrixXd (GaussHermiteProjection::*)(
42 afw::geom::ellipses::Quadrupole const &, int inputOrder,
43 afw::geom::ellipses::Quadrupole const &, int outputOrder) const) &
44 GaussHermiteProjection::compute);
45 cls.def("compute",
46 (Eigen::MatrixXd (GaussHermiteProjection::*)(
47 geom::LinearTransform const &, int inputOrder,
48 geom::LinearTransform const &, int outputOrder) const) &
49 GaussHermiteProjection::compute);
50 cls.def(
51 "compute", (Eigen::MatrixXd (GaussHermiteProjection::*)(Eigen::Matrix2d const &, int,
52 Eigen::Matrix2d const &, int) const) &
53 GaussHermiteProjection::compute);
54
55 cls.def("getMaxOrder", &GaussHermiteProjection::getMaxOrder);
56 });
57}

◆ wrapHermiteTransformMatrix()

void lsst::shapelet::wrapHermiteTransformMatrix ( WrapperCollection & wrappers)

Definition at line 34 of file hermiteTransformMatrix.cc.

34 {
35 using PyHermiteTransformMatrix = py::class_<HermiteTransformMatrix, std::shared_ptr<HermiteTransformMatrix>>;
36
37 wrappers.wrapType(PyHermiteTransformMatrix(wrappers.module, "HermiteTransformMatrix"), [](auto &mod, auto &cls) {
38 cls.def(py::init<int>(), "order"_a);
39
40 cls.def(
41 "compute", (Eigen::MatrixXd (HermiteTransformMatrix::*)(Eigen::Matrix2d const &) const) &
42 HermiteTransformMatrix::compute,
43 "transform"_a);
44 cls.def(
45 "compute",
46 (Eigen::MatrixXd (HermiteTransformMatrix::*)(geom::LinearTransform const &) const) &
47 HermiteTransformMatrix::compute,
48 "transform"_a);
49 cls.def(
50 "compute", (Eigen::MatrixXd (HermiteTransformMatrix::*)(Eigen::Matrix2d const &, int) const) &
51 HermiteTransformMatrix::compute,
52 "transform"_a, "order"_a);
53 cls.def("compute", (Eigen::MatrixXd (HermiteTransformMatrix::*)(
54 geom::LinearTransform const &, int) const) &
55 HermiteTransformMatrix::compute,
56 "transform"_a, "order"_a);
57
58 cls.def("getCoefficientMatrix", &HermiteTransformMatrix::getCoefficientMatrix);
59 cls.def("getInverseCoefficientMatrix",
60 &HermiteTransformMatrix::getInverseCoefficientMatrix);
61 cls.def("getOrder", &HermiteTransformMatrix::getOrder);
62 });
63}

◆ wrapMatrixBuilder()

void lsst::shapelet::wrapMatrixBuilder ( WrapperCollection & wrappers)

Definition at line 132 of file matrixBuilder.cc.

132 {
133 declareMatrixBuilderTemplates<float>(wrappers, "F");
134 declareMatrixBuilderTemplates<double>(wrappers, "D");
135}

◆ wrapMultiShapeletBasis()

void lsst::shapelet::wrapMultiShapeletBasis ( WrapperCollection & wrappers)

Definition at line 35 of file multiShapeletBasis.cc.

35 {
36 using PyClass = py::class_<MultiShapeletBasisComponent, std::shared_ptr<MultiShapeletBasisComponent>>;
37
38 static auto component =
39 wrappers.wrapType(PyClass(wrappers.module, "MultiShapeletBasisComponent"), [](auto &mod, auto &cls) {
40 cls.def(py::init<double, int, ndarray::Array<double const, 2, 2> const &>(),
41 "radius"_a, "order"_a, "matrix"_a);
42
43 cls.def("getRadius", &MultiShapeletBasisComponent::getRadius);
44 cls.def("getOrder", &MultiShapeletBasisComponent::getOrder);
45 cls.def("getMatrix", &MultiShapeletBasisComponent::getMatrix);
46 });
47
48 using PyMultiShapeletBasis = py::class_<MultiShapeletBasis, std::shared_ptr<MultiShapeletBasis>>;
49
50 wrappers.wrapType(PyMultiShapeletBasis(wrappers.module, "MultiShapeletBasis"), [](auto &mod, auto &cls) {
51 cls.attr("Component") = component;
52
53 cls.def(py::init<int>());
54 cls.def(py::init<MultiShapeletBasis const &>());
55
56 cls.def("getSize", &MultiShapeletBasis::getSize);
57 cls.def("getComponentCount", &MultiShapeletBasis::getComponentCount);
58 cls.def("addComponent", &MultiShapeletBasis::addComponent);
59 cls.def("scale", &MultiShapeletBasis::scale);
60 cls.def("normalize", &MultiShapeletBasis::normalize);
61 cls.def("merge", &MultiShapeletBasis::merge);
62 cls.def("makeFunction", &MultiShapeletBasis::makeFunction);
63 });
64}

◆ wrapMultiShapeletFunction()

void lsst::shapelet::wrapMultiShapeletFunction ( WrapperCollection & wrappers)

Definition at line 95 of file multiShapeletFunction.cc.

95 {
96 using PyMultiShapeletFunction = py::class_<MultiShapeletFunction, std::shared_ptr<MultiShapeletFunction>>;
97
98 wrappers.wrapType(PyMultiShapeletFunction(wrappers.module, "MultiShapeletFunction"), [](auto &mod, auto &cls) {
99 declareMultiShapeletFunctionMembers(cls);
100
101 });
102
103 using PyMultiShapeletFunctionEvaluator =
104 py::class_<MultiShapeletFunctionEvaluator, std::shared_ptr<MultiShapeletFunctionEvaluator>>;
105
106 wrappers.wrapType(PyMultiShapeletFunctionEvaluator(wrappers.module, "MultiShapeletFunctionEvaluator"), [](auto &mod, auto &cls) {
107 declareMultiShapeletFunctionEvaluatorMembers(cls);
108 });
109}

◆ wrapRadialProfile()

void lsst::shapelet::wrapRadialProfile ( WrapperCollection & wrappers)

Definition at line 35 of file radialProfile.cc.

35 {
36 using PyRadialProfil = py::class_<RadialProfile, std::shared_ptr<RadialProfile>> ;
37 wrappers.wrapType(PyRadialProfil(wrappers.module, "RadialProfile"), [](auto &mod, auto &cls) {
38 cls.def_static("get", &RadialProfile::get, py::return_value_policy::reference);
39 cls.def("getName", &RadialProfile::getName);
40 cls.def("_evaluate", (double (RadialProfile::*)(double) const) &RadialProfile::evaluate);
41 cls.def("_evaluate", (ndarray::Array<double, 1, 1> (RadialProfile::*)(
42 ndarray::Array<double const, 1, 1> const &) const) &
43 RadialProfile::evaluate);
44 cls.def("getMomentsRadiusFactor", &RadialProfile::getMomentsRadiusFactor);
45 cls.def("getBasis", &RadialProfile::getBasis, "nComponents"_a, "maxRadius"_a = 0);
46 cls.def("registerBasis", &RadialProfile::registerBasis);
47 });
48}

◆ wrapShapeletFunction()

void lsst::shapelet::wrapShapeletFunction ( WrapperCollection & wrappers)

Definition at line 35 of file shapeletFunction.cc.

35 {
36 using PyShapeletFunction = py::class_<ShapeletFunction, std::shared_ptr<ShapeletFunction>>;
37
38 wrappers.wrapType(PyShapeletFunction(wrappers.module, "ShapeletFunction"), [](auto &mod, auto &cls) {
39 cls.def_readonly_static("FLUX_FACTOR", &ShapeletFunction::FLUX_FACTOR);
40
41 cls.def(py::init<int, BasisTypeEnum>(), "order"_a, "basisType"_a);
42 cls.def(py::init<int, BasisTypeEnum, ndarray::Array<double, 1, 1> const &>(), "order"_a,
43 "basisType"_a, "coefficients"_a);
44 cls.def(py::init<int, BasisTypeEnum, double, geom::Point2D const &>(), "order"_a,
45 "basisType"_a, "radius"_a, "center"_a = geom::Point2D());
46 cls.def(py::init<int, BasisTypeEnum, double, geom::Point2D const &,
47 ndarray::Array<double, 1, 1> const &>(),
48 "order"_a, "basisType"_a, "radius"_a, "center"_a, "coefficients"_a);
49 cls.def(py::init<int, BasisTypeEnum, afw::geom::ellipses::Ellipse const &>(), "order"_a,
50 "basisType"_a, "ellipse"_a);
51 cls.def(py::init<int, BasisTypeEnum, afw::geom::ellipses::Ellipse const &,
52 ndarray::Array<double const, 1, 1> const &>(),
53 "order"_a, "basisType"_a, "ellipse"_a, "coefficients"_a);
54 cls.def(py::init<ShapeletFunction>());
55
56 cls.def("getOrder", &ShapeletFunction::getOrder);
57 cls.def("getEllipse", (afw::geom::ellipses::Ellipse &(ShapeletFunction::*)()) &
58 ShapeletFunction::getEllipse,
59 py::return_value_policy::reference_internal);
60 cls.def("setEllipse", &ShapeletFunction::setEllipse);
61 cls.def("getBasisType", &ShapeletFunction::getBasisType);
62 cls.def("changeBasisType", &ShapeletFunction::changeBasisType);
63 cls.def("normalize", &ShapeletFunction::normalize, "value"_a = 1.0);
64 cls.def("getCoefficients", (ndarray::Array<double, 1, 1> const (ShapeletFunction::*)()) &
65 ShapeletFunction::getCoefficients);
66 cls.def("convolve", &ShapeletFunction::convolve);
67 cls.def("evaluate", &ShapeletFunction::evaluate);
68 cls.def("shiftInPlace", &ShapeletFunction::shiftInPlace);
69 cls.def("transformInPlace", &ShapeletFunction::transformInPlace);
70 });
71
72 using PyShapeletFunctionEvaluator =
73 py::class_<ShapeletFunctionEvaluator, std::shared_ptr<ShapeletFunctionEvaluator>>;
74
75 wrappers.wrapType(
76 PyShapeletFunctionEvaluator(wrappers.module, "ShapeletFunctionEvaluator"), [](auto &mod, auto &cls) {
77 cls.def(py::init<ShapeletFunction const &>(), "function"_a);
78
79 cls.def("__call__",
80 (double (ShapeletFunctionEvaluator::*)(double, double) const) &
81 ShapeletFunctionEvaluator::operator());
82 cls.def(
83 "__call__", (double (ShapeletFunctionEvaluator::*)(geom::Point2D const &) const) &
84 ShapeletFunctionEvaluator::operator());
85 cls.def(
86 "__call__", (double (ShapeletFunctionEvaluator::*)(geom::Extent2D const &) const) &
87 ShapeletFunctionEvaluator::operator());
88 cls.def("__call__", (ndarray::Array<double, 1, 1> (ShapeletFunctionEvaluator::*)(
89 ndarray::Array<double const, 1> const &,
90 ndarray::Array<double const, 1> const &) const) &
91 ShapeletFunctionEvaluator::operator());
92
93 cls.def(
94 "addToImage", (void (ShapeletFunctionEvaluator::*)(ndarray::Array<double, 2, 1> const &,
95 geom::Point2I const &) const) &
96 ShapeletFunctionEvaluator::addToImage,
97 "array"_a, "xy0"_a = geom::Point2D());
98 cls.def(
99 "addToImage", (void (ShapeletFunctionEvaluator::*)(afw::image::Image<double> &) const) &
100 ShapeletFunctionEvaluator::addToImage,
101 "image"_a);
102 cls.def("integrate", &ShapeletFunctionEvaluator::integrate);
103 cls.def("computeMoments", &ShapeletFunctionEvaluator::computeMoments);
104 cls.def("update", &ShapeletFunctionEvaluator::update);
105 });
106}

Variable Documentation

◆ BASIS_NORMALIZATION

double const lsst::shapelet::BASIS_NORMALIZATION
extern

Normalization factor for 1-d orthonormal shapelets: pi^(-1/4)