LSST Applications 29.0.1,g0fba68d861+132dd21e0a,g107a963962+1bb9f809a9,g1fd858c14a+005be21cae,g21d47ad084+8a07b29876,g325378336f+5d73323c8f,g330003fc43+40b4eaffc6,g35bb328faa+fcb1d3bbc8,g36ff55ed5b+9c28a42a87,g4e0f332c67+5fbd1e3e73,g53246c7159+fcb1d3bbc8,g60b5630c4e+9c28a42a87,g67b6fd64d1+a38b34ea13,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g86c591e316+6b2b2d0295,g8852436030+bf14db0e33,g89139ef638+a38b34ea13,g8b8da53e10+e3777245af,g9125e01d80+fcb1d3bbc8,g989de1cb63+a38b34ea13,g9f1445be69+9c28a42a87,g9f33ca652e+52c8f07962,ga9baa6287d+9c28a42a87,ga9e4eb89a6+9f84bd6575,gabe3b4be73+1e0a283bba,gb037a4e798+f3cbcd26c0,gb1101e3267+e7be8da0f8,gb58c049af0+f03b321e39,gb89ab40317+a38b34ea13,gcf25f946ba+bf14db0e33,gd6cbbdb0b4+bce7f7457e,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+53d424b1ae,ge278dab8ac+222406d50a,ge410e46f29+a38b34ea13,ge80e9994a3+664d6357dc,gf67bdafdda+a38b34ea13
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
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.
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)
std::vector< ParamBaseRef > ParamRefs
Definition param_defs.h:13
std::vector< ParamBaseCRef > ParamCRefs
Definition param_defs.h:11
const double M_SIGMA_HWHM
Definition ellipse.h:39
const double M_HWHM_SIGMA
Definition ellipse.h:38
std::string type_name_str(bool strip_namespace=false, std::string_view namespace_str=detail::NAMESPACE_SEPARATOR)
Get a string representation of an arbitrary C++ type, potentially modifying its namespace prefix.
Definition type_name.h:104
STL namespace.
Options for filtering Parameter instances.