LSST Applications g1653933729+b86e4b8053,g2303c004a3+a99d6d42bd,g28da252d5a+3e0fd49a16,g2bbee38e9b+db5ba6d06c,g2bc492864f+db5ba6d06c,g2cdde0e794+b03b09fb0a,g3156d2b45e+b0ccf75d80,g347aa1857d+db5ba6d06c,g35bb328faa+b86e4b8053,g3a166c0a6a+db5ba6d06c,g3e281a1b8c+c9a36f98fc,g414038480c+70d5606f74,g42360bd172+a99d6d42bd,g461a3dce89+b86e4b8053,g5c9cb89fa5+b7dae1cdc6,g7f102674c4+d27c5e2769,g7f343241b9+516b07f5d7,g80478fca09+ee10125a54,g82479be7b0+11c35b2845,g858d7b2824+a99d6d42bd,g8cd86fa7b1+cb4c24add2,g9125e01d80+b86e4b8053,g979bb04a14+30ae7a28c8,g9ddcbc5298+b4cb6f9276,ga44b09e51c+390e0c76f2,ga5288a1d22+c32cd41bfc,gae0086650b+b86e4b8053,gb58c049af0+2fe46b4317,gc28159a63d+db5ba6d06c,gcd45df26be+a99d6d42bd,gcf0d15dbbd+be93eff7c7,gda6a2b7d83+be93eff7c7,gdaeeff99f8+b9455e0a82,ge5cf12406b+e20940066e,ge79ae78c31+db5ba6d06c,ge7c99ddb59+26aa1bc97f,gf048a9a2f4+f6d4943a12,gf0baf85859+e0282cf37d,w.2024.32
LSST Data Management Base Package
Loading...
Searching...
No Matches
Functions
pybind11.h File Reference
#include <pybind11/pybind11.h>

Go to the source code of this file.

Functions

void bind_centroid (py::module &m)
 
void bind_coordinatesystem (py::module &m)
 
void bind_ellipse (py::module &m)
 
void bind_gaussian (py::module &m)
 
void bind_image (py::module &m)
 
void bind_object (py::module &m)
 

Function Documentation

◆ bind_centroid()

void bind_centroid ( py::module & m)

Definition at line 40 of file centroid.cc.

40 {
41 auto _c = py::class_<gauss2d::CentroidData, std::shared_ptr<gauss2d::CentroidData>>(m, "CentroidData");
42 py::class_<gauss2d::CentroidValues, std::shared_ptr<gauss2d::CentroidValues>, gauss2d::CentroidData>(
43 m, "CentroidValues")
44 // Note: These can't be shared_ptrs
45 .def(py::init<double, double>(), "x"_a = 0, "y"_a = 0)
46 .def_property("x", &gauss2d::CentroidValues::get_x, &gauss2d::CentroidValues::set_x)
47 .def_property("y", &gauss2d::CentroidValues::get_y, &gauss2d::CentroidValues::set_y)
48 .def_property("xy", &gauss2d::CentroidValues::get_xy, &gauss2d::CentroidValues::set_xy)
49 .def(py::self == py::self)
50 .def(py::self != py::self)
51 .def("__repr__",
52 [](const gauss2d::CentroidValues &self) {
53 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
54 })
55 .def("__str__", &gauss2d::CentroidValues::str);
56 py::class_<gauss2d::Centroid, std::shared_ptr<gauss2d::Centroid>>(m, "Centroid")
57 .def(py::init<std::shared_ptr<gauss2d::CentroidData>>(), "data"_a)
58 .def(py::init<double, double>(), "x"_a = 0, "y"_a = 0)
59 .def_property("x", &gauss2d::Centroid::get_x, &gauss2d::Centroid::set_x)
60 .def_property("y", &gauss2d::Centroid::get_y, &gauss2d::Centroid::set_y)
61 .def_property("xy", &gauss2d::Centroid::get_xy, &gauss2d::Centroid::set_xy)
62 .def(py::self == py::self)
63 .def(py::self != py::self)
64 .def("__repr__",
65 [](const gauss2d::Centroid &self) { return self.repr(true, self.PY_NAMESPACE_SEPARATOR); })
66 .def("__str__", &gauss2d::Centroid::str);
67}
double _c
int m
Definition SpanSet.cc:48
Interface for an object storing Centroid data.
Definition centroid.h:43
A 2D coordinate representing the center of a plane figure.
Definition centroid.h:114
A CentroidData storing centroid values as shared_ptrs.
Definition centroid.h:74

