LSST Applications g0f08755f38+82efc23009,g12f32b3c4e+e7bdf1200e,g1653933729+a8ce1bb630,g1a0ca8cf93+50eff2b06f,g28da252d5a+52db39f6a5,g2bbee38e9b+37c5a29d61,g2bc492864f+37c5a29d61,g2cdde0e794+c05ff076ad,g3156d2b45e+41e33cbcdc,g347aa1857d+37c5a29d61,g35bb328faa+a8ce1bb630,g3a166c0a6a+37c5a29d61,g3e281a1b8c+fb992f5633,g414038480c+7f03dfc1b0,g41af890bb2+11b950c980,g5fbc88fb19+17cd334064,g6b1c1869cb+12dd639c9a,g781aacb6e4+a8ce1bb630,g80478fca09+72e9651da0,g82479be7b0+04c31367b4,g858d7b2824+82efc23009,g9125e01d80+a8ce1bb630,g9726552aa6+8047e3811d,ga5288a1d22+e532dc0a0b,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+37c5a29d61,gcf0d15dbbd+2acd6d4d48,gd7358e8bfb+778a810b6e,gda3e153d99+82efc23009,gda6a2b7d83+2acd6d4d48,gdaeeff99f8+1711a396fd,ge2409df99d+6b12de1076,ge79ae78c31+37c5a29d61,gf0baf85859+d0a5978c5a,gf3967379c6+4954f8c433,gfb92a5be7c+82efc23009,gfec2e1e490+2aaed99252,w.2024.46
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.