LSST Applications g1653933729+34a971ddd9,g1a997c3884+34a971ddd9,g2160c40384+da0d0eec6b,g28da252d5a+1236b942f7,g2bbee38e9b+e5a1bc5b38,g2bc492864f+e5a1bc5b38,g2ca4be77d2+192fe503f0,g2cdde0e794+704103fe75,g3156d2b45e+6e87dc994a,g347aa1857d+e5a1bc5b38,g35bb328faa+34a971ddd9,g3a166c0a6a+e5a1bc5b38,g3e281a1b8c+8ec26ec694,g4005a62e65+ba0306790b,g414038480c+9f5be647b3,g41af890bb2+c3a10c924f,g5065538af8+e7237db731,g5a0bb5165c+eae055db26,g717e5f8c0f+b65b5c3ae4,g80478fca09+4ce5a07937,g82479be7b0+08790af60f,g858d7b2824+b65b5c3ae4,g9125e01d80+34a971ddd9,ga5288a1d22+5df949a35e,gae0086650b+34a971ddd9,gb58c049af0+ace264a4f2,gbd397ab92a+2141afb137,gc28159a63d+e5a1bc5b38,gc805d3fbd4+b65b5c3ae4,gcf0d15dbbd+97632ccc20,gd6b7c0dfd1+de826e8718,gda6a2b7d83+97632ccc20,gdaeeff99f8+7774323b41,ge2409df99d+e6cadbf968,ge33fd446bb+b65b5c3ae4,ge79ae78c31+e5a1bc5b38,gf0baf85859+890af219f9,gf5289d68f6+a27069ed62,w.2024.37
LSST Data Management Base Package
Loading...
Searching...
No Matches
gaussianparametricellipse.cc
Go to the documentation of this file.
2
5#include "lsst/gauss2d/fit/parameters.h"
6
7namespace lsst::gauss2d::fit {
8template <typename t>
10 RhoParameterD& r) {
11 insert_param(x, params, filter);
12 insert_param(y, params, filter);
13 insert_param(r, params, filter);
14 return params;
15}
16
20 : _sigma_x(sigma_x == nullptr ? std::make_shared<SigmaXParameterD>(0) : std::move(sigma_x)),
21 _sigma_y(sigma_y == nullptr ? std::make_shared<SigmaYParameterD>(0) : std::move(sigma_y)),
22 _rho(rho == nullptr ? std::make_shared<RhoParameterD>(0) : std::move(rho)) {};
23GaussianParametricEllipse::GaussianParametricEllipse(double sigma_x, double sigma_y, double rho)
24 : _sigma_x(std::make_shared<SigmaXParameterD>(sigma_x)),
25 _sigma_y(std::make_shared<SigmaYParameterD>(sigma_y)),
26 _rho(std::make_shared<RhoParameterD>(rho)) {};
27
29 return _get_parameters<ParamRefs>(params, filter, *_sigma_x, *_sigma_y, *_rho);
30}
31
33 return _get_parameters<ParamCRefs>(params, filter, *_sigma_x, *_sigma_y, *_rho);
34}
35
37 return lsst::gauss2d::M_SIGMA_HWHM * _sigma_x->get_value();
38}
40 return lsst::gauss2d::M_SIGMA_HWHM * _sigma_y->get_value();
41}
42double GaussianParametricEllipse::get_rho() const { return _rho->get_value(); }
43double GaussianParametricEllipse::get_sigma_x() const { return _sigma_x->get_value(); }
44double GaussianParametricEllipse::get_sigma_y() const { return _sigma_y->get_value(); }
45double GaussianParametricEllipse::get_size_x() const { return _sigma_x->get_value(); }
46double GaussianParametricEllipse::get_size_y() const { return _sigma_y->get_value(); }
48 return {this->get_hwhm_x(), this->get_hwhm_y(), this->get_rho()};
49}
50
52 return {this->get_sigma_x(), this->get_sigma_y(), this->get_rho()};
53}
54
60
66
67void GaussianParametricEllipse::set(double sigma_x, double sigma_y, double rho) {
68 set_sigma_x(sigma_x);
69 set_sigma_y(sigma_y);
70 set_rho(rho);
71}
72void GaussianParametricEllipse::set_h(double hwhm_x, double hwhm_y, double rho) {
73 set_hwhm_x(hwhm_x);
74 set_hwhm_y(hwhm_y);
75 set_rho(rho);
76}
77inline void GaussianParametricEllipse::set_hwhm_x(double hwhm_x) {
78 _sigma_x->set_value(lsst::gauss2d::M_HWHM_SIGMA * hwhm_x);
79}
80inline void GaussianParametricEllipse::set_hwhm_y(double hwhm_y) {
81 _sigma_y->set_value(lsst::gauss2d::M_HWHM_SIGMA * hwhm_y);
82}
83inline void GaussianParametricEllipse::set_rho(double rho) { _rho->set_value(rho); }
84inline void GaussianParametricEllipse::set_sigma_x(double sigma_x) { _sigma_x->set_value(sigma_x); }
85inline void GaussianParametricEllipse::set_sigma_y(double sigma_y) { _sigma_y->set_value(sigma_y); }
86inline void GaussianParametricEllipse::set_size_x(double size_x) { _sigma_x->set_value(size_x); }
87inline void GaussianParametricEllipse::set_size_y(double size_y) { _sigma_y->set_value(size_y); }
89 this->set_h(hxyr[0], hxyr[1], hxyr[2]);
90}
92 this->set(xyr[0], xyr[1], xyr[2]);
93}
94
95std::string GaussianParametricEllipse::repr(bool name_keywords, std::string_view namespace_separator) const {
96 return type_name_str<GaussianParametricEllipse>(false, namespace_separator) + "("
97 + (name_keywords ? "sigma_x=" : "") + _sigma_x->repr(name_keywords, namespace_separator) + ", "
98 + (name_keywords ? "sigma_y=" : "") + _sigma_y->repr(name_keywords, namespace_separator) + ", "
99 + (name_keywords ? "rho=" : "") + _rho->repr(name_keywords, namespace_separator) + ")";
100}
101
103 return type_name_str<GaussianParametricEllipse>(true) + "(sigma_x=" + _sigma_x->str()
104 + ", sigma_y=" + _sigma_y->str() + ", rho=" + _rho->str() + ")";
105}
106
107} // namespace lsst::gauss2d::fit
int y
Definition SpanSet.cc:48
std::string str() const override
Return a brief, human-readable string representation of this.
std::shared_ptr< SizeYParameterD > get_size_y_param_ptr() override
void set(double sigma_x, double sigma_y, double rho) override
Set sigma_x, sigma_y, rho.
double get_hwhm_x() const override
Get the x-axis half-width at half-maximum.
void set_hwhm_y(double hwhm_y) override
Set the y-axis half-width at half-max (FWHM/2)
void set_hwhm_x(double hwhm_x) override
Set the x-axis half-width at half-max (FWHM/2)
void set_sigma_y(double sigma_y) override
Set the y-axis dispersion (sigma)
SigmaXParameterD & get_sigma_x_param() const
Explicit alias for get_size_x_param.
GaussianParametricEllipse(std::shared_ptr< SigmaXParameterD > sigma_x, std::shared_ptr< SigmaYParameterD > sigma_y, std::shared_ptr< RhoParameterD > rho=nullptr)
Construct a GaussianParametricEllipse from Parameter instances.
void set_rho(double rho) override
Set the correlation parameter (rho)
std::shared_ptr< SigmaYParameterD > get_sigma_y_param_ptr()
Explicit alias for get_sigma_y_param_ptr.
std::shared_ptr< SigmaXParameterD > get_sigma_x_param_ptr()
Explicit alias for get_sigma_x_param_ptr.
ParamRefs & get_parameters(ParamRefs &params, ParamFilter *filter=nullptr) const override
Add Parameter refs matching the filter to a vector, in order.
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.
SigmaYParameterD & get_sigma_y_param() const
Explicit alias for get_size_y_param.
std::shared_ptr< SizeXParameterD > get_size_x_param_ptr() override
double get_size_y() const override
Get the size_y value.
void set_hxyr(const std::array< double, 3 > &hxyr) override
Set hwhm_x, hwhm_y, rho from an array.
std::array< double, 3 > get_hxyr() const override
Get hwhm_x, hwhm_y, rho.
std::shared_ptr< RhoParameterD > get_rho_param_ptr() override
void set_h(double hwhm_x, double hwhm_y, double rho) override
Set hwhm_x, hwhm_y, rho (half-width at half-max)
void set_sigma_x(double sigma_x) override
Set the x-axis dispersion (sigma)
double get_hwhm_y() const override
Get the y-axis half-width at half-maximum.
std::array< double, 3 > get_xyr() const override
Get sigma_x, sigma_y, rho.
void set_xyr(const std::array< double, 3 > &xyr) override
Set sigma_x, sigma_y, rho from an array.
ParamCRefs & get_parameters_const(ParamCRefs &params, ParamFilter *filter=nullptr) const override
Same as get_parameters(), but for const refs.
double get_size_x() const override
Get the size_x value.
daf::base::PropertySet * set
Definition fits.cc:931
void insert_param(g2f::ParamBase &param, t &params, ParamFilter *filter=nullptr)
Add a Parameter to a vector thereof, if it meets conditions.
t & _get_parameters(t &params, ParamFilter *filter, CentroidXParameterD &x, CentroidYParameterD &y)
const double M_SIGMA_HWHM
Definition ellipse.h:39
const double M_HWHM_SIGMA
Definition ellipse.h:38
STL namespace.
Options for filtering Parameter instances.