◆ bind_coordinatesystem()

void bind_coordinatesystem ( py::module & m)

Definition at line 36 of file coordinatesystem.cc.

36 {
37 py::class_<gauss2d::CoordinateSystem, std::shared_ptr<gauss2d::CoordinateSystem>>(m, "CoordinateSystem")
38 .def(py::init<double, double, double, double>(), "dx1"_a = 1., "dy2"_a = 1., "x_min"_a = 0.,
39 "y_min"_a = 0.)
40 .def_property_readonly("dx1", &gauss2d::CoordinateSystem::get_dx1)
41 .def_property_readonly("dy2", &gauss2d::CoordinateSystem::get_dy2)
42 .def_property_readonly("x_min", &gauss2d::CoordinateSystem::get_x_min)
43 .def_property_readonly("y_min", &gauss2d::CoordinateSystem::get_y_min)
44 .def(py::self == py::self)
45 .def(py::self != py::self)
46 .def("__repr__",
47 [](const gauss2d::CoordinateSystem &self) {
48 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
49 })
50 .def("__str__", &gauss2d::CoordinateSystem::str);
51}
A coordinate system specifying image scale and orientation.

◆ bind_ellipse()

void bind_ellipse ( py::module & m)

Definition at line 40 of file ellipse.cc.

40 {
41 py::class_<gauss2d::Covariance, std::shared_ptr<gauss2d::Covariance>>(m, "Covariance")
42 .def(py::init<double, double, double>(), "sigma_x_sq"_a = 0, "sigma_y_sq"_a = 0, "cov_xy"_a = 0)
43 .def(py::init<gauss2d::Ellipse &>())
44 .def("convolve", &gauss2d::Covariance::convolve)
45 .def("make_convolution", &gauss2d::Covariance::make_convolution)
46 .def("set",
47 static_cast<void (gauss2d::Covariance::*)(double, double, double)>(
48 &gauss2d::Covariance::set),
49 "sigma_x_sq"_a = 0, "sigma_y_sq"_a = 0, "cov_xy"_a = 0)
50 .def("set", static_cast<void (gauss2d::Covariance::*)(const gauss2d::Ellipse &)>(
51 &gauss2d::Covariance::set))
52 .def_property("sigma_x_sq", &gauss2d::Covariance::get_sigma_x_sq,
53 &gauss2d::Covariance::set_sigma_x_sq)
54 .def_property("sigma_y_sq", &gauss2d::Covariance::get_sigma_y_sq,
55 &gauss2d::Covariance::set_sigma_y_sq)
56 .def_property("cov_xy", &gauss2d::Covariance::get_cov_xy, &gauss2d::Covariance::set_cov_xy)
57 .def_property("xyc", &gauss2d::Covariance::get_xyc, &gauss2d::Covariance::set_xyc)
58 .def(py::self == py::self)
59 .def(py::self != py::self)
60 .def("__repr__",
61 [](const gauss2d::Covariance &self) { return self.repr(true, self.PY_NAMESPACE_SEPARATOR); })
62 .def("__str__", &gauss2d::Covariance::str);
63 auto _e = py::class_<gauss2d::EllipseData, std::shared_ptr<gauss2d::EllipseData>>(m, "EllipseData");
64 py::class_<gauss2d::EllipseValues, std::shared_ptr<gauss2d::EllipseValues>, gauss2d::EllipseData>(
65 m, "EllipseValues")
66 .def(py::init<double, double, double>(), "sigma_x"_a = 0, "sigma_y"_a = 0, "rho"_a = 0)
67 .def("set", &gauss2d::EllipseValues::set, "sigma_x"_a, "sigma_y"_a, "rho"_a)
68 .def("set_h", &gauss2d::EllipseValues::set_h, "hwhm_x"_a, "hwhm_y"_a, "rho"_a)
69 .def_property("rho", &gauss2d::EllipseValues::get_rho, &gauss2d::EllipseValues::set_rho)
70 .def_property("hwhm_x", &gauss2d::EllipseValues::get_hwhm_x, &gauss2d::EllipseValues::set_hwhm_x)
71 .def_property("hwhm_y", &gauss2d::EllipseValues::get_hwhm_y, &gauss2d::EllipseValues::set_hwhm_y)
72 .def_property("sigma_x", &gauss2d::EllipseValues::get_sigma_x,
73 &gauss2d::EllipseValues::set_sigma_x)
74 .def_property("sigma_y", &gauss2d::EllipseValues::get_sigma_y,
75 &gauss2d::EllipseValues::set_sigma_y)
76 .def_property("hxyr", &gauss2d::EllipseValues::get_hxyr, &gauss2d::EllipseValues::set_hxyr)
77 .def_property("xyr", &gauss2d::EllipseValues::get_xyr, &gauss2d::EllipseValues::set_xyr)
78 .def(py::self == py::self)
79 .def(py::self != py::self)
80 .def("__repr__",
81 [](const gauss2d::EllipseValues &self) {
82 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
83 })
84 .def("__str__", &gauss2d::EllipseValues::str);
85 py::class_<gauss2d::Ellipse, std::shared_ptr<gauss2d::Ellipse>>(m, "Ellipse")
86 .def(py::init<std::shared_ptr<gauss2d::EllipseData>>(), "data"_a)
87 .def(py::init<gauss2d::Covariance &>())
88 .def(py::init<gauss2d::EllipseMajor &>())
89 .def(py::init<double, double, double>(), "sigma_x"_a = 0, "sigma_y"_a = 0, "rho"_a = 0)
90 .def_static("check", &gauss2d::Ellipse::check)
91 .def("convolve", &gauss2d::Ellipse::convolve)
92 .def("get_cov_xy", &gauss2d::Ellipse::get_cov_xy)
93 .def("get_radius_trace", &gauss2d::Ellipse::get_radius_trace)
94 .def("make_convolution", &gauss2d::Ellipse::make_convolution)
95 .def("set",
96 static_cast<void (gauss2d::Ellipse::*)(double, double, double)>(&gauss2d::Ellipse::set),
97 "sigma_x"_a, "sigma_y"_a, "rho"_a)
98 .def("set",
99 static_cast<void (gauss2d::Ellipse::*)(const gauss2d::Covariance &)>(&gauss2d::Ellipse::set),
100 "ellipse"_a)
101 .def("set",
102 static_cast<void (gauss2d::Ellipse::*)(const gauss2d::EllipseMajor &)>(
103 &gauss2d::Ellipse::set),
104 "ellipse_major"_a)
105 .def("set_h", &gauss2d::Ellipse::set_h, "hwhm_x"_a = 0, "hwhm_y"_a = 0, "rho"_a = 0)
106 .def_property("rho", &gauss2d::Ellipse::get_rho, &gauss2d::Ellipse::set_rho)
107 .def_property("hwhm_x", &gauss2d::Ellipse::get_hwhm_x, &gauss2d::Ellipse::set_hwhm_x)
108 .def_property("hwhm_y", &gauss2d::Ellipse::get_hwhm_y, &gauss2d::Ellipse::set_hwhm_y)
109 .def_property("sigma_x", &gauss2d::Ellipse::get_sigma_x, &gauss2d::Ellipse::set_sigma_x)
110 .def_property("sigma_y", &gauss2d::Ellipse::get_sigma_y, &gauss2d::Ellipse::set_sigma_y)
111 .def_property("hxyr", &gauss2d::Ellipse::get_hxyr, &gauss2d::Ellipse::set_hxyr)
112 .def_property("xyr", &gauss2d::Ellipse::get_xyr, &gauss2d::Ellipse::set_xyr)
113 .def(py::self == py::self)
114 .def(py::self != py::self)
115 .def("__repr__",
116 [](const gauss2d::Ellipse &self) { return self.repr(true, self.PY_NAMESPACE_SEPARATOR); })
117 .def("__str__", &gauss2d::Ellipse::str);
118 py::class_<gauss2d::EllipseMajor, std::shared_ptr<gauss2d::EllipseMajor>>(m, "EllipseMajor")
119 .def(py::init<gauss2d::Covariance &, bool>(), "covariance"_a, "degrees"_a = false)
120 .def(py::init<gauss2d::Ellipse &, bool>(), "ellipse"_a, "degrees"_a = false)
121 .def(py::init<double, double, double, bool>(), "r_major"_a = 0, "axrat"_a = 1, "angle"_a = 0,
122 "degrees"_a = false)
123 .def_static("check", &gauss2d::EllipseMajor::check)
124 .def("get_angle_degrees", &gauss2d::EllipseMajor::get_angle_degrees)
125 .def("get_angle_radians", &gauss2d::EllipseMajor::get_angle_radians)
126 .def_property("r_major", &gauss2d::EllipseMajor::get_r_major, &gauss2d::EllipseMajor::set_r_major)
127 .def_property("axrat", &gauss2d::EllipseMajor::get_axrat, &gauss2d::EllipseMajor::set_axrat)
128 .def_property("angle", &gauss2d::EllipseMajor::get_angle, &gauss2d::EllipseMajor::set_angle)
129 .def_property("degrees", &gauss2d::EllipseMajor::is_degrees, &gauss2d::EllipseMajor::set_degrees)
130 .def_property("rqa", &gauss2d::EllipseMajor::get_rqa, &gauss2d::EllipseMajor::set_rqa)
131 .def(py::self == py::self)
132 .def(py::self != py::self)
133 .def("__repr__",
134 [](const gauss2d::EllipseMajor &self) {
135 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
136 })
137 .def("__str__", &gauss2d::EllipseMajor::str);
138}
A representation of a 2D Gaussian with x and y standard deviations and a covariance value.
Definition ellipse.h:57
Interface for an object storing Ellipse data.
Definition ellipse.h:132
An Ellipse with sigma_x, sigma_y, and rho values.
Definition ellipse.h:283
An Ellipse with r_major, axrat and angle values.
Definition ellipse.h:337
An EllipseData storing sigma_x, sigma_y, rho values as shared_ptrs.
Definition ellipse.h:232

