LSST Applications g00d0e8bbd7+8c5ae1fdc5,g013ef56533+603670b062,g083dd6704c+2e189452a7,g199a45376c+0ba108daf9,g1c5cce2383+bc9f6103a4,g1fd858c14a+cd69ed4fc1,g210f2d0738+c4742f2e9e,g262e1987ae+612fa42d85,g29ae962dfc+83d129e820,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+5eaa884f2a,g47891489e3+e32160a944,g53246c7159+8c5ae1fdc5,g5b326b94bb+dcc56af22d,g64539dfbff+c4742f2e9e,g67b6fd64d1+e32160a944,g74acd417e5+c122e1277d,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g88cb488625+47d24e4084,g89139ef638+e32160a944,g8d7436a09f+d14b4ff40a,g8ea07a8fe4+b212507b11,g90f42f885a+e1755607f3,g97be763408+34be90ab8c,g98df359435+ec1fa61bf1,ga2180abaac+8c5ae1fdc5,ga9e74d7ce9+43ac651df0,gbf99507273+8c5ae1fdc5,gc2a301910b+c4742f2e9e,gca7fc764a6+e32160a944,gd7ef33dd92+e32160a944,gdab6d2f7ff+c122e1277d,gdb1e2cdc75+1b18322db8,ge410e46f29+e32160a944,ge41e95a9f2+c4742f2e9e,geaed405ab2+0d91c11c6d,w.2025.44
LSST Data Management Base Package
Loading...
Searching...
No Matches
gaussian.cc File Reference
#include <memory>
#include <pybind11/pybind11.h>
#include <pybind11/operators.h>
#include <pybind11/stl.h>
#include "lsst/gauss2d/gaussian.h"
#include "pybind11.h"

Go to the source code of this file.

Macros

#define PYBIND11_DETAILED_ERROR_MESSAGES
 

Functions

void bind_gaussian (py::module &m)
 

Macro Definition Documentation

◆ PYBIND11_DETAILED_ERROR_MESSAGES

#define PYBIND11_DETAILED_ERROR_MESSAGES

Definition at line 34 of file gaussian.cc.

Function Documentation

◆ bind_gaussian()

void bind_gaussian ( py::module & m)

Definition at line 41 of file gaussian.cc.

