LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
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.