CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl::cosmology::SuperSampleCovariance Class Reference

The class SuperSampleCovariance. More...

#include <SuperSampleCovariance.h>

Public Member Functions

Constructors/destructors
 SuperSampleCovariance (cbl::cosmology::Cosmology cosm, const std::vector< cbl::cosmology::CosmologicalParameter > cosmo_param, const std::vector< double > redshift_edges, const double area, const std::string method_Pk="EisensteinHu", const double delta_z=0.001, const double precision=10, const bool NL=false, const bool store_output=false)
 Default constructor, used to compute the \(S_{ij}\) matrix, assuming top-hat window functions. The top-hat window function can be used when the redshift errors are smaller than the width of the redshift bins. More...
 
 SuperSampleCovariance (cbl::cosmology::Cosmology cosm, const std::vector< cbl::cosmology::CosmologicalParameter > cosmo_param, const double area, const std::vector< double > W_mean, const std::vector< double > W_std, const std::string method_Pk="EisensteinHu", const double delta_z=0.001, const double precision=10, const bool NL=false, const bool store_output=false)
 Default constructor, used to compute the \(S_{ij}\) matrix, assuming top-hat window functions. The top-hat window function can be used when the redshift errors are smaller than the width of the redshift bins. More...
 
virtual ~SuperSampleCovariance ()=default
 default destructor
 
Member functions to compute \f$S_{ij}\f$
std::vector< std::vector< double > > operator() (std::vector< double > &parameter) const
 get \(S_{ij}\) More...
 
Member functions to get the private members of the class
std::vector< std::vector< double > > get_window_function ()
 return the window functions More...
 
int Sij_dimension ()
 return the dimension of the Sij matrix More...
 
Member functions that write on file the products of the class
void write_window_function (const std::string dir, const std::string file)
 write the window functions on file More...
 
void write_Sij (const std::string dir, const std::string file)
 Write the \(S_{ij}\) matrix on file. More...
 

Protected Member Functions

void m_compute_topHat_window (const double delta_z, const std::vector< double > redshift_edges)
 compute the top-hat window functions in the redshift bins More...
 
void m_compute_gaussian_window (const double delta_z, const std::vector< double > W_mean, const std::vector< double > W_std)
 compute the Gaussian window functions in the redshift bins More...
 
std::vector< std::vector< double > > m_compute_Sij (cbl::cosmology::Cosmology cosmo) const
 compute the S_ij matrix More...
 

Protected Attributes

std::vector< std::shared_ptr< statistics::Model > > m_response_func
 pointer to the response function of the probe
 
std::shared_ptr< cosmology::Cosmologym_cosmo
 pointer to the Cosmology object
 
std::vector< cbl::cosmology::CosmologicalParameterm_cosmo_param
 names of the cosmological parameters
 
std::string m_method_Pk
 method used to compute the power spectrum
 
bool m_NL
 linear o non-linear power-spectrum
 
bool m_store_output
 store Pk output
 
int m_nbins
 number of redshift bins
 
int m_nsteps
 number of redshift steps where the S matrix is computed
 
std::vector< double > m_redshifts
 vector containing the redshift values where the S matrix is computed
 
double m_area
 survey area in steradians
 
double m_precision
 precision of the \(log k\) array
 
std::vector< std::vector< double > > m_windows
 window functions in the redshift bins
 

Detailed Description

The class SuperSampleCovariance.

"Headers/SuperSampleCovariance.h"

This is the base class used to manage the super-sample covariance matrix

Definition at line 77 of file SuperSampleCovariance.h.

Constructor & Destructor Documentation

◆ SuperSampleCovariance() [1/2]

cbl::cosmology::SuperSampleCovariance::SuperSampleCovariance ( cbl::cosmology::Cosmology  cosm,
const std::vector< cbl::cosmology::CosmologicalParameter cosmo_param,
const std::vector< double >  redshift_edges,
const double  area,
const std::string  method_Pk = "EisensteinHu",
const double  delta_z = 0.001,
const double  precision = 10,
const bool  NL = false,
const bool  store_output = false 
)

Default constructor, used to compute the \(S_{ij}\) matrix, assuming top-hat window functions. The top-hat window function can be used when the redshift errors are smaller than the width of the redshift bins.

Given two redshift bins, labelled as \(i\) and \(j\), \(S_{ij}\) is:

\( S_{ij} = \frac{1}{\Omega} \frac{1}{2\pi^2} \int {\rm d} k\,\, k^2 P(k) \frac{U_i(k)}{I_i} \frac{U_j(k)}{I_j}, \)

where \(\Omega\) is the survey area, \(P(k)\) is the power spectrum, and \(U_i(k)\) and \(I_i\) are expressed as:

\( U_i(k) = \int {\rm d} V_i \,\, W^2_i g(z_j) j_0(kr_j), \)

\( I_i = \int {\rm d} V_i \,\, W^2_i, \)

where \(V_i\) is the comoving volume within the \(i\)-th redshift bin, \(g\) is the growth factor, \(j_0\) the Bessel spherical function, and \(W_i\) is the window function.

Physical units are forced.

Parameters
cosmthe Cosmology object
cosmo_paramthe cosmological parameters set in the modelling (useful only if a modelling is performed)
redshift_edgesredshift bin edges
areaeffective area of the survey, expressed in squared degrees
method_Pkthe method used to compute the power spectrum
delta_zredshift step used to construct the window function
precisionprecision of the \(\log k\) array, defined by \(2^{\rm precision}\)
NLfalse \(\rightarrow\) linear power spectrum; true \(\rightarrow\) non-linear power spectrum
store_outputif true the output files created by the Boltzmann solver are stored; if false the output files are removed