41 {
42 m.doc() = "Gauss2D Gaussian Python bindings";
43
44 m.attr("M_HWHM_SIGMA") = py::float_(gauss2d::M_HWHM_SIGMA);
45 m.attr("M_SIGMA_HWHM") = py::float_(gauss2d::M_SIGMA_HWHM);
46
47 auto _g = py::classh<gauss2d::GaussianIntegral>(m, "GaussianIntegral");
48 py::classh<gauss2d::GaussianIntegralValue, gauss2d::GaussianIntegral>(m, "GaussianIntegralValue")
49 .def(py::init<double>(), "value"_a = 1)
50 .def_property("value", &gauss2d::GaussianIntegralValue::get_value,
52 .def(py::self == py::self)
53 .def(py::self != py::self)
54 .def("__repr__",
55 [](const gauss2d::GaussianIntegralValue &self) {
56 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
57 })
59
60 py::classh<gauss2d::Gaussian>(m, "Gaussian")
63 "centroid"_a = nullptr, "ellipse"_a = nullptr, "integral"_a = nullptr)
64 .def_property_readonly("centroid", &gauss2d::Gaussian::get_centroid)
65 .def_property_readonly("ellipse", &gauss2d::Gaussian::get_ellipse)
66 .def_property_readonly("integral", &gauss2d::Gaussian::get_integral)
67 .def_property("const_normal", &gauss2d::Gaussian::get_const_normal,
69 .def_property("integral_value", &gauss2d::Gaussian::get_integral_value,
71 .def(py::self == py::self)
72 .def(py::self != py::self)
73 .def("__repr__",
74 [](const gauss2d::Gaussian &self) { return self.repr(true, self.PY_NAMESPACE_SEPARATOR); })
75 .def("__str__", &gauss2d::Gaussian::str);
76 py::classh<gauss2d::Gaussians>(m, "Gaussians")
77 .def(py::init<std::optional<const gauss2d::Gaussians::Data>>(), "gaussians"_a)
78 .def("at", &gauss2d::Gaussians::at, py::return_value_policy::copy)
79 .def_property_readonly("size", &gauss2d::Gaussians::size)
80 .def("__getitem__", &gauss2d::Gaussians::at_ptr, py::return_value_policy::copy)
81 .def("__len__", &gauss2d::Gaussians::size)
82 .def("__repr__",
83 [](const gauss2d::Gaussians &self) { return self.repr(true, self.PY_NAMESPACE_SEPARATOR); })
84 .def("__str__", &gauss2d::Gaussians::str);
85 py::classh<gauss2d::ConvolvedGaussian>(m, "ConvolvedGaussian")
87 "source"_a = nullptr, "kernel"_a = nullptr)
88 .def_property_readonly("kernel", &gauss2d::ConvolvedGaussian::get_kernel)
89 .def_property_readonly("source", &gauss2d::ConvolvedGaussian::get_source)
90 .def(py::self == py::self)
91 .def(py::self != py::self)
92 .def("__repr__",
93 [](const gauss2d::ConvolvedGaussian &self) {
94 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
95 })
96 .def("__str__", &gauss2d::ConvolvedGaussian::str);
97 py::classh<gauss2d::ConvolvedGaussians>(m, "ConvolvedGaussians")
98 .def(py::init<std::optional<const gauss2d::ConvolvedGaussians::Data>>(), "convolvedbgaussians"_a)
99 .def("at", &gauss2d::ConvolvedGaussians::at_ptr, py::return_value_policy::copy)
100 .def_property_readonly("size", &gauss2d::ConvolvedGaussians::size)
101 .def("__getitem__", &gauss2d::ConvolvedGaussians::at_ptr, py::return_value_policy::copy)
102 .def("__len__", &gauss2d::ConvolvedGaussians::size)
103 .def("__repr__",
104 [](const gauss2d::ConvolvedGaussians &self) {
105 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
106 })
107 .def("__str__", &gauss2d::ConvolvedGaussians::str);
108}
A convolution of a Gaussian source and kernel.
Definition gaussian.h:220
const Gaussian & get_source() const
Definition gaussian.cc:222
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition gaussian.cc:233
std::string str() const override
Return a brief, human-readable string representation of this.
Definition gaussian.cc:239
const Gaussian & get_kernel() const
Definition gaussian.cc:223
A collection of ConvolvedGaussian objects.
Definition gaussian.h:249
std::string str() const override
Return a brief, human-readable string representation of this.
Definition gaussian.cc:282
std::shared_ptr< ConvolvedGaussian > at_ptr(size_t i) const
Definition gaussian.cc:252
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition gaussian.cc:275
A 2D Gaussian with a Centroid, Ellipse, and integral.
Definition gaussian.h:99
Ellipse & get_ellipse()
Get the ellipse object.
Definition gaussian.cc:58
void set_const_normal(double const_normal)
Definition gaussian.cc:69
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition gaussian.cc:84
GaussianIntegral & get_integral()
Get the integral object.
Definition gaussian.cc:59
double get_integral_value() const
Get the integral value.
Definition gaussian.cc:55
void set_integral_value(double integral)
Definition gaussian.cc:72
double get_const_normal() const
Get the multiplicative factor for Gaussian function evaluations: integral/(2*area)
Definition gaussian.cc:54
Centroid & get_centroid()
Get the centroid object.
Definition gaussian.cc:57
std::string str() const override
Return a brief, human-readable string representation of this.
Definition gaussian.cc:91
A GaussianIntegral storing a float value.
Definition gaussian.h:72
double get_value() const override
Definition gaussian.h:79
void set_value(double value) override
Definition gaussian.h:80
std::string str() const override
Return a brief, human-readable string representation of this.
Definition gaussian.cc:43
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition gaussian.cc:39
An array of Gaussian objects.
Definition gaussian.h:175
Gaussian & at(size_t i) const
Definition gaussian.cc:148
std::shared_ptr< Gaussian > at_ptr(size_t i) const
Definition gaussian.cc:150
size_t size() const
Definition gaussian.cc:162
std::string repr(bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
Return a full, callable string representation of this.
Definition gaussian.cc:164
std::string str() const override
Return a brief, human-readable string representation of this.
Definition gaussian.cc:171
static constexpr std::string_view PY_NAMESPACE_SEPARATOR
Definition object.h:47
_g
Definition conf.py:10
const double M_SIGMA_HWHM
Definition ellipse.h:39
const double M_HWHM_SIGMA
Definition ellipse.h:38