LSST Applications 30.0.7,g0e76e35be5+e8e946ae08,g19811a7679+138f7293ba,g199a45376c+5e234f8357,g1fd858c14a+2f48dbc4c4,g262e1987ae+fb36cac54d,g29ae962dfc+d9108a0941,g2c21b0017a+4f59a27f16,g31e44d4a5c+b0138be388,g33ac35c1f1+28b9f72785,g35bb328faa+b0138be388,g40c9b15c53+823ad735c1,g47891489e3+bcc48a0b46,g53246c7159+b0138be388,g64539dfbff+e8e946ae08,g67b6fd64d1+bcc48a0b46,g74acd417e5+422380537a,g76965917b2+a5ca99c4d9,g786e29fd12+796b79145d,g7aefaa3e3d+dc0c200193,g86b635cae8+734fe384f0,g87389fa792+d8b5378923,g89139ef638+bcc48a0b46,g8bbb235e95+3f4f7f9447,g8ea07a8fe4+78a4c88802,g9290983e33+ffdc83c6f7,g92c671f44c+e8e946ae08,gaa753fd333+03f406da14,gbf99507273+b0138be388,gc49b57b85e+8df26ee1f0,gca7fc764a6+bcc48a0b46,gd7ef33dd92+bcc48a0b46,gdab6d2f7ff+422380537a,ge1c02a5578+b0138be388,ge410e46f29+bcc48a0b46,ge80df9fc40+e6db5413d1,geaed405ab2+1de65a85c6,gf5dcc679e7+35a0ce2edd,gf5f1c85443+e8e946ae08
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 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
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
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
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 str() const override
Return a brief, human-readable string representation of this.
Definition gaussian.cc:171
_g
Definition conf.py:10
const double M_SIGMA_HWHM
Definition ellipse.h:39
const double M_HWHM_SIGMA
Definition ellipse.h:38