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 &>())
46 .def("set",
49 "sigma_x_sq"_a = 0, "sigma_y_sq"_a = 0, "cov_xy"_a = 0)
58 .def(py::self == py::self)
59 .def(py::self != py::self)
60 .def("__repr__",
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)
78 .def(py::self == py::self)
79 .def(py::self != py::self)
80 .def("__repr__",
83 })
85 py::class_<gauss2d::Ellipse, std::shared_ptr<gauss2d::Ellipse>>(m, "Ellipse")
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)
95 .def("set",
97 "sigma_x"_a, "sigma_y"_a, "rho"_a)
98 .def("set",
100 "ellipse"_a)
101 .def("set",
104 "ellipse_major"_a)
113 .def(py::self == py::self)
114 .def(py::self != py::self)
115 .def("__repr__",
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)
131 .def(py::self == py::self)
132 .def(py::self != py::self)
133 .def("__repr__",
136 })
138}
A representation of a 2D Gaussian with x and y standard deviations and a covariance value.
std::shared_ptr< Covariance > make_convolution(const Covariance &cov) const
Return the convolution of this with another covariance.
double get_cov_xy() const
Get the covariance.
double get_sigma_x_sq() const
Get the square of sigma_x.
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.
void set_sigma_y_sq(double sigma_y_sq)
Set the square of sigma_y.
void set_sigma_x_sq(double sigma_x_sq)
Set the square of sigma_x.
void set_xyc(const std::array< double, 3 > &xyc)
Set sigma_x_sq, sigma_y_sq and cov_xy from an array ref.
std::array< double, 3 > get_xyc() const
Get the array of sigma_x^2, sigma_y^2, covariance.
std::string str() const override
Return a brief, human-readable string representation of this.
double get_sigma_y_sq() const
Get the square of sigma_y.
void convolve(const Covariance &cov)
Convolve with another covariance, adding the values of each parameter to this.
void set_cov_xy(double cov_xy)
Set the off-diagonal (covariance) term.
void set(const Ellipse &ellipse)
Set values from an ellipse instance.
Interface for an object storing Ellipse data.
virtual void set_hwhm_y(double hwhm_y)
Set the y-axis half-width at half-max (FWHM/2)
virtual void set(double sigma_x, double sigma_y, double rho)
Set sigma_x, sigma_y, rho.
virtual void set_h(double hwhm_x, double hwhm_y, double rho)
Set hwhm_x, hwhm_y, rho (half-width at half-max)
virtual void convolve(const Ellipse &ell)
Convolve this ellipse with another.
virtual void set_hwhm_x(double hwhm_x)
Set the x-axis half-width at half-max (FWHM/2)
virtual void set_xyr(const std::array< double, 3 > &xyr)
Set sigma_x, sigma_y, rho from an array.
virtual std::array< double, 3 > get_hxyr() const
Get hwhm_x, hwhm_y, rho.
virtual double get_cov_xy() const
Return the covariance, equal to sigma_x*sigma_y*rho.
static void check(double size_x, double size_y, double rho, std::string_view error_suffix="")
Check whether Ellipse parameter values are valid, throwing if not.
virtual double get_radius_trace() const
Return the trace radius, equal to sqrt(sigma_x^2 + sigma_y^2)
virtual void set_hxyr(const std::array< double, 3 > &hxyr)
Set hwhm_x, hwhm_y, rho from an array.
virtual double get_hwhm_y() const
Get the y-axis half-width at half-maximum.
virtual std::array< double, 3 > get_xyr() const
Get sigma_x, sigma_y, rho.
virtual double get_hwhm_x() const
Get the x-axis half-width at half-maximum.
An Ellipse with sigma_x, sigma_y, and rho values.
std::shared_ptr< Ellipse > make_convolution(const Ellipse &ell) const
Return the convolution of this with another ellipse.
double get_rho() const override
Get rho.
void set_rho(double rho) override
Set the correlation parameter (rho)
void set_sigma_y(double sigma_y) override
Set the y-axis dispersion (sigma)
void set_sigma_x(double sigma_x) override
Set the x-axis dispersion (sigma)
double get_sigma_x() const override
Get sigma_x.
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.
std::string str() const override
Return a brief, human-readable string representation of this.
double get_sigma_y() const override
Get sigma_y.
An Ellipse with r_major, axrat and angle values.
void set_degrees(bool degrees)
double get_axrat() const
Get the axis ratio.
double get_r_major() const
Get the major axis length.
double get_angle_radians() const
Get the position angle in radians.
bool is_degrees() const
Return if the units are degrees (true) or radians (false)
static void check(double r_major, double axrat, double angle)
Check whether the supplied values are valid, throwing if not.
void set_angle(double angle)
void set_rqa(const std::array< double, 3 > &rqa)
void set_r_major(double r_major)
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.
void set_axrat(double axrat)
std::array< double, 3 > get_rqa() const
Get the array of r_major, axrat, angle.
double get_angle() const
Get the position angle in the configured units.
double get_angle_degrees() const
Get the position angle in degrees.
std::string str() const override
Return a brief, human-readable string representation of this.
An EllipseData storing sigma_x, sigma_y, rho values as shared_ptrs.
void set_rho(double rho) override
Set the correlation parameter (rho)
void set_h(double hwhm_x, double hwhm_y, double rho) override
Set hwhm_x, hwhm_y, rho (half-width at half-max)
double get_rho() const override
Get rho.
std::string str() const override
Return a brief, human-readable string representation of this.
std::array< double, 3 > get_xyr() const override
Get sigma_x, sigma_y, rho.
void set(double sigma_x, double sigma_y, double rho) override
Set sigma_x, sigma_y, rho.
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.
void set_sigma_x(double sigma_x) override
Set the x-axis dispersion (sigma)
double get_sigma_y() const override
Get sigma_y.
void set_sigma_y(double sigma_y) override
Set the y-axis dispersion (sigma)
double get_sigma_x() const override
Get sigma_x.