39 {
40 py::classh<gauss2d::Covariance>(m, "Covariance")
41 .def(py::init<double, double, double>(), "sigma_x_sq"_a = 0, "sigma_y_sq"_a = 0, "cov_xy"_a = 0)
42 .def(py::init<gauss2d::Ellipse &>())
45 .def("set",
48 "sigma_x_sq"_a = 0, "sigma_y_sq"_a = 0, "cov_xy"_a = 0)
57 .def(py::self == py::self)
58 .def(py::self != py::self)
59 .def("__repr__",
62 auto _e = py::classh<gauss2d::EllipseData>(m, "EllipseData");
63 py::classh<gauss2d::EllipseValues, gauss2d::EllipseData>(m, "EllipseValues")
64 .def(py::init<double, double, double>(), "sigma_x"_a = 0, "sigma_y"_a = 0, "rho"_a = 0)
76 .def(py::self == py::self)
77 .def(py::self != py::self)
78 .def("__repr__",
81 })
83 py::classh<gauss2d::Ellipse>(m, "Ellipse")
85 .def(py::init<gauss2d::Covariance &>())
86 .def(py::init<gauss2d::EllipseMajor &>())
87 .def(py::init<double, double, double>(), "sigma_x"_a = 0, "sigma_y"_a = 0, "rho"_a = 0)
93 .def("set",
95 "sigma_x"_a, "sigma_y"_a, "rho"_a)
96 .def("set",
98 "ellipse"_a)
99 .def("set",
102 "ellipse_major"_a)
111 .def(py::self == py::self)
112 .def(py::self != py::self)
113 .def("__repr__",
116 py::classh<gauss2d::EllipseMajor>(m, "EllipseMajor")
117 .def(py::init<gauss2d::Covariance &, bool>(), "covariance"_a, "degrees"_a = false)
118 .def(py::init<gauss2d::Ellipse &, bool>(), "ellipse"_a, "degrees"_a = false)
119 .def(py::init<double, double, double, bool>(), "r_major"_a = 0, "axrat"_a = 1, "angle"_a = 0,
120 "degrees"_a = false)
129 .def(py::self == py::self)
130 .def(py::self != py::self)
131 .def("__repr__",
134 })
136}
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.
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.
static constexpr std::string_view PY_NAMESPACE_SEPARATOR