◆ bind_gaussian()

void bind_gaussian ( py::module & m)

Definition at line 42 of file gaussian.cc.

42 {
43 m.doc() = "Gauss2D Gaussian Python bindings";
44
45 m.attr("M_HWHM_SIGMA") = py::float_(gauss2d::M_HWHM_SIGMA);
46 m.attr("M_SIGMA_HWHM") = py::float_(gauss2d::M_SIGMA_HWHM);
47
48 auto _g = py::class_<gauss2d::GaussianIntegral, std::shared_ptr<gauss2d::GaussianIntegral>>(
49 m, "GaussianIntegral");
51 std::shared_ptr<gauss2d::GaussianIntegralValue>>(m, "GaussianIntegralValue")
52 .def(py::init<double>(), "value"_a = 1)
53 .def_property("value", &gauss2d::GaussianIntegralValue::get_value,
54 &gauss2d::GaussianIntegralValue::set_value)
55 .def(py::self == py::self)
56 .def(py::self != py::self)
57 .def("__repr__",
58 [](const gauss2d::GaussianIntegralValue &self) {
59 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
60 })
61 .def("__str__", &gauss2d::GaussianIntegralValue::str);
62
63 py::class_<gauss2d::Gaussian, std::shared_ptr<gauss2d::Gaussian>>(m, "Gaussian")
66 "centroid"_a = nullptr, "ellipse"_a = nullptr, "integral"_a = nullptr)
67 .def_property_readonly("centroid", &gauss2d::Gaussian::get_centroid)
68 .def_property_readonly("ellipse", &gauss2d::Gaussian::get_ellipse)
69 .def_property_readonly("integral", &gauss2d::Gaussian::get_integral)
70 .def_property("const_normal", &gauss2d::Gaussian::get_const_normal,
71 &gauss2d::Gaussian::set_const_normal)
72 .def_property("integral_value", &gauss2d::Gaussian::get_integral_value,
73 &gauss2d::Gaussian::set_integral_value)
74 .def(py::self == py::self)
75 .def(py::self != py::self)
76 .def("__repr__",
77 [](const gauss2d::Gaussian &self) { return self.repr(true, self.PY_NAMESPACE_SEPARATOR); })
78 .def("__str__", &gauss2d::Gaussian::str);
79 py::class_<gauss2d::Gaussians, std::shared_ptr<gauss2d::Gaussians>>(m, "Gaussians")
80 .def(py::init<std::optional<const gauss2d::Gaussians::Data>>(), "gaussians"_a)
81 .def("at", &gauss2d::Gaussians::at, py::return_value_policy::copy)
82 .def_property_readonly("size", &gauss2d::Gaussians::size)
83 .def("__getitem__", &gauss2d::Gaussians::at_ptr, py::return_value_policy::copy)
84 .def("__len__", &gauss2d::Gaussians::size)
85 .def("__repr__",
86 [](const gauss2d::Gaussians &self) { return self.repr(true, self.PY_NAMESPACE_SEPARATOR); })
87 .def("__str__", &gauss2d::Gaussians::str);
88 py::class_<gauss2d::ConvolvedGaussian, std::shared_ptr<gauss2d::ConvolvedGaussian>>(m,
89 "ConvolvedGaussian")
91 "source"_a = nullptr, "kernel"_a = nullptr)
92 .def_property_readonly("kernel", &gauss2d::ConvolvedGaussian::get_kernel)
93 .def_property_readonly("source", &gauss2d::ConvolvedGaussian::get_source)
94 .def(py::self == py::self)
95 .def(py::self != py::self)
96 .def("__repr__",
97 [](const gauss2d::ConvolvedGaussian &self) {
98 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
99 })
100 .def("__str__", &gauss2d::ConvolvedGaussian::str);
101 py::class_<gauss2d::ConvolvedGaussians, std::shared_ptr<gauss2d::ConvolvedGaussians>>(
102 m, "ConvolvedGaussians")
103 .def(py::init<std::optional<const gauss2d::ConvolvedGaussians::Data>>(), "convolvedbgaussians"_a)
104 .def("at", &gauss2d::ConvolvedGaussians::at_ptr, py::return_value_policy::copy)
105 .def_property_readonly("size", &gauss2d::ConvolvedGaussians::size)
106 .def("__getitem__", &gauss2d::ConvolvedGaussians::at_ptr, py::return_value_policy::copy)
107 .def("__len__", &gauss2d::ConvolvedGaussians::size)
108 .def("__repr__",
109 [](const gauss2d::ConvolvedGaussians &self) {
110 return self.repr(true, self.PY_NAMESPACE_SEPARATOR);
111 })
112 .def("__str__", &gauss2d::ConvolvedGaussians::str);
113}
A convolution of a Gaussian source and kernel.
Definition gaussian.h:220
A collection of ConvolvedGaussian objects.
Definition gaussian.h:249
A 2D Gaussian with a Centroid, Ellipse, and integral.
Definition gaussian.h:99
Interface for the normalization (total integrated value) of a 2D Gaussian.
Definition gaussian.h:47
A GaussianIntegral storing a float value.
Definition gaussian.h:72
An array of Gaussian objects.
Definition gaussian.h:175
_g
Definition conf.py:10
const double M_SIGMA_HWHM
Definition ellipse.h:39
const double M_HWHM_SIGMA
Definition ellipse.h:38

