lsst.gauss2d gbf99507273+afb4790f61
 
Loading...
Searching...
No Matches
lsst::gauss2d::Covariance Class Reference

A representation of a 2D Gaussian with x and y standard deviations and a covariance value. More...

#include <ellipse.h>

Inheritance diagram for lsst::gauss2d::Covariance:
lsst::gauss2d::Object

Public Member Functions

 Covariance (double sigma_x_sq=0, double sigma_y_sq=0, double cov_xy=0)
 Construct a new Covariance object.
 
 Covariance (const Ellipse &ell)
 Construct a covariance using values from an ellipse instance.
 
void convolve (const Covariance &cov)
 Convolve with another covariance, adding the values of each parameter to this.
 
double get_sigma_x_sq () const
 Get the square of sigma_x.
 
double get_sigma_y_sq () const
 Get the square of sigma_y.
 
double get_cov_xy () const
 Get the covariance.
 
std::array< double, 3 > get_xyc () const
 Get the array of sigma_x^2, sigma_y^2, covariance.
 
std::shared_ptr< Covariancemake_convolution (const Covariance &cov) const
 Return the convolution of this with another covariance.
 
std::unique_ptr< Covariancemake_convolution_uniq (const Covariance &cov) const
 Same as make_convolution(), but returning a unique_ptr.
 
void set (const Ellipse &ellipse)
 Set values from an ellipse instance.
 
void set (double sigma_x_sq=0, double sigma_y_sq=0, double cov_xy=0)
 Set all values at once.
 
void set_sigma_x_sq (double sigma_x_sq)
 Set the square of sigma_x.
 
void set_sigma_y_sq (double sigma_y_sq)
 Set the square of sigma_y.
 
void set_cov_xy (double cov_xy)
 Set the off-diagonal (covariance) term.
 
void set_xyc (const std::array< double, 3 > &xyc)
 Set sigma_x_sq, sigma_y_sq and cov_xy from an array ref.
 
std::string repr (bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
 
std::string str () const override
 Return a brief, human-readable string representation of this.
 
bool operator== (const Covariance &other) const
 
bool operator!= (const Covariance &other) const
 

Static Public Member Functions

static void check (double sigma_x_sq, double sigma_y_sq, double cov_xy)
 Check whether the supplied values are valid, throwing if not.
 
- Static Public Member Functions inherited from lsst::gauss2d::Object
static std::string_view null_str (const std::string_view &namespace_separator)
 

Friends

std::ostreamoperator<< (std::ostream &out, const Covariance &obj)
 

Additional Inherited Members

- Static Public Attributes inherited from lsst::gauss2d::Object
static constexpr std::string_view CC_NAMESPACE_SEPARATOR = "::"
 The C++ namespace separator.
 
static constexpr std::string_view NULL_STR_GENERAL = "None"
 
static constexpr std::string_view PY_NAMESPACE_SEPARATOR = "."
 

Detailed Description

A representation of a 2D Gaussian with x and y standard deviations and a covariance value.

This ellipse representation is intended for intermediate calculations and does not use an abstract Data class.

Note
The covariance is equal to sigma_x*sigma_y*rho, where -1 < rho < 1. Covariance values implying rho values outside this range are invalid.

Constructor & Destructor Documentation

◆ Covariance()

lsst::gauss2d::Covariance::Covariance ( double sigma_x_sq = 0,
double sigma_y_sq = 0,
double cov_xy = 0 )
explicit

Construct a new Covariance object.

Parameters
sigma_x_sqThe value of sigma_x^2
sigma_y_sqThe value of sigma_y^2
cov_xyThe value of the covariance

Member Function Documentation

◆ make_convolution()

std::shared_ptr< Covariance > lsst::gauss2d::Covariance::make_convolution ( const Covariance & cov) const

Return the convolution of this with another covariance.

Convolution simply sums the values of each respective parameter.

Parameters
covThe covariance to convolve with.
Returns
A new covariance with values set to the convolution.

◆ repr()

std::string lsst::gauss2d::Covariance::repr ( bool name_keywords = false,
std::string_view namespace_separator = Object::CC_NAMESPACE_SEPARATOR ) const
overridevirtual

Return a full, callable string representation of this.

Parameters
name_keywordsWhether to prefix arguments with "{name}=", where name is the arg name in the header (as with keyword arguments in Python).
namespace_separatorThe string to use to delimit namespaces, i.e. :: in C++ and . in Python.
Returns
A callable string representation of this, which should return an an identical object to this.
Note
The representation with name_keywords=false must be callable in C++. The representation with name_keywords=true should be callable in Python, if there are any bindings.

Implements lsst::gauss2d::Object.

◆ str()

std::string lsst::gauss2d::Covariance::str ( ) const
overridevirtual

Return a brief, human-readable string representation of this.

Implements lsst::gauss2d::Object.


The documentation for this class was generated from the following files: