Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04dff08e69+fafbcb10e2,g0d33ba9806+3d21495239,g0fba68d861+2ea2a6c4b0,g1e78f5e6d3+b3e27b8ebc,g1ec0fe41b4+f536777771,g1fd858c14a+ae46bc2a71,g35bb328faa+fcb1d3bbc8,g4af146b050+9c38a215af,g4d2262a081+154bb484c1,g53246c7159+fcb1d3bbc8,g5a012ec0e7+b20b785ecb,g60b5630c4e+3d21495239,g6273192d42+8013d063df,g67b6fd64d1+4086c0989b,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g87b7deb4dc+04106995ce,g8852436030+54b48a5987,g89139ef638+4086c0989b,g9125e01d80+fcb1d3bbc8,g94187f82dc+3d21495239,g989de1cb63+4086c0989b,g9d31334357+3d21495239,g9f33ca652e+83205baa3c,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+85d1f90f4c,gb58c049af0+f03b321e39,gb89ab40317+4086c0989b,gc0bb628dac+d11454dffd,gcf25f946ba+54b48a5987,gd6cbbdb0b4+af3c3595f5,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+1b29a75088,ge278dab8ac+d65b3c2b70,ge410e46f29+4086c0989b,gf67bdafdda+4086c0989b,v29.0.0.rc6
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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.