Definition at line 40 of file SuperSampleCovariance.cpp.

◆ SuperSampleCovariance() [2/2]

cbl::cosmology::SuperSampleCovariance::SuperSampleCovariance ( cbl::cosmology::Cosmology  cosm,
const std::vector< cbl::cosmology::CosmologicalParameter cosmo_param,
const double  area,
const std::vector< double >  W_mean,
const std::vector< double >  W_std,
const std::string  method_Pk = "EisensteinHu",
const double  delta_z = 0.001,
const double  precision = 10,
const bool  NL = false,
const bool  store_output = false 
)

Default constructor, used to compute the \(S_{ij}\) matrix, assuming top-hat window functions. The top-hat window function can be used when the redshift errors are smaller than the width of the redshift bins.

Given two redshift bins, labelled as \(i\) and \(j\), \(S_{ij}\) is:

\( S_{ij} = \frac{1}{\Omega} \frac{1}{2\pi^2} \int {\rm d} k\,\, k^2 P(k) \frac{U_i(k)}{I_i} \frac{U_j(k)}{I_j}, \)

where \(\Omega\) is the survey area, \(P(k)\) is the power spectrum, and \(U_i(k)\) and \(I_i\) are expressed as:

\( U_i(k) = \int {\rm d} V_i \,\, W^2_i g(z_j) j_0(kr_j), \)

\( I_i = \int {\rm d} V_i \,\, W^2_i, \)

where \(V_i\) is the comoving volume within the \(i\)-th redshift bin, \(g\) is the growth factor, \(j_0\) the Bessel spherical function, and \(W_i\) is the window function.

Physical units are forced.

Parameters
cosmthe Cosmology object
cosmo_paramthe cosmological parameters set in the modelling (useful only if a modelling is performed)
areaeffective area of the survey, expressed in squared degrees
W_meanvector of mean values for the Gaussian window functions, corresponding to the centre of the redshift bins
W_stdvector of standard deviation values for the Gaussian window functions
method_Pkthe method used to compute the power spectrum
delta_zredshift step used to construct the window function
precisionprecision of the \(\log k\) array, defined by \(2^{\rm precision}\)
NLfalse \(\rightarrow\) linear power spectrum; true \(\rightarrow\) non-linear power spectrum
store_outputif true the output files created by the Boltzmann solver are stored; if false the output files are removed

Definition at line 64 of file SuperSampleCovariance.cpp.

Member Function Documentation

◆ get_window_function()

std::vector< std::vector< double > > cbl::cosmology::SuperSampleCovariance::get_window_function ( )

return the window functions

Returns
the window function

Definition at line 259 of file SuperSampleCovariance.cpp.

◆ m_compute_gaussian_window()

void cbl::cosmology::SuperSampleCovariance::m_compute_gaussian_window ( const double  delta_z,
const std::vector< double >  W_mean,
const std::vector< double >  W_std 
)
protected

compute the Gaussian window functions in the redshift bins

Parameters
delta_zredshift step used to construct the window function
W_meanvector of mean values for the Gaussian window functions
W_stdvector of standard deviation values for the Gaussian window functions

Definition at line 114 of file SuperSampleCovariance.cpp.

◆ m_compute_Sij()

std::vector< std::vector< double > > cbl::cosmology::SuperSampleCovariance::m_compute_Sij ( cbl::cosmology::Cosmology  cosmo) const
protected

compute the S_ij matrix

Parameters
cosmothe cosmological model
Returns
the super-sample covariance matrix

Definition at line 138 of file SuperSampleCovariance.cpp.

◆ m_compute_topHat_window()

void cbl::cosmology::SuperSampleCovariance::m_compute_topHat_window ( const double  delta_z,
const std::vector< double >  redshift_edges 
)
protected

compute the top-hat window functions in the redshift bins

Parameters
delta_zredshift step used to construct the window function
redshift_edgesredshift bin edges

Definition at line 88 of file SuperSampleCovariance.cpp.

◆ operator()()

std::vector< std::vector< double > > cbl::cosmology::SuperSampleCovariance::operator() ( std::vector< double > &  parameter) const

get \(S_{ij}\)

Parameters
parameterthe parameters of interest in the covariance matrix
Returns
the covariance matrix

Definition at line 241 of file SuperSampleCovariance.cpp.

◆ Sij_dimension()

int cbl::cosmology::SuperSampleCovariance::Sij_dimension ( )

return the dimension of the Sij matrix

Returns
the dimension of the Sij matrix

Definition at line 325 of file SuperSampleCovariance.cpp.

◆ write_Sij()

void cbl::cosmology::SuperSampleCovariance::write_Sij ( const std::string  dir,
const std::string  file 
)

Write the \(S_{ij}\) matrix on file.

Since the objects of the class SuperSampleCovariance are used in parallelized MCMC computations, \(S_{ij}\) is not set as a member of this class. Therefore, this function calculates \(S_{ij}\)

Parameters
diroutput directory
fileoutput file

Definition at line 296 of file SuperSampleCovariance.cpp.

◆ write_window_function()

void cbl::cosmology::SuperSampleCovariance::write_window_function ( const std::string  dir,
const std::string  file 
)

write the window functions on file

Parameters
diroutput directory
fileoutput file

Definition at line 269 of file SuperSampleCovariance.cpp.


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