◆ bind_image()

void bind_image ( py::module & m)

Definition at line 42 of file image.cc.

42 {
43 g2d::python::declare_image<bool>(m, "B");
44 g2d::python::declare_image<float>(m, "F");
45 g2d::python::declare_image<double>(m, "D");
46 g2d::python::declare_image<int>(m, "I");
47 g2d::python::declare_image<unsigned int>(m, "U");
48 g2d::python::declare_image<size_t>(m, "S");
49 g2d::python::declare_image_array<bool>(m, "B");
50 g2d::python::declare_image_array<float>(m, "F");
51 g2d::python::declare_image_array<double>(m, "D");
52 g2d::python::declare_image_array<int>(m, "I");
53 g2d::python::declare_image_array<unsigned int>(m, "U");
54 g2d::python::declare_image_array<size_t>(m, "S");
55 g2d::python::declare_evaluator<float>(m, "F");
56 g2d::python::declare_evaluator<double>(m, "D");
57 g2d::python::declare_maker<float, g2d::python::Image<float>, g2d::python::Image<size_t>>(m, "F");
58 g2d::python::declare_maker<double, g2d::python::Image<double>, g2d::python::Image<size_t>>(m, "D");
59}

◆ bind_object()

void bind_object ( py::module & m)

Definition at line 38 of file object.cc.

38 {
39 py::class_<gauss2d::Object, std::shared_ptr<gauss2d::Object>>(m, "Object");
40}