CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl Namespace Reference

The global namespace of the CosmoBolognaLib More...

Namespaces

 catalogue
 The namespace of the functions and classes used to handle catalogues of astronomical sources
 
 chainmesh
 The namespace of the functions and classes used for the chain-mesh method
 
 cosmology
 The namespace of the functions and classes used for cosmological calculations
 
 data
 The namespace of the functions and classes used to handle data of any kind.
 
 glob
 The namespace of the functions and classes of internal auxiliary use
 
 lognormal
 The namespace of the functions and classes used to construct log-normal mocks
 
 measure
 The namespace of the functions and classes used to manage any kind of measure
 
 modelling
 The namespace of the functions and classes used for modelling
 
 pairs
 The namespace of the functions and classes used to handle pairs of objects
 
 par
 The namespace of the global parameters and constants
 
 random
 The namespace of the functions and classes used to handle random numbers
 
 statistics
 The namespace of the functions and classes used for statistical analyses
 
 triplets
 The namespace of the functions and classes used to handle triplets of objects
 
 wrapper
 The namespace of the wrappers
 

Classes

class  Path
 The class Path. More...
 

Typedefs

typedef Eigen::Matrix< double, 3, 1 > Vector3D
 Eigen 3D std::vector.
 
typedef Eigen::Matrix< double, 4, 1 > Vector4D
 Eigen 4D matrix.
 
typedef Eigen::Matrix< std::complex< double >, 1, Eigen::Dynamic > VectorComplex
 Eigen complex std::vector.
 
typedef std::function< double(double)> FunctionDoubleDouble
 typedef of a function returning a double with a double in input
 
typedef std::function< double(std::vector< double >)> FunctionDoubleVector
 typedef of a function returning a double with a vector in input
 
typedef std::function< double(std::vector< double > &)> FunctionDoubleVectorRef
 typedef of a function returning a double with a vector reference in input
 
typedef std::function< double(double, std::shared_ptr< void >, std::vector< double > &)> FunctionDoubleDoublePtrVectorRef
 typedef of a function returning a double with a double, a pointer and a vector reference in input
 
typedef std::function< double(double, double, std::shared_ptr< void >, std::vector< double > &)> FunctionDoubleDoubleDoublePtrVectorRef
 typedef of a function returning a double with two double, a pointer and a vector reference in input
 
typedef std::function< double(std::vector< double >, std::shared_ptr< void >, std::vector< double > &)> FunctionDoubleVectorPtrVectorRef
 typedef of a function returning a double with a vector, a pointer and a vector reference in input
 
typedef std::function< std::vector< double >std::vector< double >, std::shared_ptr< void >, std::vector< double > &)> FunctionVectorVectorPtrVectorRef
 typedef of a function returning a vector with a vector, a pointer and a vector reference in input
 
typedef std::vector< std::vector< std::vector< int > > > Tensor3Di
 typedef of a 3D Tensor of int
 
typedef std::vector< std::vector< std::vector< double > > > Tensor3Dd
 typedef of a 3D Tensor of double
 
typedef std::vector< std::vector< std::vector< std::vector< int > > > > Tensor4Di
 typedef of a 4D Tensor of int
 
typedef std::function< double(double, std::shared_ptr< void >, std::vector< double >)> distribution_func
 generic distribution function More...
 
typedef std::function< double(std::vector< double >, std::shared_ptr< void >)> nDim_distribution_func
 distribution function used for a n-dimensional distribution More...
 

Enumerations

enum class  Dim { _1D_ , _2D_ }
 the dimension, used e.g. for pair and triplet vectors More...
 
enum class  BinType { _linear_ , _logarithmic_ , _custom_ }
 the binning type More...
 
enum class  CoordinateUnits { _radians_ , _degrees_ , _arcseconds_ , _arcminutes_ }
 the coordinate units More...
 
enum class  CoordinateType { _comoving_ , _observed_ }
 the coordinate type More...
 

Functions

template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
castFromValue (const int i)
 cast an object of type enum class from its index More...
 
template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
castFromName (const std::string name, const std::vector< std::string > list)
 cast an object of type enum class from its name More...
 
template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
std::vector< T > castFromValues (const std::vector< int > ii)
 cast objects of type enum class from indeces More...
 
template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
std::vector< T > castFromNames (const std::vector< std::string > names, const std::vector< std::string > list)
 cast an object of type enum class from names More...
 
std::vector< std::string > DimNames ()
 return a vector containing the Dim names More...
 
std::vector< std::string > BinTypeNames ()
 return a vector containing the BinType names More...
 
BinType BinTypeCast (const int binTypeIndex)
 cast an enum of type BinType from its index More...
 
BinType BinTypeCast (const std::string binTypeName)
 cast an enum of type BinType from its name More...
 
std::vector< BinTypeBinTypeCast (const std::vector< int > binTypeIndeces)
 cast an enum of type BinType from indeces More...
 
std::vector< BinTypeBinTypeCast (const std::vector< std::string > binTypeNames)
 cast an enum of type BinType from thier names More...
 
std::vector< std::string > CoordinateUnitsNames ()
 return a std::vector containing the CoordinateUnits names More...
 
CoordinateUnits CoordinateUnitsCast (const int coordinateUnitsIndex)
 cast an enum of type CoordinateUnits from its index More...
 
CoordinateUnits CoordinateUnitsCast (const std::string coordinateUnitsName)
 cast an enum of type CoordinateUnits from its name More...
 
std::vector< CoordinateUnitsCoordinateUnitsCast (const std::vector< int > coordinateUnitsIndeces)
 cast an enum of type CoordinateUnits from indeces More...
 
std::vector< CoordinateUnitsCoordinateUnitsCast (const std::vector< std::string > coordinateUnitsNames)
 cast an enum of type CoordinateUnits from thier names More...
 
std::vector< std::string > CoordinateTypeNames ()
 return a std::vector containing the CoordinateType names More...
 
CoordinateType CoordinateTypeCast (const int coordinateTypeIndex)
 cast an enum of type CoordinateType from its index More...
 
CoordinateType CoordinateTypeCast (const std::string coordinateTypeName)
 cast an enum of type CoordinateType from its name More...
 
std::vector< CoordinateTypeCoordinateTypeCast (const std::vector< int > coordinateTypeIndeces)
 cast an enum of type CoordinateType from indeces More...
 
std::vector< CoordinateTypeCoordinateTypeCast (const std::vector< std::string > coordinateTypeNames)
 cast an enum of type CoordinateType from thier names More...
 
Functions of generic use
double interpolated (const double _xx, const std::vector< double > xx, const std::vector< double > yy, const std::string type)
 1D interpolation More...
 
double interpolated_2D (const double _x1, const double _x2, const std::vector< double > x1, const std::vector< double > x2, const std::vector< std::vector< double >> yy, const std::string type)
 2D interpolation More...
 
std::vector< double > linear_interpolation_3D (const std::vector< double > min, std::vector< double > max, std::vector< int > steps, std::vector< std::vector< std::vector< double >>> func, const std::vector< std::vector< double >> pos)
 3D interpolation on a 3D regular grid
More...
 
double Filter (const double r, const double rc)
 filter W(r/rc), used e.g. for filtering the correlation function More...
 
double legendre_polynomial (const double mu, const int l)
 the order l Legendre polynomial More...
 
double legendre_polynomial_integral (double mu, void *params)
 the order l Legendre polynomial integrand More...
 
double Legendre_polynomial_mu_average (const int ll, const double mu, const double delta_mu)
 the average of the Legendre polynomial of the l-th order over the mu range More...
 
double Legendre_polynomial_mu_average (const double mu_min, const double mu_max, const int ll)
 the average of the Legendre polynomial of the l-th order over the \(\mu=\cos(\theta)\) range More...
 
double Legendre_polynomial_theta_average (const double theta_min, const double theta_max, const int ll)
 the average of the Legendre polynomial of the l-th order over the \(\theta\) range More...
 
double Legendre_polynomial_triangles_average (const double r12_min, const double r12_max, const double r13_min, const double r13_max, const double r23_min, const double r23_max, const int ll, const double rel_err=1.e-5, const double abs_err=1.e-8, const int nevals=100)
 the average of the Legendre polynomial of the l-th order over the \(r_{12}, r_{13}, r_{23} \) More...
 
std::vector< std::vector< double > > Legendre_polynomial_triangles_average (const double r12, const double r13, const double deltaR, const int lMax, const double rel_err=1.e-5, const double abs_err=1.e-8, const int nevals=100)
 the average of the Legendre polynomial up to a maximum order lMax of all triangles with sides r12, r13 More...
 
std::complex< double > spherical_harmonics (cbl::CoordinateType coordinate_type, const int l, const int m, const double coord1, const double coord2, const double coord3)
 the order l, degree m spherical harmonics More...
 
std::vector< std::vector< std::complex< double > > > spherical_harmonics (const int lmax, const double xx, const double yy, const double zz)
 the spherical harmonics up to \(l_{max}\) More...
 
std::vector< std::complex< double > > spherical_harmonics_array (const int lmax, const double xx, const double yy, const double zz)
 the spherical harmonics up to \(l_{max}\) More...
 
double j0 (const double xx)
 the l=0 spherical Bessel function More...
 
double j2 (const double xx)
 the l=2 spherical Bessel function More...
 
double j4 (const double xx)
 the l=4 spherical Bessel function More...
 
double jl (const double xx, const int order)
 the order l spherical Bessel function More...
 
double j0_distance_average (const double kk, const double r_down, const double r_up)
 the distance average l=0 spherical Bessel function this function is used to obtain the analytic twop monopole covariance More...
 
double j2_distance_average (const double kk, const double r_down, const double r_up)
 the distance average l=2 spherical Bessel function this function is used to obtain the analytic twop quadrupole covariance More...
 
double jl_spherical_integrand (double rr, void *params)
 the generic integrand to obtain the distance average spherical Bessel function of order l More...
 
double jl_distance_average (const double kk, const int order, const double r_down, const double r_up)
 the distance average for the order l-th spherical Bessel function More...
 
double trapezoid_integration (const std::vector< double > xx, const std::vector< double > yy)
 integral, computed with the trapezoid rule, using ordered data More...
 
double coupling_3j (const int l, const int l_prime, const int l2)
 compute the Wigner 3-j symbol More...
 
void read_vector (const std::string file_vector, std::vector< double > &xx, std::vector< double > &vector, const std::vector< int > col={})
 read a vector from file More...
 
void read_matrix (const std::string file_matrix, std::vector< double > &xx, std::vector< double > &yy, std::vector< std::vector< double >> &matrix, const std::vector< int > col={})
 read a matrix from file More...
 
double determinant_matrix (const std::vector< std::vector< double >> mat)
 compute the determinant of a matrix More...
 
void invert_matrix (const std::vector< std::vector< double >> mat, std::vector< std::vector< double >> &mat_inv, const double prec=1.e-10, const int Nres=-1)
 function to invert a matrix More...
 
void invert_matrix (const std::vector< std::vector< double >> mat, std::vector< std::vector< double >> &mat_inv, const int i1, const int i2, const double prec=1.e-10, const int Nres=-1)
 function to invert a sub-matrix, extracted from a given matrix More...
 
void covariance_matrix (const std::vector< std::vector< double >> mat, std::vector< std::vector< double >> &cov, const bool JK=false)
 compute the covariance matrix from an input dataset More...
 
void covariance_matrix (const std::vector< std::string > file, std::vector< double > &rad, std::vector< double > &mean, std::vector< std::vector< double >> &cov, const bool JK=false)
 compute the covariance matrix, reading the dataset from files More...
 
void covariance_matrix (const std::vector< std::string > file, const std::string covariance_matrix_file, const bool JK=0)
 compute the covariance matrix, reading the dataset from files, and store it in a file More...
 
void read_invert_covariance (const std::string filecov, std::vector< std::vector< double >> &cov, std::vector< std::vector< double >> &cov_inv, const size_t i1, const size_t i2, const double prec=1.e-10, const int Nres=-1)
 read and invert the covariance matrix More...
 
double number_from_distribution (const std::vector< double > xx, const std::vector< double > fx, const double xmin, const double xmax, const int seed)
 return a number sampled from a given distribution More...
 
std::vector< double > vector_from_distribution (const int nRan, const std::vector< double > xx, const std::vector< double > fx, const double xmin, const double xmax, const int seed)
 return a std::vector of numbers sampled from a given distribution More...
 
std::vector< size_t > minimum_maximum_indexes (const std::vector< double > xx, const double x_min, const double x_max)
 return the std::vector indexes corresponding to a given interval More...
 
double get_mu (const double r1, const double r2, const double r3)
 get the cosine of the angle between two sides of a triangle More...
 
double window_function (const double x, const double min=-1, const double max=1)
 the unnormalized window function More...
 
double binomial_coefficient (const int n, const int m)
 get the binomial coefficient More...
 
double clebsh_gordan (const int j1, const int j2, const int m1, const int m2, const int j3, const int m3)
 get the Clebsh-Gordan coefficient in the notation \( \sum_{l}\left\langle l_1 l_2 m_1 m_2 | l_3 m_3 \right\rangle \) More...
 
template<typename T >
double sgn (T val)
 sgn the sign function More...
 
double wigner3j_auxA (double l1, double l2, double l3, double m1, double m2, double m3)
 Wigner \(3-j\) auxiliar function A. More...
 
double wigner3j_auxB (double l1, double l2, double l3, double m1, double m2, double m3)
 Wigner \(3-j\) auxiliar function B. More...
 
std::vector< double > wigner3j (double l2, double l3, double m1, double m2, double m3)
 Wigner \(3-j\) symbol. More...
 
double wigner3j (double l1, double l2, double l3, double m1, double m2, double m3)
 Wigner \(3-j\) symbol. More...
 
double wigner_3j (int j1, int j2, int j3, int m1, int m2, int m3)
 Wigner \(3-j\) symbol, use it for l<100. More...
 
double wigner_6j (const int j1, const int j2, const int j3, const int j4, const int j5, const int j6)
 Wigner \(6-j\) symbol. More...
 
double three_spherical_bessel_integral (const double r1, const double r2, const double r3, const int L1, const int L2, const int L3)
 compute the integral of three spherical bessel function, from Mehrem (2011) More...
 
double average_three_spherical_bessel_integral (const double r1_min, const double r1_max, const double r2_min, const double r2_max, const double r3, const int L1, const int L2, const int L3)
 compute the integral of three spherical bessel function, from Mehrem (2011), averaged on r1-r2 shells More...
 
std::vector< double > generate_correlated_data (const std::vector< double > mean, const std::vector< std::vector< double >> covariance, const int idum=213123)
 generate a covariant sample of n points using a covariance matrix More...
 
std::vector< std::vector< double > > generate_correlated_data (const int nExtractions, const std::vector< double > mean, const std::vector< std::vector< double >> covariance, const int idum=12312)
 generate a covariant sample of n points using a covariance matrix More...
 
template<typename T >
void vectorReadFromBinary (std::ifstream &fin, std::vector< T > &vec, size_t NN)
 reads a vector from a binary file More...
 
Functions for statistical analyses
double Average (const std::vector< double > vect)
 the average of a std::vector More...
 
double Average (const std::vector< double > vect, const std::vector< double > weight)
 the weighted average of a std::vector More...
 
double Sigma (const std::vector< double > vect)
 the standard deviation of a std::vector More...
 
double Sigma (const std::vector< double > vect, const std::vector< double > weight)
 the weighted standard deviation of a std::vector More...
 
std::vector< double > Quartile (const std::vector< double > Vect)
 the first, second and third quartiles of a std::vector More...
 
void Moment (const std::vector< double > data, double &ave, double &adev, double &sdev, double &var, double &skew, double &curt)
 compute the moments of a set of data More...
 
Special functions
template<typename T >
Pol2 (T xx, std::shared_ptr< void > pp, std::vector< double > par)
 the quadratic function More...
 
template<typename T >
Pol3 (T xx, void *pp, std::vector< double > par)
 the cubic function More...
 
std::vector< double > linearfit (const double xx)
 linear function More...
 
std::vector< double > quadratic (const double xx)
 quadratic function More...
 
std::vector< double > cubicfit (const double xx)
 cubic function More...
 
template<typename T >
identity (T xx, std::shared_ptr< void > pp, std::vector< double > par)
 the Identity function More...
 
template<typename T >
rectangular (T xx, std::shared_ptr< void > pp, std::vector< double > par)
 the rectangular distribution More...
 
double closest_probability (double xx, std::shared_ptr< void > pp, std::vector< double > par)
 probability of the closest element to x from a list with weights More...
 
double distribution_probability (double xx, std::shared_ptr< void > pp, std::vector< double > par)
 probability of an interpolated distribution More...
 
double chainMeshInterpolate (std::vector< double > xx, std::shared_ptr< void > pars)
 a multidimension interpolator More...
 
double multivariateGaussian (std::vector< double > xx, std::shared_ptr< void > pars)
 the multivariate Gaussian function More...
 
template<typename T >
gaussian (T xx, std::shared_ptr< void > pp, std::vector< double > par)
 the Gaussian function More...
 
template<typename T >
poisson (T xx, std::shared_ptr< void > pp, std::vector< double > par)
 the poisson distribution More...
 
template<typename T >
maxwellian_distr (const T vel, const T sigma)
 the Maxwellian distribution More...
 
template<typename T >
powerlaw (const T xx, const T x0, const T gamma)
 the power-law function More...
 
template<typename T >
double_powerlaw (const T xx, const T x0, const T alpha, const T beta)
 the double power-law function More...
 
template<typename T >
TopHat_WF (const T kR)
 the top-hat window function More...
 
template<typename T >
TopHat_WF_D1 (const T kR)
 the derivative of the top-hat window function More...
 
template<typename T >
Radius (const T Mass, const T Rho)
 the radius of a sphere of a given mass and density More...
 
template<typename T >
volume_sphere (const T RR)
 the volume of a sphere of a given radius More...
 
template<typename T >
Mass (const T RR, const T Rho)
 the mass of a sphere of a given radius and density More...
 
template<typename T >
radial_velocity (const T vx, const T vy, const T vz, const T ra, const T dec)
 the radial velocity More...
 
template<typename T >
P_2 (const T x)
 the Legendre polynomial P2 More...
 
template<typename T >
P_4 (const T x)
 the Legendre polynomial P4 More...
 
template<typename T >
P_6 (const T x)
 the Legendre polynomial P6 More...
 
Generic operations on functions
void measure_var_function (const std::vector< double > var, const int bin, const double V_min, const double V_max, const double Volume, std::vector< double > &Var, std::vector< double > &Phi, std::vector< double > &err)
 measure the var function (where "var" could be the mass, the luminosity, the radius, etc.) More...
 
void distribution (std::vector< double > &xx, std::vector< double > &fx, std::vector< double > &err, const std::vector< double > FF, const std::vector< double > WW, const int nbin, const bool linear=true, const std::string file_out=par::defaultString, const double fact=1., const double V1=par::defaultDouble, const double V2=par::defaultDouble, const std::string bin_type="Linear", const bool conv=false, const double sigma=0.)
 derive and store the number distribution of a given std::vector More...
 
double MC_Int (double func(const double), const double x1, const double x2, const int seed=3213)
 simple Monte Carlo integration of f(x) More...
 
double MC_Int (double func(const double, const double AA), const double AA, const double x1, double x2, const int seed=3213)
 simple Monte Carlo integration of f(x,A) More...
 
double MC_Int (double func(const double, const double AA, const double BB, const double CC, const double DD, const double EE), const double AA, const double BB, const double CC, const double DD, const double EE, const double x1, const double x2, const int seed=3213)
 simple Monte Carlo integration of f(x,A,B,C,D,E) More...
 
void bin_function (const std::string file_grid, double func(double, void *), void *par, const int bin, const double x_min, const double x_max, const std::string binning, std::vector< double > &xx, std::vector< double > &yy)
 create a 1D grid given an input function More...
 
void bin_function_2D (const std::string file_grid, double func(double *, size_t, void *), void *par, const int bin, const double x1_min, const double x1_max, const double x2_min, const double x2_max, const std::string binning, std::vector< double > &xx1, std::vector< double > &xx2, std::vector< std::vector< double >> &yy)
 create a 2D grid given an input function More...
 
void convolution (const std::vector< double > f1, const std::vector< double > f2, std::vector< double > &res, const double deltaX)
 convolution of two functions More...
 
Functions to calculate distances
double degrees (const double angle, const CoordinateUnits inputUnits=CoordinateUnits::_radians_)
 conversion to degrees More...
 
double radians (const double angle, const CoordinateUnits inputUnits=CoordinateUnits::_degrees_)
 conversion to radians More...
 
double arcseconds (const double angle, const CoordinateUnits inputUnits=CoordinateUnits::_radians_)
 conversion to arcseconds More...
 
double arcminutes (const double angle, const CoordinateUnits inputUnits=CoordinateUnits::_radians_)
 conversion to arcminutes More...
 
double converted_angle (const double angle, const CoordinateUnits inputUnits=CoordinateUnits::_radians_, const CoordinateUnits outputUnits=CoordinateUnits::_degrees_)
 conversion to angle units More...
 
void polar_coord (const double XX, const double YY, const double ZZ, double &ra, double &dec, double &dd)
 conversion from Cartesian coordinates to polar coordinates More...
 
void cartesian_coord (const double ra, const double dec, const double dd, double &XX, double &YY, double &ZZ)
 conversion from polar coordinates to Cartesian coordinates More...
 
void polar_coord (const std::vector< double > XX, const std::vector< double > YY, const std::vector< double > ZZ, std::vector< double > &ra, std::vector< double > &dec, std::vector< double > &dd)
 conversion from Cartesian coordinates to polar coordinates used for a set of objects More...
 
void cartesian_coord (const std::vector< double > ra, const std::vector< double > dec, const std::vector< double > dd, std::vector< double > &XX, std::vector< double > &YY, std::vector< double > &ZZ)
 conversion from polar coordinates to Cartesian coordinates used for a set of objects More...
 
double Euclidean_distance (const double x1, const double x2, const double y1, const double y2, const double z1, const double z2)
 the Euclidean distance in 3D relative to the origin (0,0,0), i.e. the Euclidean norm More...
 
double perpendicular_distance (const double ra1, const double ra2, const double dec1, const double dec2, const double d1, const double d2)
 the perpendicular separation, rp More...
 
double angular_distance (const double x1, const double x2, const double y1, const double y2, const double z1, const double z2)
 the angular separation in 3D More...
 
double haversine_distance (const double ra1, const double ra2, const double dec1, const double dec2)
 the haversine angular separation More...
 
void sdss_atbound (double &angle, const double minval, const double maxval)
 check if ra coordinate is inside the boundaries More...
 
void sdss_atbound2 (double &theta, double &phi)
 set the angular coordinates in the SDSS boundaries More...
 
void eq2sdss (const std::vector< double > ra, const std::vector< double > dec, std::vector< double > &lambda, std::vector< double > &eta)
 convert from equatorial coordinates R.A., Dec to sdss coordinates \( \lambda, \eta \) More...
 
void sdss2eq (const std::vector< double > lambda, const std::vector< double > eta, std::vector< double > &ra, std::vector< double > &dec)
 convert sdss coordinates \( \lambda, \eta \) to R.A., Dec. More...
 
void sdss_stripe (const std::vector< double > eta, const std::vector< double > lambda, std::vector< int > &stripe, std::vector< int > &str_u)
 compute the SDSS stripe given SDSS coordinates \( \lambda, \eta \) More...
 
Functions to model the correlation function
double xi_from_Pk (const double rr, const std::vector< double > lgkk, const std::vector< double > lgPk, const double k_min=0., const double k_max=100., const double aa=0., const double prec=1.e-2)
 the two-point correlation function computed from the Fourier transform of the power spectrum More...
 
double xi_from_Pk (const double rr, const std::string file, const int c1=1, const int c2=2, const double k_min=0., const double k_max=100., const double aa=0., const double prec=1.e-2)
 the two-point correlation function computed from the Fourier transform of the power spectrum read from a file More...
 
double Pk_from_xi (const double kk, const std::vector< double > lgrr, const std::vector< double > lgxi, const double r_min=0.03, const double r_max=100.)
 the power spectrum computed from the Fourier transform of the two-point correlation function More...
 
double Pk_from_xi (const double kk, const std::string file, const int c1=1, const int c2=2, const double r_min=0.03, const double r_max=100.)
 the power spectrum computed from the Fourier transform of the two-point correlation function read from a file More...
 
double wp (const double rp, const std::vector< double > rr, const std::vector< double > xi, const double r_max=100.)
 the projected two-point correlation function More...
 
double wp (const double rp, const std::string file, const double r_max=100.)
 the projected two-point correlation function More...
 
double sigmaR (const double RR, const int corrType, const std::vector< double > rr, const std::vector< double > corr)
 the rms mass fluctuation within a given radius More...
 
double xi_projected_powerlaw (const double rp, const double r0, const double gamma)
 the projected correlation function, wp(rp), computed by modelling the two-point correlation function, ξ(r), as a power-law More...
 
double xi_ratio (const double beta)
 the ratio between the redshift-space and real-space correlation functions More...
 
double xi_ratio (const double f_sigma8, const double bias_sigma8)
 the ratio between the redshift-space and real-space correlation functions More...
 
double error_xi_ratio (const double beta, const double error_beta)
 error on the ratio between the redshift-space and real-space correlation functions More...
 
double barred_xi_direct (const double RR, const std::vector< double > rr, const std::vector< double > xi, const double rAPP=0., const double r0=-1., const double gamma=1.)
 the barred correlation function More...
 
double barred_xi__direct (const double RR, const std::vector< double > rr, const std::vector< double > xi, const double rAPP=0., const double r0=-1., const double gamma=1.)
 the double barred correlation function More...
 
double barred_xi_ (const double RR, const std::vector< double > rr, const std::vector< double > xi, const double rAPP=0., const double r0=-1., const double gamma=1.)
 the barred correlation function More...
 
double barred_xi__ (const double RR, const std::vector< double > rr, const std::vector< double > xi, const double rAPP=0., const double r0=-1., const double gamma=1.)
 the double barred correlation function More...
 
double multipole_xi0 (const int indexR, const std::vector< double > mu, const std::vector< std::vector< double >> xi)
 xi0(s) from ξ(r,μ) More...
 
double multipole_xi2 (const int indexR, const std::vector< double > mu, const std::vector< std::vector< double >> xi)
 xi2(s) from ξ(r,μ) More...
 
double multipole_xi4 (const int indexR, const std::vector< double > mu, const std::vector< std::vector< double >> xi)
 xi4(s) from ξ(r,μ) More...
 
double error_multipole_xi0 (const int indexR, const std::vector< double > mu, const std::vector< std::vector< double >> error)
 error on xi0(s) from ξ(r,μ) More...
 
double error_multipole_xi2 (const int indexR, const std::vector< double > mu, const std::vector< std::vector< double >> error)
 error on xi2(s) from ξ(r,μ) More...
 
double error_multipole_xi4 (const int indexR, const std::vector< double > mu, const std::vector< std::vector< double >> error)
 error on xi4(s) from ξ(r,μ) More...
 
double multipole_xi0 (const double ss, const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double >> xi, const double delta_s)
 xi0(s) from ξ(rp,π) More...
 
double multipole_xi2 (const double ss, const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double >> xi, const double delta_s)
 xi2(s) from ξ(rp,π) More...
 
double multipole_xi4 (const double ss, const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double >> xi, const double delta_s)
 xi4(s) from ξ(rp,π) More...
 
double error_multipole_xi0 (const double ss, const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double >> error, const double delta_s)
 error on xi0(s) from ξ(rp,π) More...
 
double error_multipole_xi2 (const double ss, const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double >> error, const double delta_s)
 error on xi2(s) from ξ(rp,π) More...
 
double error_multipole_xi4 (const double ss, const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double >> error, const double delta_s)
 error on xi4(s) from ξ(rp,π) More...
 
double multipole_xi0_model (const double beta, const double xi_real)
 the model multipole ξ0 of the two-point correlation function More...
 
double multipole_xi0_model (const double f_sigma8, const double bias_sigma8, const double sigma8z, const double xi_matter)
 the model multipole ξ0 of the two-point correlation function More...
 
double multipole_xi2_model (const double beta, const double xi_real, const double xi_)
 the model multipole ξ2 of the two-point correlation function More...
 
double multipole_xi4_model (const double beta, const double xi_real, const double xi_, const double xi__)
 the model multipole ξ4 of the two-point correlation function More...
 
double xi2D_lin_model (const double beta, const double bias, const double xi_real, const double xi_, const double xi__, const double P_2, const double P_4)
 the linear dispersion model for ξ(rp,π) More...
 
double xi2D_lin_model (const double rp, const double pi, const double beta, const double bias, const std::vector< double > rad_real, const std::vector< double > xi_real, const std::vector< double > xi_, const std::vector< double > xi__, const int index=-1, const bool bias_nl=0, const double bA=0.)
 the linear dispersion model for ξ(rp,π) More...
 
double xi2D_model (const double rp, const double pi, const double beta, const double bias, const double sigmav, const std::vector< double > rad_real, const std::vector< double > xi_real, const std::vector< double > xi_, const std::vector< double > xi__, const double var, const int FV, int index=-1, const bool bias_nl=0, const double bA=0., const double v_min=-3000., const double v_max=3000., const int step_v=500)
 the non-linear dispersion model for ξ(rp,π) More...
 
double xi2D_lin_model (const double rp, const double pi, const double beta, const double bias, const std::shared_ptr< void > funcXiR, const std::shared_ptr< void > funcXiR_, const std::shared_ptr< void > funcXiR__, const bool bias_nl=0, const double bA=0.)
 the linear dispersion model for ξ(rp,π) More...
 
double xi2D_model (const double rp, const double pi, const double beta, const double bias, const double sigmav, const std::shared_ptr< void > funcXiR, const std::shared_ptr< void > funcXiR_, const std::shared_ptr< void > funcXiR__, const double var, const int FV, const bool bias_nl=0, const double bA=0., const double v_min=-3000., const double v_max=3000., const int step_v=500)
 the non-linear dispersion model for ξ(rp,π) More...
 
double f_v (const double vel, const double sigmav, const int FV)
 pairwise velocity distribution More...
 
double f_v (const double vel, const double rp, const double pi, const double var, const double sigmav0, const double cmu, const double cs1, const double cs2)
 pairwise velocity distribution More...
 
double f_star (const double xx, const double f_g, const double k_star)
 velocity distribution used to model BAO More...
 
double b_nl (const double rr, const double bA, const double bB=10., const double bC=4.)
 a possible parameterization of the non-linear bias More...
 
double relative_error_beta (const double bias, const double Volume, const double density)
 estimated relative error on \(\beta=f/b\) More...
 
double Pkl_Kaiser_integrand (const double mu, void *parameters)
 integrand of the 2d power spectrum to obtain power spectrum multipole More...
 
double sigma2_integrand (const double mu, void *parameters)
 integrand of the 2d power spectrum to obtain sigma^2(k) More...
 
double covariance_XiMultipoles_integrand (const double kk, void *parameters)
 integrand to obtain the 2PCF multipoles More...
 
double XiMultipoles_integrand (const double kk, void *parameters)
 integrand to obtain covariance for the 2PCF multipoles More...
 
double XiMultipoles_from_Xi2D_integrand (const double mu, void *parameters)
 integrand to obtain the 2PCF multipoles from 2D 2pcf in polar coordinates More...
 
double Pkl_Kaiser_integral (const int order, const double bias, const double f)
 function to obtain the Kaiser factor More...
 
std::vector< double > Pk0_Kaiser (const std::vector< double > kk, const std::vector< double > Pk, const double bias, const double f)
 function to obtain the linear RSD power spectrum monopole More...
 
std::vector< double > Pk2_Kaiser (const std::vector< double > kk, const std::vector< double > Pk, const double bias, const double f)
 function to obtain the linear RSD power spectrum quadrupole More...
 
std::vector< double > Pk4_Kaiser (const std::vector< double > kk, const std::vector< double > Pk, const double bias, const double f)
 function to obtain the linear RSD power spectrum hexadecapole More...
 
std::vector< std::vector< double > > Pkl_Kaiser (const std::vector< int > orders, const std::vector< double > kk, const std::vector< double > Pk, const double bias, const double f)
 function to obtain Pk multipoles from linear RSD (Kaiser) More...
 
std::vector< double > Xi0 (const std::vector< double > r, const std::vector< double > kk, const std::vector< double > Pk0, const double k_cut=0.7, const double cut_pow=2, const int IntegrationMethod=1)
 function to obtain the two point correlation funciton monopole More...
 
std::vector< double > Xi2 (const std::vector< double > rr, const std::vector< double > kk, const std::vector< double > Pk2, const double k_cut=0.58, const double cut_pow=4, const int IntegrationMethod=1)
 function to obtain the two point correlation function quadrupole More...
 
std::vector< double > Xi4 (const std::vector< double > rr, const std::vector< double > kk, const std::vector< double > Pk4, const double k_cut=0.6, const double cut_pow=2, const int IntegrationMethod=1)
 function to obtain the two point correlation function hexadecapole More...
 
std::vector< std::vector< double > > Xi02_AP (const double alpha_perpendicular, const double alpha_parallel, const std::vector< double > rr, const std::vector< double > rl, const std::vector< double > Xi0, const std::vector< double > Xi2)
 function to obtain the monopole and quadrupole of the two point correlation function More...
 
std::vector< std::vector< double > > Xi024_AP (const double alpha_perpendicular, const double alpha_parallel, const std::vector< double > rr, const std::vector< double > rl, const std::vector< double > Xi0, const std::vector< double > Xi2, const std::vector< double > Xi4)
 function to obtain the monopole, quadrupole and hexadecapole of the two-point correlation function More...
 
std::vector< std::vector< double > > XiWedges_AP (const std::vector< double > mu_min, const std::vector< double > delta_mu, const double alpha_perpendicular, const double alpha_parallel, const std::vector< double > rr, const std::vector< double > rl, const std::vector< double > Xi0, const std::vector< double > Xi2, const std::vector< double > Xi4)
 function to obtain the 2pcf wedges More...
 
std::vector< std::vector< double > > sigma2_k (const double nObjects, const double Volume, const std::vector< double > kk, const std::vector< std::vector< double >> Pk_multipoles, const std::vector< int > orders)
 multipole expansion of the per-mode covariance sigma2_k (see Grieb et al. 2016, eq. 15 https://arxiv.org/pdf/1509.04293) More...
 
void Covariance_XiMultipoles (std::vector< double > &rr, std::vector< std::vector< double >> &covariance, const int nbins, const double rMin, const double rMax, const double nObjects, const double Volume, const std::vector< double > kk, const std::vector< std::vector< double >> Pk_multipoles, const std::vector< int > orders, const cbl::BinType bin_type=cbl::BinType::_linear_)
 Covariance matrix for two-point correlation multipoles (see Grieb et al. 2016, Eq. 18 https://arxiv.org/pdf/1509.04293) More...
 
void Covariance_XiWedges (std::vector< double > &rr, std::vector< std::vector< double >> &covariance, const std::vector< double > mu, const std::vector< double > delta_mu, const int nbins, const double rMin, const double rMax, const double nObjects, const double Volume, const std::vector< double > kk, const std::vector< std::vector< double >> Pk_multipoles, const std::vector< int > orders, const cbl::BinType bin_type=cbl::BinType::_linear_)
 Covariance matrix for two-point correlation wedges (see Grieb et al. 2016, Eq. 19 https://arxiv.org/pdf/1509.04293) More...
 
std::vector< std::vector< double > > Xi02_AP (const double alpha_perpendicular, const double alpha_parallel, const std::vector< double > rr, const std::shared_ptr< glob::FuncGrid > xi0_interp, const std::shared_ptr< glob::FuncGrid > xi2_interp)
 function to obtain the monopole and quadrupole of the two point correlation function More...
 
std::vector< std::vector< double > > Xi024_AP (const double alpha_perpendicular, const double alpha_parallel, const std::vector< double > rr, const std::shared_ptr< glob::FuncGrid > xi0_interp, const std::shared_ptr< glob::FuncGrid > xi2_interp, const std::shared_ptr< glob::FuncGrid > xi4_interp)
 function to obtain the monopole, quadrupole and hexadecapole of the two-point correlation function More...
 
std::vector< std::vector< double > > XiWedges_AP (const std::vector< double > mu_min, const std::vector< double > delta_mu, const double alpha_perpendicular, const double alpha_parallel, const std::vector< double > rr, const std::shared_ptr< glob::FuncGrid > xi0_interp, const std::shared_ptr< glob::FuncGrid > xi2_interp, const std::shared_ptr< glob::FuncGrid > xi4_interp)
 function to obtain the 2pcf wedges More...
 
Generic functions that use the class Catalogue
catalogue::Catalogue operator+ (const catalogue::Catalogue &c1, const catalogue::Catalogue &c2)
 overloading of the + operator, to sum two catalogues More...
 
Generic functions that use the class Cosmology
void Vmax_DC_distribution (std::vector< double > &dc, std::vector< double > &nObj, const std::vector< double > D_C, const std::vector< double > zobj_min, const std::vector< double > zobj_max, const double z_min, const double z_max, const double zbin_min, const double zbin_max, cosmology::Cosmology &cosm, const double Area, const int nObjRan, const bool norm=1, const std::string file_Vmax=par::defaultString, const double delta_dc_Vmax=100., const int seed=3213)
 get a smoothed distribution of comoving distances, estimated with the Vmax method More...
 
double AP_shift_r (const double redshift, const cosmology::Cosmology &cosm1, const cosmology::Cosmology &cosm2)
 the Alcock-Pacinski factor used to shift comoving distances More...
 
double AP_shift_rp (const double redshift, const cosmology::Cosmology &cosm1, const cosmology::Cosmology &cosm2)
 the Alcock-Pacinski factor used to shift comoving distances perpendicular to the line-of-sight, rp More...
 
double AP_shift_pi (const double redshift, const cosmology::Cosmology &cosm1, const cosmology::Cosmology &cosm2)
 the Alcock-Pacinski factor used to shift comoving distances parallel to the line-of-sight, π More...
 
void max_separations_AP (const double Rp_max, const double Pi_max, const double redshift, const cosmology::Cosmology &cosm1, const std::vector< cosmology::Cosmology > &cosm2, double &rpM_AP, double &piM_AP, double &rM_AP)
 the maximum comoving separations to be used for the AP test, for a given set of test cosmologies More...
 
double converted_xi (const double RR, const double redshift, const std::vector< double > rr, const std::vector< double > Xi, const cosmology::Cosmology &cosm1, const cosmology::Cosmology &cosm2, const bool direction)
 the 1D two-point correlation function converted from one cosmology to another one More...
 
double converted_xi (const double RP, const double PI, const double redshift, const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double > > Xi, const cosmology::Cosmology &cosm1, const cosmology::Cosmology &cosm2, const bool direction)
 the 2D two-point correlation function converted from one cosmology to another one More...
 
Generic functions that use one or more classes of the CosmoBolognaLib
void redshift_range (const double mean_redshift, const double boxSide, cosmology::Cosmology &real_cosm, double &redshift_min, double &redshift_max)
 compute the redsfhit range of a simulation box centered at z=mean_redshift More...
 
double volume (const double boxSize, const int frac, const double Bord, const double mean_redshift, cosmology::Cosmology &real_cosm)
 get the volume of a simulation box More...
 
void coord_zSpace (std::vector< double > &ra, std::vector< double > &dec, std::vector< double > &redshift, std::vector< double > &xx, std::vector< double > &yy, std::vector< double > &zz, const std::vector< double > vx, const std::vector< double > vy, const std::vector< double > vz, const double sigmaV, cosmology::Cosmology &real_cosm, const double mean_redshift, const double redshift_min, const double redshift_max, const int seed=3213)
 convert a set of coordinates from real-space to redshift-space More...
 
void create_mocks (const std::vector< double > xx, const std::vector< double > yy, const std::vector< double > zz, const std::vector< double > vx, const std::vector< double > vy, const std::vector< double > vz, const std::vector< double > var1, const std::vector< double > var2, const std::vector< double > var3, const std::string output_dir, const double boxSize, const int frac, const double Bord, const double mean_redshift, cosmology::Cosmology &real_cosm, const int REAL, const double sigmaV, const int idum, double &Volume)
 create a mock catalogue, subdividing a box into sub-boxes and recentering More...
 
void set_ObjectRegion_SubBoxes (catalogue::Catalogue &data, const int nx, const int ny, const int nz)
 set the object region in sub-boxes More...
 
void set_ObjectRegion_mangle (catalogue::Catalogue &data, const int nSamples, const std::string polygonfile)
 set the object region in sub-regions using mangle More...
 
void set_ObjectRegion_SubBoxes (catalogue::Catalogue &data, catalogue::Catalogue &random, const int nx, const int ny, const int nz)
 set the object region in sub-boxes More...
 
std::vector< double > colatitude (std::vector< double > latitude)
 convert to colatitude More...
 
void set_ObjectRegion_Tiles_Redshift (catalogue::Catalogue &data, catalogue::Catalogue &random, const int nz)
 set data and random objects' regions given R.A.-Dec tiles and a number of redshift sub-samples. The user must set the identification number of the tiles (cbl::catalogue::Var::_Region_), with cbl::catalogue::Catalogue::set_region(), both in the input data catalogue and in the random catalogue. More...
 
void set_ObjectRegion_RaDec (catalogue::Catalogue &data, const int nCells_Ra, const int nCells_Dec, const bool use_colatitude=true)
 set the object region in angular SubBoxes More...
 
void set_ObjectRegion_RaDec (catalogue::Catalogue &data, catalogue::Catalogue &random, const int nCells_Ra, const int nCells_Dec, const bool use_colatitude=true)
 set the object region in angular SubBoxes More...
 
void set_ObjectRegion_mangle (catalogue::Catalogue &data, catalogue::Catalogue &random, const int nSamples, const std::string polygonfile)
 set the object region in sub-regions using mangle More...
 
void set_ObjectRegion_SDSS_stripes (catalogue::Catalogue &data, catalogue::Catalogue &random)
 set the object region in SDSS stripes More...
 
void check_regions (catalogue::Catalogue &data, catalogue::Catalogue &random)
 check if the subdivision process produced the correct results More...
 
Generic functions for density field reconstruction
void reconstruction_fourier_space (const catalogue::Catalogue data, const catalogue::Catalogue random, const bool random_RSD, const cosmology::Cosmology cosmology, const double redshift, const double bias, const double cell_size, const double smoothing_radius, const int interpolation_type=0)
 compute the non linear displacements of the density field More...
 
catalogue::Catalogue displaced_catalogue (const catalogue::Catalogue input_catalogue)
 return a sample with objects displaced, according to the internal variables m_x_displacement, m_y_displacement, m_z_displacement More...
 
Functions to provide 2PCF/3PCF forecasts
std::vector< double > fit_covariance_matrix_2PCF_monopole (const std::vector< double > mean, const std::vector< std::vector< double >> mock_xi0, const bool doJK, const cbl::cosmology::Cosmology cosmology, const double nObjects, const double Volume, const double bias, const double redshift, const double rMin, const double rMax, const int nbins, const cbl::BinType bin_type, const std::string method_Pk="CAMB", const double sigma_NL=0., const bool NL=true)
 fit the input covariance matrix using the gaussian model, varying the number of objects and the volume of the sample More...
 
std::shared_ptr< cbl::data::Datagenerate_mock_2PCF_monopole (const cbl::cosmology::Cosmology cosmology, const double bias, const double nObjects, const double Volume, const double redshift, const double rMin, const double rMax, const int nbins, const cbl::BinType bin_type, const std::string method_Pk="CAMB", const double sigma_NL=0., const bool NL=true)
 generate mock measurementes of the 2PCF monopole from gaussian covariance matrix More...
 
std::shared_ptr< cbl::data::Datagenerate_mock_2PCF_multipoles (const cbl::cosmology::Cosmology cosmology, const double bias, const double nObjects, const double Volume, const double redshift, const double rMin, const double rMax, const int nbins, const cbl::BinType bin_type, const std::string method_Pk="CAMB", const double sigma_NL=0., const bool NL=true)
 generate mock measurementes of the 2PCF multipoles from gaussian covariance matrix More...
 
Functions of generic use <br>
std::ostream & headerCBL (std::ostream &stream)
 provide the header for all internal messages More...
 
void WarningMsgCBL (const std::string msg, const std::string functionCBL, const std::string fileCBL)
 internal CBL warning message More...
 
int Error (const std::string msg, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_, const std::string header="\n")
 throw an exception More...
 
int ErrorCBL (const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
 throw an exception: it is used for handling exceptions inside the CosmoBolognaLib More...
 
void Beep (const std::string beep="beep")
 produce a beep More...
 
bool isSet (const std::string var)
 check if the value of a [string] variable has already been set More...
 
bool isSet (const int var)
 check if the value of a [int] variable has already been set More...
 
bool isSet (const long var)
 check if the value of a [long] variable has already been set More...
 
bool isSet (const double var)
 check if the value of a [double] variable has already been set More...
 
bool isSet (const std::vector< double > vect)
 check if the values of a [double] std::vector have already been set More...
 
bool isSet (const std::vector< unsigned int > vect)
 check if the values of a [unsigned int] std::vector have already been set More...
 
bool isSet (const std::vector< std::vector< unsigned int >> vect)
 check if the values of a [unsigned int] std::vector<std::vector> have already been set More...
 
template<typename T >
std::string conv (const T val, const char *fact)
 convert a number to a std::string More...
 
template<typename T >
int nint (const T val)
 the nearest integer More...
 
template<typename T >
Log (const T val, const double fact=0.9)
 common logarithm (i.e. logarithm to base 10) More...
 
template<typename T >
Ln (const T val, const double fact=0.9)
 natural logarithm More...
 
template<typename T >
closest (T x, T a, T b)
 given a number x, return the closest of two values a, b More...
 
template<typename T >
index_closest (T x, std::vector< T > vv)
 given a number x, return the index of the closest element to x in vv More...
 
template<typename T >
closest (T x, std::vector< T > values)
 given a number x, return the closest value in a std::vector More...
 
short ShortSwap (const short s)
 endian conversion of a short variable More...
 
int IntSwap (const int i)
 endian conversion of an integer variable More...
 
long long LongSwap (const long long i)
 endian conversion of a long integer variable More...
 
float FloatSwap (const float f)
 endian conversion of a float variable More...
 
double DoubleSwap (const double d)
 endian conversion of a double variable More...
 
double round_to_digits (const double num, const int ndigits)
 reduce the digit figures of an input double More...
 
double round_to_precision (const double num, const int ndigits)
 reduce the precision of an input double More...
 
void checkIO (const std::ifstream &fin, const std::string file="NULL")
 check if an input file can be opened More...
 
void checkIO (const std::ofstream &fout, const std::string file="NULL")
 check if an output file can be opened More...
 
void set_EnvVar (const std::vector< std::string > Var)
 set evironment variables More...
 
void check_EnvVar (const std::string Var)
 check if an environment variable exists More...
 
int used_memory (const int type)
 get the memory used by current process in kB More...
 
int check_memory (const double frac, const bool exit=true, const std::string func="", const int type=1)
 check if the memory used by current process is larger than a given fraction of the available memory More...
 
Functions to manipulate std::vectors and matrices
template<typename T >
void Print (const T value, const int prec, const int ww, const std::string header="", const std::string end="\n", const bool use_coutCBL=true, std::ostream &stream=std::cout, const std::string colour=cbl::par::col_default)
 function to print values with a proper homegenised format More...
 
template<typename T >
void Print (const std::vector< T > vect, const int prec=4, const int ww=8)
 print the elements of a std::vector of non string values on the screen More...
 
void Print (const std::vector< std::string > vect)
 print the elements of a std::vector of string values on the screen More...
 
template<typename T >
void Print (const std::vector< T > vect1, const std::vector< T > vect2, const int prec=4, const int ww=8)
 print the elements of a two std::vectors of non string values on the screen More...
 
void Print (const std::vector< std::string > vect1, const std::vector< std::string > vect2)
 print the elements of two std::vectors of string values on the screen More...
 
template<typename T >
void Print (const std::vector< T > vect1, const std::vector< T > vect2, const std::vector< T > vect3, const int prec=4, const int ww=8)
 print the elements of a three std::vectors of non string values on the screen More...
 
void Print (const std::vector< std::string > vect1, const std::vector< std::string > vect2, const std::vector< std::string > vect3)
 print the elements of two std::vectors of string values on the screen More...
 
template<typename T >
void Print (const std::vector< std::vector< T >> mat, const int prec=4, const int ww=8)
 print the elements of a matrix of non string values on the screen More...
 
void Print (const std::vector< std::vector< std::string >> mat)
 print the elements of a matrix of string values on the screen More...
 
template<typename T >
Min (const std::vector< T > vect)
 minimum element of a std::vector More...
 
template<typename T >
Max (const std::vector< T > vect)
 maximum element of a std::vector More...
 
template<typename T >
std::vector< T > different_elements (const std::vector< T > vect_input)
 get the unique elements of a std::vector More...
 
template<typename T >
int N_different_elements (const std::vector< T > vect_input)
 get the number of unique elements of a std::vector More...
 
void unique_unsorted (std::vector< int > &vv)
 erase all the equal elements of the input std::vector More...
 
void unique_unsorted (std::vector< double > &vv)
 erase all the equal elements of the input std::vector More...
 
void unique_unsorted (std::vector< std::string > &vv)
 erase all the equal elements of the input std::vector More...
 
template<typename T >
void Erase (std::vector< T > &vv, std::vector< int > ind)
 erase some elements of a std::vector More...
 
template<typename T >
void Erase_lines (std::vector< std::vector< T > > &Mat, std::vector< int > ll)
 erase some lines of a matrix More...
 
template<typename T >
void Erase_columns (std::vector< std::vector< T > > &Mat, std::vector< int > col)
 erase some columns of a matrix More...
 
template<typename T >
void SubMatrix (std::vector< T > &xx, std::vector< T > &yy, std::vector< std::vector< T > > &Mat, T val)
 select a submatrix containing lines and columns with all elements major than val More...
 
template<typename T >
bool isDimEqual (const std::vector< T > vect1, const std::vector< T > vect2)
 check if the dimensions of two std::vectors are equal More...
 
template<typename T >
bool isDimEqual (const std::vector< std::vector< T > > mat1, const std::vector< std::vector< T > > mat2)
 check if the dimensions of two matrices are equal More...
 
template<typename T >
void checkDim (const std::vector< T > vect, const int val, const std::string vector, bool equal=true)
 check if the dimension of a std::vector is equal/lower than an input value More...
 
template<typename T >
void checkDim (const std::vector< T > mat, const int val_i, const int val_j, const std::string matrix, const bool equal=true)
 check if the dimensions of a matrix are higher than two input values More...
 
template<typename T >
void checkEqual (const std::vector< T > vect1, const std::vector< T > vect2)
 check if two std::vectors are equal More...
 
template<typename T >
std::vector< T > linear_bin_vector (const size_t nn, const T min, const T max)
 fill a std::vector with linearly spaced values More...
 
template<typename T >
std::vector< T > logarithmic_bin_vector (const size_t nn, const T min, const T max)
 fill a std::vector with logarithmically spaced values More...
 
template<typename T >
int locate (const std::vector< T > &vv, const T xx)
 locate a value in a given std::vector More...
 
template<typename T >
std::vector< T > extract_elements (std::vector< T > vec, std::vector< unsigned int > index)
 extract elements from a given vector More...
 
template<typename T >
std::vector< T > flatten (std::vector< std::vector< T >> matrix)
 flatten a \(\left( n\times m \right)\) matrix in a vector of size \(x\times m\) More...
 
template<typename T >
std::vector< std::vector< T > > reshape (std::vector< T > vec, const int size1, const int size2)
 reshape a vector into a matrix of given number of rows and columns More...
 
template<typename T >
std::vector< std::vector< T > > transpose (std::vector< std::vector< T >> matrix)
 transpose a matrix More...
 
template<typename T >
bool inRange (T value, T min, T max, bool include_limits=true)
 return false \( \rightarrow \) value outside the range; true \( \rightarrow \) value inside the range More...
 
template<typename T >
bool inRange (std::vector< T > value, std::vector< T > min, std::vector< T > max, bool include_limits=true)
 return false \( \rightarrow \) if values are outside the range; true \( \rightarrow \) if values are inside the range More...
 
template<typename T >
bool inRange (std::vector< T > value, std::vector< std::vector< T >> ranges, bool include_limits=true)
 return false \( \rightarrow \) values outside the range; true \( \rightarrow \) values inside the range More...
 
template<typename T >
v_M_vt (const std::vector< T > vv, const std::vector< std::vector< T >> MM)
 return the value of More...
 
void sort_2vectors (std::vector< double >::iterator p1, std::vector< double >::iterator p2, const int dim)
 sort the elements of a std::vectors, and the elements of a second std::vector according to the first sorting More...
 
void sort_3vectors (std::vector< double >::iterator p1, std::vector< double >::iterator p2, std::vector< double >::iterator p3, const int dim)
 sort the elements of a std::vectors, and the elements of two other std::vectors according to the first sorting More...
 
void sort_4vectors (std::vector< double >::iterator p1, std::vector< double >::iterator p2, std::vector< double >::iterator p3, std::vector< double >::iterator p4, const int dim)
 sort the elements of a std::vectors, and the elements of three other std::vectors according to the first sorting More...
 
int makeDir (std::string path, const std::string rootPath=".", const mode_t mode=0777, const bool verbose=false)
 function to create multiple directories More...
 
std::vector< std::vector< double > > operator* (const std::vector< std::vector< double > > &Mat1, const std::vector< std::vector< double > > &Mat2)
 matrix multiplication More...
 
template<typename T >
std::vector< T > slice (const std::vector< T > v, const int start=0, const int end=-1)
 slice a std::vector from start to stop More...
 
std::vector< std::vector< double > > read_file (const std::string file_name, const std::string path_name, const std::vector< int > column_data, const int skip_nlines=0)
 read a data from a file ASCII More...
 
std::vector< std::vector< double > > read_file (const std::string file_name, const std::string path_name, const std::vector< int > column_data, const std::string delimiter, const char comment='#')
 read a data from a file ASCII. Useful e.g. when the data are written between comment lines. More...
 

Detailed Description

The global namespace of the CosmoBolognaLib

The cbl namespace contains all the main functions and classes of the CosmoBolognaLib

Typedef Documentation

◆ distribution_func

typedef std::function<double(double, std::shared_ptr<void>, std::vector<double>)> cbl::distribution_func

generic distribution function

Returns
distribution function

Definition at line 50 of file RandomNumbers.h.

◆ nDim_distribution_func

typedef std::function<double(std::vector<double>, std::shared_ptr<void>)> cbl::nDim_distribution_func

distribution function used for a n-dimensional distribution

Returns
distribution function

Definition at line 57 of file RandomNumbers.h.

Enumeration Type Documentation

◆ BinType

enum cbl::BinType
strong

the binning type

Enumerator
_linear_ 

linear binning

_logarithmic_ 

logarithmic binning

_custom_ 

custom binning

Definition at line 505 of file Kernel.h.

◆ CoordinateType

enum cbl::CoordinateType
strong

the coordinate type

Enumerator
_comoving_ 

comoving coordinates (x, y, z)

_observed_ 

observed coordinates (R.A., Dec, redshift)

Definition at line 624 of file Kernel.h.

◆ CoordinateUnits

enum cbl::CoordinateUnits
strong

the coordinate units

Enumerator
_radians_ 

angle in radians

_degrees_ 

angle in degrees

_arcseconds_ 

angle in arcseconds

_arcminutes_ 

angle in arcminutes

Definition at line 562 of file Kernel.h.

◆ Dim

enum cbl::Dim
strong

the dimension, used e.g. for pair and triplet vectors

Enumerator
_1D_ 

1D, used e.g. for 1D pairs, in angular or comoving separations

_2D_ 

2D pair, used e.g. for 2D pairs, in Cartesian or polar coordinates

Definition at line 483 of file Kernel.h.

Function Documentation

◆ angular_distance()

double cbl::angular_distance ( const double  x1,
const double  x2,
const double  y1,
const double  y2,
const double  z1,
const double  z2 
)

the angular separation in 3D

Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t
Parameters
x1x coordinate of the first object
x2x coordinate of the second object
y1y coordinate of the first object
y2y coordinate of the second object
z1z coordinate of the first object
z2z coordinate of the second object
Returns
the angular separation [radians]

Definition at line 277 of file Func.cpp.

◆ AP_shift_pi()

double cbl::AP_shift_pi ( const double  redshift,
const cosmology::Cosmology cosm1,
const cosmology::Cosmology cosm2 
)

the Alcock-Pacinski factor used to shift comoving distances parallel to the line-of-sight, π

this function is used to model geometric distortions

Parameters
redshiftthe redshift
cosm1object of class Cosmology
cosm2object of class Cosmology
Returns
H[cosm2]/H[cosm1], where H is Cosmology::HH

Definition at line 89 of file FuncCosmology.cpp.

◆ AP_shift_r()

double cbl::AP_shift_r ( const double  redshift,
const cosmology::Cosmology cosm1,
const cosmology::Cosmology cosm2 
)

the Alcock-Pacinski factor used to shift comoving distances

this function is used to model geometric distortions

Parameters
redshiftthe redshift
cosm1object of class Cosmology
cosm2object of class Cosmology
Returns
DV[cosm2]/DV[cosm1], where DV is Cosmology::D_V

Definition at line 79 of file FuncCosmology.cpp.

◆ AP_shift_rp()

double cbl::AP_shift_rp ( const double  redshift,
const cosmology::Cosmology cosm1,
const cosmology::Cosmology cosm2 
)

the Alcock-Pacinski factor used to shift comoving distances perpendicular to the line-of-sight, rp

this function is used to model geometric distortions

Parameters
redshiftthe redshift
cosm1object of class Cosmology
cosm2object of class Cosmology
Returns
DA[cosm1]/DA[cosm2], where DA is Cosmology::D_A

Definition at line 84 of file FuncCosmology.cpp.

◆ arcminutes()

double cbl::arcminutes ( const double  angle,
const CoordinateUnits  inputUnits = CoordinateUnits::_radians_ 
)

conversion to arcminutes

Parameters
anglethe input angle
inputUnitsthe units of the input angle
Returns
the angle in arcminutes

Definition at line 170 of file Func.cpp.

◆ arcseconds()

double cbl::arcseconds ( const double  angle,
const CoordinateUnits  inputUnits = CoordinateUnits::_radians_ 
)

conversion to arcseconds

Parameters
anglethe input angle
inputUnitsthe units of the input angle
Returns
the angle in arcseconds

Definition at line 148 of file Func.cpp.

◆ Average() [1/2]

double cbl::Average ( const std::vector< double >  vect)

the average of a std::vector

for the derivation of the formulae used here for numerically stable calculation see Chan et al. 1979, Finch 2009 and reference therein

Parameters
vectthe input std::vector
Returns
the average of vect
Examples
correlated_samples.cpp.

Definition at line 870 of file Func.cpp.

◆ Average() [2/2]

double cbl::Average ( const std::vector< double >  vect,
const std::vector< double >  weight 
)

the weighted average of a std::vector

for the derivation of the formulae used here for numerically stable calculation see Chan et al. 1979, Finch 2009 and reference therein

Parameters
vectthe input std::vector
weightthe weight
Returns
the weighted average of vect

Definition at line 897 of file Func.cpp.

◆ average_three_spherical_bessel_integral()

double cbl::average_three_spherical_bessel_integral ( const double  r1_min,
const double  r1_max,
const double  r2_min,
const double  r2_max,
const double  r3,
const int  L1,
const int  L2,
const int  L3 
)

compute the integral of three spherical bessel function, from Mehrem (2011), averaged on r1-r2 shells

Parameters
r1_min
r1_max
r2_min
r2_max
r3
L1the order of the first spherical bessel function
L2the order of the second spherical bessel function
L3the order of the third spherical bessel function
Returns
the integral of three spherical bessel function, averaged

Definition at line 2585 of file Func.cpp.

◆ b_nl()

double cbl::b_nl ( const double  rr,
const double  bA,
const double  bB = 10.,
const double  bC = 4. 
)

a possible parameterization of the non-linear bias

the non-linear bias (see Chuang&Wang 2012 (1209.0210), eqs. 20-21): \( b(r) = r^{\frac{b_A}{1+(\frac{r}{b_B})^{b_C}}} \)

Parameters
rrthe comoving scale
bAbA
bBbB
bCbC
Returns
b(r)

Definition at line 653 of file FuncXi.cpp.

◆ barred_xi_()

double cbl::barred_xi_ ( const double  RR,
const std::vector< double >  rr,
const std::vector< double >  xi,
const double  rAPP = 0.,
const double  r0 = -1.,
const double  gamma = 1. 
)

the barred correlation function

(see e.g. Hamilton 1992)

\[ \overline{\xi}(r) = \frac{3}{r^3}\int^r_0dr'\xi(r')r'{^2} \]

Parameters
RRthe comoving separation, r, where the barred correlation function is computed
rrstd::vector containing the input comoving separations
xistd::vector containing the input two-point correlation function
rAPPcomoving scale below which a power-law model for the two-point correlation function is assumed in the integral
r0the power-law normalization, r0
gammathe power-law slope, γ
Returns
\( \overline{\xi}(r) \)

Definition at line 392 of file FuncXi.cpp.

◆ barred_xi__()

double cbl::barred_xi__ ( const double  RR,
const std::vector< double >  rr,
const std::vector< double >  xi,
const double  rAPP = 0.,
const double  r0 = -1.,
const double  gamma = 1. 
)

the double barred correlation function

(see e.g. Hamilton 1992)

\[ \overline{\overline{\xi}}(r) = \frac{5}{r^5}\int^r_0dr'\xi(r')r'{^4} \]

Parameters
RRthe comoving separation, r, where the barred correlation function is computed
rrstd::vector containing the input comoving separations
xistd::vector containing the input two-point correlation function
rAPPcomoving scale below which a power-law model for the two-point correlation function is assumed in the integral
r0the power-law normalization, r0
gammathe power-law slope, γ
Returns
\( \overline{\overline{\xi}}(r) \)

Definition at line 412 of file FuncXi.cpp.

◆ barred_xi__direct()

double cbl::barred_xi__direct ( const double  RR,
const std::vector< double >  rr,
const std::vector< double >  xi,
const double  rAPP = 0.,
const double  r0 = -1.,
const double  gamma = 1. 
)

the double barred correlation function

computed with a simple rectangular integration

(see e.g. Hamilton 1992)

\[ \overline{\overline{\xi}}(r) = \frac{5}{r^5}\int^r_0dr'\xi(r')r'{^4} \]

Parameters
RRthe comoving separation, r, where the barred correlation function is computed
rrstd::vector containing the input comoving separations
xistd::vector containing the input two-point correlation function
rAPPcomoving scale below which a power-law model for the two-point correlation function is assumed in the integral
r0the power-law normalization, r0
gammathe power-law slope, γ
Returns
\( \overline{\overline{\xi}}(r) \)

Definition at line 361 of file FuncXi.cpp.

◆ barred_xi_direct()

double cbl::barred_xi_direct ( const double  RR,
const std::vector< double >  rr,
const std::vector< double >  xi,
const double  rAPP = 0.,
const double  r0 = -1.,
const double  gamma = 1. 
)

the barred correlation function

computed with a simple rectangular integration

(see e.g. Hamilton 1992)

\[ \overline{\xi}(r) = \frac{3}{r^3}\int^r_0dr'\xi(r')r'{^2} \]

Parameters
RRthe comoving separation, r, where the barred correlation function is computed
rrstd::vector containing the input comoving separations
xistd::vector containing the input two-point correlation function
rAPPcomoving scale below which a power-law model for the two-point correlation function is assumed in the integral
r0the power-law normalization, r0
gammathe power-law slope, γ
Returns
\( \overline{\xi}(r) \)

Definition at line 331 of file FuncXi.cpp.

◆ Beep()

void cbl::Beep ( const std::string  beep = "beep")
inline

produce a beep

function to produce a nice, useful beep

Parameters
beepproduced sound, to be specified to customize the beep
Examples
fsigma8.cpp.

Definition at line 791 of file Kernel.h.

◆ bin_function()

void cbl::bin_function ( const std::string  file_grid,
double   funcdouble, void *,
void *  par,
const int  bin,
const double  x_min,
const double  x_max,
const std::string  binning,
std::vector< double > &  xx,
std::vector< double > &  yy 
)

create a 1D grid given an input function

Parameters
file_gridthe file with the input function
[in]functhe input function
[in]parthe function parameters
[in]binthe number of bins in the grid
[in]x_minthe minimum limit of the grid
[in]x_maxthe maximum limit of the grid
[in]binningthe binning type: it can be "lin", "loglin" or "log"
[in,out]xxstd::vector containing the grid points
[in,out]yystd::vector containing the values of the function at the grid points

Definition at line 1118 of file Func.cpp.

◆ bin_function_2D()

void cbl::bin_function_2D ( const std::string  file_grid,
double   funcdouble *, size_t, void *,
void *  par,
const int  bin,
const double  x1_min,
const double  x1_max,
const double  x2_min,
const double  x2_max,
const std::string  binning,
std::vector< double > &  xx1,
std::vector< double > &  xx2,
std::vector< std::vector< double >> &  yy 
)

create a 2D grid given an input function

Parameters
[in]file_gridthe file with the input function
[in]functhe input function
[in]parthe function parameters
[in]binthe number of bins in the grid
[in]x1_minthe minimum limit of the grid in one direction
[in]x1_maxthe maximum limit of the grid in one direction
[in]x2_minthe minimum limit of the grid in one direction
[in]x2_maxthe maximum limit of the grid in one direction
[in]binningthe binning type: it can be "lin", "loglin" or "log"
[in,out]xx1std::vector containing the grid points in one direction
[in,out]xx2std::vector containing the grid points in one direction
[in,out]yystd::vector containing the values of the function at the grid points

Definition at line 1183 of file Func.cpp.

◆ binomial_coefficient()

double cbl::binomial_coefficient ( const int  n,
const int  m 
)

get the binomial coefficient

Parameters
nfirst integer
msecond integer
Returns
the binomial coefficient

Definition at line 2217 of file Func.cpp.

◆ BinTypeCast() [1/4]

BinType cbl::BinTypeCast ( const int  binTypeIndex)
inline

cast an enum of type BinType from its index

Parameters
binTypeIndexthe binType index
Returns
object of class BinType

Definition at line 532 of file Kernel.h.

◆ BinTypeCast() [2/4]

BinType cbl::BinTypeCast ( const std::string  binTypeName)
inline

cast an enum of type BinType from its name

Parameters
binTypeNamethe binType name
Returns
object of class BinType

Definition at line 540 of file Kernel.h.

◆ BinTypeCast() [3/4]

std::vector<BinType> cbl::BinTypeCast ( const std::vector< int >  binTypeIndeces)
inline

cast an enum of type BinType from indeces

Parameters
binTypeIndecesthe binType indeces
Returns
object of class BinType

Definition at line 548 of file Kernel.h.

◆ BinTypeCast() [4/4]

std::vector<BinType> cbl::BinTypeCast ( const std::vector< std::string >  binTypeNames)
inline

cast an enum of type BinType from thier names

Parameters
binTypeNamesthe binType names
Returns
objects of class BinType

Definition at line 556 of file Kernel.h.

◆ BinTypeNames()

std::vector<std::string> cbl::BinTypeNames ( )
inline

return a vector containing the BinType names

Returns
a vector containing the BinType names

Definition at line 524 of file Kernel.h.

◆ cartesian_coord() [1/2]

void cbl::cartesian_coord ( const double  ra,
const double  dec,
const double  dd,
double &  XX,
double &  YY,
double &  ZZ 
)

conversion from polar coordinates to Cartesian coordinates

Parameters
[in]rathe Right Ascension [radians]
[in]decthe Declination [radians]
[in]ddthe comoving distance
[out]XXthe Cartesian coordinate x
[out]YYthe Cartesian coordinate y
[out]ZZthe Cartesian coordinate z

Definition at line 221 of file Func.cpp.

◆ cartesian_coord() [2/2]

void cbl::cartesian_coord ( const std::vector< double >  ra,
const std::vector< double >  dec,
const std::vector< double >  dd,
std::vector< double > &  XX,
std::vector< double > &  YY,
std::vector< double > &  ZZ 
)

conversion from polar coordinates to Cartesian coordinates used for a set of objects

Parameters
[in]rastd::vector containing the Right Ascension values [radians]
[in]decstd::vector containing the Declination values [radians]
[in]ddstd::vector containing the comoving distances
[out]XXstd::vector containing the Cartesian coordinates x
[out]YYstd::vector containing the Cartesian coordinates y
[out]ZZstd::vector containing the Cartesian coordinates z

Definition at line 237 of file Func.cpp.

◆ castFromName()

template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
T cbl::castFromName ( const std::string  name,
const std::vector< std::string >  list 
)

cast an object of type enum class from its name

Parameters
namethe enum name
liststd::vector containing the names of the enum
Returns
object of class T

Definition at line 59 of file EnumCast.h.

◆ castFromNames()

template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
std::vector<T> cbl::castFromNames ( const std::vector< std::string >  names,
const std::vector< std::string >  list 
)

cast an object of type enum class from names

Parameters
namesthe enum names
liststd::vector containing the names of the enum
Returns
object of class T

Definition at line 97 of file EnumCast.h.

◆ castFromValue()

template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
T cbl::castFromValue ( const int  i)

cast an object of type enum class from its index

Parameters
ithe enum index
Returns
object of class T

Definition at line 47 of file EnumCast.h.

◆ castFromValues()

template<typename T , typename std::enable_if< std::is_enum< T >::value >::type * = nullptr>
std::vector<T> cbl::castFromValues ( const std::vector< int >  ii)

cast objects of type enum class from indeces

Parameters
iithe enum indeces
Returns
object of class T

Definition at line 79 of file EnumCast.h.

◆ chainMeshInterpolate()

double cbl::chainMeshInterpolate ( std::vector< double >  xx,
std::shared_ptr< void >  pars 
)

a multidimension interpolator

Parameters
xxthe coordinates of the points to interpolate
parsvector containing an object ChainMesh and the maximum number of points used to interpolate
Returns
the interpolated value

Definition at line 68 of file Func.cpp.

◆ check_EnvVar()

void cbl::check_EnvVar ( const std::string  Var)

check if an environment variable exists

Parameters
Varthe evironment variable to be checked

Definition at line 196 of file Kernel.cpp.

◆ check_memory()

int cbl::check_memory ( const double  frac,
const bool  exit = true,
const std::string  func = "",
const int  type = 1 
)

check if the memory used by current process is larger than a given fraction of the available memory

Warning
this function works only on Linux systems
Parameters
fracthe fraction of the available memory that is allowed
funca std::string that should contain the name of the function from which check_memory is called; it is used when printing the error message
exit0 \(\rightarrow\) warning message; 1 \(\rightarrow\) error message; (and exit)
type1 \(\rightarrow\) Physical Memory (RAM); 2 \(\rightarrow\) Virtual Memory
Returns
0 \(\rightarrow\) memory problems; 1 \(\rightarrow\) no memory problems

Definition at line 252 of file Kernel.cpp.

◆ check_regions()

void cbl::check_regions ( catalogue::Catalogue data,
catalogue::Catalogue random 
)

check if the subdivision process produced the correct results

Parameters
datainput data catalogue
randomrandom catalogue

Definition at line 601 of file SubSample.cpp.

◆ checkDim() [1/2]

template<typename T >
void cbl::checkDim ( const std::vector< T >  mat,
const int  val_i,
const int  val_j,
const std::string  matrix,
const bool  equal = true 
)

check if the dimensions of a matrix are higher than two input values

Parameters
mata matrix
val_ian input value
val_jan input value
matrixthe name of the matrix (using only to write the error message)
equaltrue \(\rightarrow\) check if the dimension is equal to val; false \(\rightarrow\) check if the dimension is lower than val

Definition at line 1556 of file Kernel.h.

◆ checkDim() [2/2]

template<typename T >
void cbl::checkDim ( const std::vector< T >  vect,
const int  val,
const std::string  vector,
bool  equal = true 
)

check if the dimension of a std::vector is equal/lower than an input value

Parameters
vecta std::vector
valthe input value
vectorthe name of the std::vector (used only to write the error message)
equaltrue \(\rightarrow\) check if the dimension is equal to val; false \(\rightarrow\) check if the dimension is lower than val

Definition at line 1532 of file Kernel.h.

◆ checkEqual()

template<typename T >
void cbl::checkEqual ( const std::vector< T >  vect1,
const std::vector< T >  vect2 
)

check if two std::vectors are equal

this function returns either an error if the given std::vectors are different, or nothing if they are equal

Parameters
vect1a std::vector
vect2a std::vector

Definition at line 1587 of file Kernel.h.

◆ checkIO() [1/2]

void cbl::checkIO ( const std::ifstream &  fin,
const std::string  file = "NULL" 
)

check if an input file can be opened

Parameters
finstd::ifstream object
filethe file name
Examples
catalogue.cpp, data1D.cpp, and model_3pt.cpp.

Definition at line 160 of file Kernel.cpp.

◆ checkIO() [2/2]

void cbl::checkIO ( const std::ofstream &  fout,
const std::string  file = "NULL" 
)

check if an output file can be opened

Parameters
foutstd::ofstream object
filethe file name

Definition at line 173 of file Kernel.cpp.

◆ clebsh_gordan()

double cbl::clebsh_gordan ( const int  j1,
const int  j2,
const int  m1,
const int  m2,
const int  j3,
const int  m3 
)

get the Clebsh-Gordan coefficient in the notation \( \sum_{l}\left\langle l_1 l_2 m_1 m_2 | l_3 m_3 \right\rangle \)

Parameters
j1index
j2index
j3index
m1index
m2index
m3index
Returns
the Clebsh-Gordan coefficient

Definition at line 2511 of file Func.cpp.

◆ closest() [1/2]

template<typename T >
T cbl::closest ( x,
std::vector< T >  values 
)

given a number x, return the closest value in a std::vector

Parameters
xthe starting value
valuesstd::vector of values
Returns
the closest value in the std::vector

Definition at line 984 of file Kernel.h.

◆ closest() [2/2]

template<typename T >
T cbl::closest ( x,
a,
b 
)

given a number x, return the closest of two values a, b

Parameters
xthe starting value
athe first number to test
bthe second number to test
Returns
a if x is closer to a, b if x is closer to b

Definition at line 948 of file Kernel.h.

◆ closest_probability()

double cbl::closest_probability ( double  xx,
std::shared_ptr< void >  pp,
std::vector< double >  par 
)

probability of the closest element to x from a list with weights

Parameters
xxthe variable x
ppa void pointer
para std::vector containing the coefficients:
Returns
the weight of closest element from a discrete list to x
Warning
par is not used, it is necessary only for GSL operations

Definition at line 47 of file Func.cpp.

◆ colatitude()

vector< double > cbl::colatitude ( std::vector< double >  latitude)

convert to colatitude

\[ \theta = 90 - \delta \]

Parameters
latitudevector containing the latitudes
Returns
vector containing the colatitude

Definition at line 484 of file SubSample.cpp.

◆ conv()

template<typename T >
std::string cbl::conv ( const T  val,
const char *  fact 
)

convert a number to a std::string

Parameters
valnumber of any type
factoutput format
Returns
a std::string containing T
Examples
Pk_BoltzmannSolver.cpp, and fsigma8.cpp.

Definition at line 903 of file Kernel.h.

◆ converted_angle()

double cbl::converted_angle ( const double  angle,
const CoordinateUnits  inputUnits = CoordinateUnits::_radians_,
const CoordinateUnits  outputUnits = CoordinateUnits::_degrees_ 
)

conversion to angle units

Parameters
anglethe input angle
inputUnitsthe units of the input angle
outputUnitsthe units of the output angle
Returns
the angle in the converted units

Definition at line 192 of file Func.cpp.

◆ converted_xi() [1/2]

double cbl::converted_xi ( const double  RP,
const double  PI,
const double  redshift,
const std::vector< double >  rp,
const std::vector< double >  pi,
const std::vector< std::vector< double > >  Xi,
const cosmology::Cosmology cosm1,
const cosmology::Cosmology cosm2,
const bool  direction 
)

the 2D two-point correlation function converted from one cosmology to another one

Parameters
RPthe comoving separation perpendicular to the line-of-sight, Rp
PIthe comoving separation parallel to the line-of-sight, Π
redshiftthe redshift
rpvector containing the comoving separations perpendicular to the line-of-sight, rp
pivector containing the comoving separations parallel to the line-of-sight, π
Ximatrix containing the two-point correlation function, ξ(rp,π)
cosm1object of class Cosmology
cosm2object of class Cosmology
direction0 → cosm2 \( \rightarrow \) cosm1; 1 → cosm1 \( \rightarrow \) cosm2;
Returns
the converted two-point correlation function, ξ(Rp,Π)

Definition at line 140 of file FuncCosmology.cpp.

◆ converted_xi() [2/2]

double cbl::converted_xi ( const double  RR,
const double  redshift,
const std::vector< double >  rr,
const std::vector< double >  Xi,
const cosmology::Cosmology cosm1,
const cosmology::Cosmology cosm2,
const bool  direction 
)

the 1D two-point correlation function converted from one cosmology to another one

Parameters
RRthe comoving separation, R
redshiftthe redshift
rrvector containing the comoving separations, r
Xivector containing the two-point correlation function, ξ(r)
cosm1object of class Cosmology
cosm2object of class Cosmology
direction0 → cosm2 \( \rightarrow \) cosm1; 1 → cosm1 \( \rightarrow \) cosm2;
Returns
the converted two-point correlation function, ξ(R)

Definition at line 117 of file FuncCosmology.cpp.

◆ convolution()

void cbl::convolution ( const std::vector< double >  f1,
const std::vector< double >  f2,
std::vector< double > &  res,
const double  deltaX 
)

convolution of two functions

Get the convolution of the two functions f1(x) and f2(x), and store it in the output std::vector res. The two functions have to be defined on the same x-axis range, with equal number of points, Δx = (xmax-xmin)/nx.

Parameters
[in]f1first function, f1(x)
[in]f2second function, f2(x)
[out]resconvolution function
[in]deltaXΔx = (xmax-xmin)/nx
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 1580 of file Func.cpp.

◆ coord_zSpace()

void cbl::coord_zSpace ( std::vector< double > &  ra,
std::vector< double > &  dec,
std::vector< double > &  redshift,
std::vector< double > &  xx,
std::vector< double > &  yy,
std::vector< double > &  zz,
const std::vector< double >  vx,
const std::vector< double >  vy,
const std::vector< double >  vz,
const double  sigmaV,
cosmology::Cosmology real_cosm,
const double  mean_redshift,
const double  redshift_min,
const double  redshift_max,
const int  seed = 3213 
)

convert a set of coordinates from real-space to redshift-space

Parameters
[in,out]ravector containing the Right Ascensions
[in,out]decvector containing the Declinations
[in,out]redshiftvector containing the redshifts
[in,out]xxvector containing the x coordinates
[in,out]yyvector containing the y coordinates
[in,out]zzvector containing the z coordinates
[in]vxvector containing the peculiar velocities along the x direction
[in]vyvector containing the peculiar velocities along the y direction
[in]vzvector containing the peculiar velocities along the z direction
[in]sigmaVthe error on the peculiar velocities
[in]real_cosman object of class Cosmology
[in]mean_redshiftthe mean redshift
[in]redshift_minthe minimum redshift
[in]redshift_maxthe maximum redshift
[in]seedthe random seed

Definition at line 94 of file Func.cpp.

◆ CoordinateTypeCast() [1/4]

CoordinateType cbl::CoordinateTypeCast ( const int  coordinateTypeIndex)
inline

cast an enum of type CoordinateType from its index

Parameters
coordinateTypeIndexthe coordinateType index
Returns
object of class CoordinateType

Definition at line 648 of file Kernel.h.

◆ CoordinateTypeCast() [2/4]

CoordinateType cbl::CoordinateTypeCast ( const std::string  coordinateTypeName)
inline

cast an enum of type CoordinateType from its name

Parameters
coordinateTypeNamethe coordinateType name
Returns
object of class CoordinateType

Definition at line 656 of file Kernel.h.

◆ CoordinateTypeCast() [3/4]

std::vector<CoordinateType> cbl::CoordinateTypeCast ( const std::vector< int >  coordinateTypeIndeces)
inline

cast an enum of type CoordinateType from indeces

Parameters
coordinateTypeIndecesthe coordinateType indeces
Returns
object of class CoordinateType

Definition at line 664 of file Kernel.h.

◆ CoordinateTypeCast() [4/4]

std::vector<CoordinateType> cbl::CoordinateTypeCast ( const std::vector< std::string >  coordinateTypeNames)
inline

cast an enum of type CoordinateType from thier names

Parameters
coordinateTypeNamesthe coordinateType names
Returns
objects of class CoordinateType

Definition at line 672 of file Kernel.h.

◆ CoordinateTypeNames()

std::vector<std::string> cbl::CoordinateTypeNames ( )
inline

return a std::vector containing the CoordinateType names

Returns
a std::vector containing the CoordinateType names

Definition at line 640 of file Kernel.h.

◆ CoordinateUnitsCast() [1/4]

CoordinateUnits cbl::CoordinateUnitsCast ( const int  coordinateUnitsIndex)
inline

cast an enum of type CoordinateUnits from its index

Parameters
coordinateUnitsIndexthe coordinateUnits index
Returns
object of class CoordinateUnits

Definition at line 593 of file Kernel.h.

◆ CoordinateUnitsCast() [2/4]

CoordinateUnits cbl::CoordinateUnitsCast ( const std::string  coordinateUnitsName)
inline

cast an enum of type CoordinateUnits from its name

Parameters
coordinateUnitsNamethe coordinateUnits name
Returns
object of class CoordinateUnits

Definition at line 601 of file Kernel.h.

◆ CoordinateUnitsCast() [3/4]

std::vector<CoordinateUnits> cbl::CoordinateUnitsCast ( const std::vector< int >  coordinateUnitsIndeces)
inline

cast an enum of type CoordinateUnits from indeces

Parameters
coordinateUnitsIndecesthe coordinateUnits indeces
Returns
object of class CoordinateUnits

Definition at line 609 of file Kernel.h.

◆ CoordinateUnitsCast() [4/4]

std::vector<CoordinateUnits> cbl::CoordinateUnitsCast ( const std::vector< std::string >  coordinateUnitsNames)
inline

cast an enum of type CoordinateUnits from thier names

Parameters
coordinateUnitsNamesthe coordinateUnits names
Returns
objects of class CoordinateUnits

Definition at line 617 of file Kernel.h.

◆ CoordinateUnitsNames()

std::vector<std::string> cbl::CoordinateUnitsNames ( )
inline

return a std::vector containing the CoordinateUnits names

Returns
a std::vector containing the CoordinateUnits names

Definition at line 585 of file Kernel.h.

◆ coupling_3j()

double cbl::coupling_3j ( const int  l,
const int  l_prime,
const int  l2 
)

compute the Wigner 3-j symbol

compute the Wigner 3-j symbol of type

\[ \left(\begin{array}{ccc}{l}} & {l^'} & {l_2}} \\ {m_{1}} & {m_{2}} & {m_{3}}\end{array}\right) \]

Parameters
lthe first index
l_primethe second index
l2the third index
Returns
the Wigner 3-j symbol

Definition at line 2520 of file Func.cpp.

◆ covariance_matrix() [1/3]

void cbl::covariance_matrix ( const std::vector< std::string >  file,
const std::string  covariance_matrix_file,
const bool  JK = 0 
)

compute the covariance matrix, reading the dataset from files, and store it in a file

Parameters
[in]filethe std::vector containing the input files
[out]covariance_matrix_filethe output covariance matrix file
[in]JKfalse → normalize to 1/(n-1); true → normalize to n-1/n (for Jackknife)

Definition at line 849 of file Func.cpp.

◆ covariance_matrix() [2/3]

void cbl::covariance_matrix ( const std::vector< std::string >  file,
std::vector< double > &  rad,
std::vector< double > &  mean,
std::vector< std::vector< double >> &  cov,
const bool  JK = false 
)

compute the covariance matrix, reading the dataset from files

Parameters
[in]filethe std::vector containing the input files
[out]radthe std::vector containing the binned radii
[out]meanthe std::vector containing the mean values
[out]covthe output covariance matrix
[in]JKfalse → normalize to 1/(n-1); true → normalize to n-1/n (for Jackknife)

Definition at line 807 of file Func.cpp.

◆ covariance_matrix() [3/3]

void cbl::covariance_matrix ( const std::vector< std::vector< double >>  mat,
std::vector< std::vector< double >> &  cov,
const bool  JK = false 
)

compute the covariance matrix from an input dataset

Parameters
[in]matthe data input matrix
[out]covthe output covariance matrix
[in]JKfalse → normalize to 1/(n-1); true → normalize to n-1/n (for Jackknife)
Examples
correlated_samples.cpp, and covsample.cpp.

Definition at line 761 of file Func.cpp.

◆ Covariance_XiMultipoles()

void cbl::Covariance_XiMultipoles ( std::vector< double > &  rr,
std::vector< std::vector< double >> &  covariance,
const int  nbins,
const double  rMin,
const double  rMax,
const double  nObjects,
const double  Volume,
const std::vector< double >  kk,
const std::vector< std::vector< double >>  Pk_multipoles,
const std::vector< int >  orders,
const cbl::BinType  bin_type = cbl::BinType::_linear_ 
)

Covariance matrix for two-point correlation multipoles (see Grieb et al. 2016, Eq. 18 https://arxiv.org/pdf/1509.04293)

\[ C_{\ell_{1} \ell_{2}}^{\epsilon}\left(s_{i}, s_{j}\right)=\frac{\mathrm{i}^{\ell_{1}+\ell_{2}}}{2 \pi^{2}} \int_{0}^{\infty} k^{2} \sigma_{\ell_{1} \ell_{2}}^{2}(k) \bar{\jmath}_{\ell_{1}}\left(k s_{i}\right) \bar{\jmath}_{\ell_{2}}\left(k s_{j}\right) \mathrm{d} k \]

where \(\sigma_{\ell_{1} \ell_{2}}^{2}(k)\) is the multipole expansion of the per-mode covariance sigma2_k, computed by cbl::sigma2_k and \(\bar{\jmath}\) is the shell-averaged Bessel function, computed by cbl::jl_distance_average.

Parameters
rroutput scales
covarianceanalytic covariance matrix
nbinsnumber of configuration space bins
rMinminimum configuration space scale
rMaxmaximum configuration space scale
nObjectsnumber of objects in the sample
Volumethe sample volume
kkthe scales kk
Pk_multipolesthe power spectrum multipoles
ordersthe power spectrum multipoles orders
bin_typethe bin type

Definition at line 994 of file FuncMultipoles.cpp.

◆ covariance_XiMultipoles_integrand()

double cbl::covariance_XiMultipoles_integrand ( const double  kk,
void *  parameters 
)

integrand to obtain the 2PCF multipoles

Parameters
kkthe value kk
parametersthe parameters for the integration
Returns
the 2pcf multipoles integrand

Definition at line 466 of file FuncMultipoles.cpp.

◆ Covariance_XiWedges()

void cbl::Covariance_XiWedges ( std::vector< double > &  rr,
std::vector< std::vector< double >> &  covariance,
const std::vector< double >  mu,
const std::vector< double >  delta_mu,
const int  nbins,
const double  rMin,
const double  rMax,
const double  nObjects,
const double  Volume,
const std::vector< double >  kk,
const std::vector< std::vector< double >>  Pk_multipoles,
const std::vector< int >  orders,
const cbl::BinType  bin_type = cbl::BinType::_linear_ 
)

Covariance matrix for two-point correlation wedges (see Grieb et al. 2016, Eq. 19 https://arxiv.org/pdf/1509.04293)

\[ C_{\mu \mu^{\prime}}^{\xi}\left(s_{i}, s_{j}\right)= \sum_{\ell_{1}, \ell_{2}} \frac{\mathrm{i}^{\ell_{1}+\ell_{2}}}{2 \pi^{2}} \overline{\mathcal{L}}_{\ell_{1}, \mu} \overline{\mathcal{L}}_{\ell_{2}, \mu^{\prime}} \times \int_{0}^{\infty} k^{2} \sigma_{\ell_{1} \ell_{2}}^{2}(k) \bar{\jmath}_{\ell_{1}}\left(k s_{i}\right) \bar{\jmath}_{\ell_{2}}\left(k s_{j}\right) \mathrm{d} k \]

where \(\sigma_{\ell_{1} \ell_{2}}^{2}(k)\) is the multipole expansion of the per-mode covariance computed by cbl::sigma2_k, \(\bar{\jmath}\) is the shell-averaged Bessel function, computed by cbl::jl_distance_average an \(\overline{\mathcal{L}}\) is the average of the Legendre polynomial over the \(\mu\) bin, computed by cbl::Legendre_polynomial_mu_average.

Parameters
rroutput scales
covarianceanalytic covariance matrix
muthe lower wedge integratin limit
delta_muthe wedge mu bin size
nbinsnumber of configuration space bins
rMinminimum configuration space scale
rMaxmaximum configuration space scale
nObjectsnumber of objects in the sample
Volumethe sample volume
kkthe scales kk
Pk_multipolesthe power spectrum multipoles
ordersthe power spectrum multipoles orders
bin_typethe bin type

Definition at line 1096 of file FuncMultipoles.cpp.

◆ create_mocks()

void cbl::create_mocks ( const std::vector< double >  xx,
const std::vector< double >  yy,
const std::vector< double >  zz,
const std::vector< double >  vx,
const std::vector< double >  vy,
const std::vector< double >  vz,
const std::vector< double >  var1,
const std::vector< double >  var2,
const std::vector< double >  var3,
const std::string  output_dir,
const double  boxSize,
const int  frac,
const double  Bord,
const double  mean_redshift,
cosmology::Cosmology real_cosm,
const int  REAL,
const double  sigmaV,
const int  idum,
double &  Volume 
)

create a mock catalogue, subdividing a box into sub-boxes and recentering

Parameters
[in]xxvector containing the x coordinates
[in]yyvector containing the y coordinates
[in]zzvector containing the z coordinates
[in]vxvector containing the peculiar velocities along the x direction
[in]vyvector containing the peculiar velocities along the y direction
[in]vzvector containing the peculiar velocities along the z direction
[in]var1vector containing a generic quantity (e.g. masses or luminosities)
[in]var2vector containing a generic quantity (e.g. masses or luminosities)
[in]var3vector containing a generic quantity (e.g. masses or luminosities)
[in]output_dirname of directory used to store the outputs
[in]boxSizethe box side
[in]fracthe side fraction (if the input box is a sub-box of a box with side equal to boxSize)
[in]Bordthe redshift interval that is cutted at the bords of the box
[in]mean_redshiftthe mean redshift
[in]real_cosman object of class Cosmology
[in]REAL0 → redshift-space; 1 → real-space
[in]sigmaVthe error on the peculiar velocities
[in]idumthe random seed
[out]Volumethe mock volume

Definition at line 187 of file Func.cpp.

◆ cubicfit()

std::vector<double> cbl::cubicfit ( const double  xx)
inline

cubic function

Parameters
xxthe coordinate x
Returns
a std::vector of containing [1, x, x2, x3]

Definition at line 1034 of file Func.h.

◆ degrees()

double cbl::degrees ( const double  angle,
const CoordinateUnits  inputUnits = CoordinateUnits::_radians_ 
)

conversion to degrees

Parameters
anglethe input angle
inputUnitsthe units of the input angle
Returns
the angle in degrees

Definition at line 104 of file Func.cpp.

◆ determinant_matrix()

double cbl::determinant_matrix ( const std::vector< std::vector< double >>  mat)

compute the determinant of a matrix

Parameters
matthe matrix
Returns
the determinant

Definition at line 648 of file Func.cpp.

◆ different_elements()

template<typename T >
std::vector<T> cbl::different_elements ( const std::vector< T >  vect_input)

get the unique elements of a std::vector

Parameters
[in]vect_inputthe input std::vector
Returns
std::vector containing the unique elements of the input std::vector

Definition at line 1349 of file Kernel.h.

◆ DimNames()

std::vector<std::string> cbl::DimNames ( )
inline

return a vector containing the Dim names

Returns
a vector containing the Dim names

Definition at line 499 of file Kernel.h.

◆ displaced_catalogue()

cbl::catalogue::Catalogue cbl::displaced_catalogue ( const catalogue::Catalogue  input_catalogue)

return a sample with objects displaced, according to the internal variables m_x_displacement, m_y_displacement, m_z_displacement

Parameters
input_catalogueinput catalogue
Returns
the displaced catalogue

Definition at line 145 of file Reconstruction.cpp.

◆ distribution()

void cbl::distribution ( std::vector< double > &  xx,
std::vector< double > &  fx,
std::vector< double > &  err,
const std::vector< double >  FF,
const std::vector< double >  WW,
const int  nbin,
const bool  linear = true,
const std::string  file_out = par::defaultString,
const double  fact = 1.,
const double  V1 = par::defaultDouble,
const double  V2 = par::defaultDouble,
const std::string  bin_type = "Linear",
const bool  conv = false,
const double  sigma = 0. 
)

derive and store the number distribution of a given std::vector

Parameters
[out]xxstd::vector containing the binned values of the variable
[out]fxstd::vector containing the binned values of the distribution
[out]errstd::vector containing the binned Poisson errors
[in]FFstd::vector containing the given set of data
[in]WWstd::vector containing the weights
[in]nbinthe number of bins
[in]lineartrue → linear binning; false → logarithmic binning
[in]file_outthe output file where the distribution is stored
[in]factfactor used to normalized the distribution
[in]V1the minimum limit of the distribution
[in]V2the maximum limit of the distribution
[in]bin_type"Linear" → dn/dvar; "Log10" → dn/dlog(var); "Log" → dn/dln(var)
[in]convtrue → compute the Gaussian convolvolution of the distribution; false → do not convolve
[in]sigmaσ of the Gaussian kernel
Examples
randomNumbers.cpp.

Definition at line 1654 of file Func.cpp.

◆ distribution_probability()

double cbl::distribution_probability ( double  xx,
std::shared_ptr< void >  pp,
std::vector< double >  par 
)

probability of an interpolated distribution

Parameters
xxthe variable x
ppa void pointer
para std::vector containing the coefficients:
Returns
the weight of closest element from a discrete list to x
Warning
par is not used, it is necessary only for GSL operations

Definition at line 58 of file Func.cpp.

◆ double_powerlaw()

template<typename T >
T cbl::double_powerlaw ( const T  xx,
const T  x0,
const T  alpha,
const T  beta 
)

the double power-law function

Parameters
xxthe variable x
x0the normalization, x0
alphathe slope, α
betathe slope, β
Returns
the double power-law function

Definition at line 1184 of file Func.h.

◆ DoubleSwap()

double cbl::DoubleSwap ( const double  d)

endian conversion of a double variable

Parameters
da double variable
Returns
the converted variable d

Definition at line 109 of file Kernel.cpp.

◆ eq2sdss()

void cbl::eq2sdss ( const std::vector< double >  ra,
const std::vector< double >  dec,
std::vector< double > &  lambda,
std::vector< double > &  eta 
)

convert from equatorial coordinates R.A., Dec to sdss coordinates \( \lambda, \eta \)

Parameters
ravector containing R.A. values
decvector containing Dec. values
lambdavector containing the \( \lambda \) values
etavector containing the \( \eta \) values

Definition at line 1373 of file Func.cpp.

◆ Erase()

template<typename T >
void cbl::Erase ( std::vector< T > &  vv,
std::vector< int >  ind 
)

erase some elements of a std::vector

Parameters
[in,out]vva std::vector
[in]inda std::vector containing the elements of the input std::vector vv to be erased
Examples
vectors.cpp.

Definition at line 1395 of file Kernel.h.

◆ Erase_columns()

template<typename T >
void cbl::Erase_columns ( std::vector< std::vector< T > > &  Mat,
std::vector< int >  col 
)

erase some columns of a matrix

Parameters
[in,out]Mata matrix (i.e. a std::vector of std::vectors)
[in]cola std::vector containing the columns of the input matrix Mat to be erased
Examples
vectors.cpp.

Definition at line 1431 of file Kernel.h.

◆ Erase_lines()

template<typename T >
void cbl::Erase_lines ( std::vector< std::vector< T > > &  Mat,
std::vector< int >  ll 
)

erase some lines of a matrix

Parameters
[in,out]Mata matrix (i.e. a std::vector of std::vectors)
[in]lla std::vector containing the lines of the input matrix Mat to be erased
Examples
vectors.cpp.

Definition at line 1413 of file Kernel.h.

◆ Error()

int cbl::Error ( const std::string  msg,
const cbl::glob::ExitCode  exitCode = cbl::glob::ExitCode::_error_,
const std::string  header = "\n" 
)
inline

throw an exception

Parameters
msgthe message describing the exception
exitCodethe exit status
headerheader of the error message
Returns
integer

Definition at line 761 of file Kernel.h.

◆ error_multipole_xi0() [1/2]

double cbl::error_multipole_xi0 ( const double  ss,
const std::vector< double >  rp,
const std::vector< double >  pi,
const std::vector< std::vector< double >>  error,
const double  delta_s 
)

error on xi0(s) from ξ(rp,π)

Parameters
sscomoving scale where the multipole is computed
rpstd::vector containing the values of rp
pistd::vector containing the values of π
errormatrix containing the errors of ξ(r,μ)
delta_sbin size
Returns
error on xi0(s)

Definition at line 207 of file FuncMultipoles.cpp.

◆ error_multipole_xi0() [2/2]

double cbl::error_multipole_xi0 ( const int  indexR,
const std::vector< double >  mu,
const std::vector< std::vector< double >>  error 
)

error on xi0(s) from ξ(r,μ)

Parameters
indexRindex correspondent to the comoving separation where the multipole is computed
mustd::vector containing the angle between the separation std::vector and the line of sight
errormatrix containing the errors of ξ(r,μ)
Returns
error on xi0(s)

Definition at line 90 of file FuncMultipoles.cpp.

◆ error_multipole_xi2() [1/2]

double cbl::error_multipole_xi2 ( const double  ss,
const std::vector< double >  rp,
const std::vector< double >  pi,
const std::vector< std::vector< double >>  error,
const double  delta_s 
)

error on xi2(s) from ξ(rp,π)

Parameters
sscomoving scale where the multipole is computed
rpstd::vector containing the values of rp
pistd::vector containing the values of π
errormatrix containing the errors of ξ(r,μ)
delta_sbin size
Returns
error on xi2(s)

Definition at line 231 of file FuncMultipoles.cpp.

◆ error_multipole_xi2() [2/2]

double cbl::error_multipole_xi2 ( const int  indexR,
const std::vector< double >  mu,
const std::vector< std::vector< double >>  error 
)

error on xi2(s) from ξ(r,μ)

Parameters
indexRindex correspondent to the comoving separation where the multipole is computed
mustd::vector containing the angle between the separation std::vector and the line of sight
errormatrix containing the errors of ξ(r,μ)
Returns
error on xi2(s)

Definition at line 105 of file FuncMultipoles.cpp.

◆ error_multipole_xi4() [1/2]

double cbl::error_multipole_xi4 ( const double  ss,
const std::vector< double >  rp,
const std::vector< double >  pi,
const std::vector< std::vector< double >>  error,
const double  delta_s 
)

error on xi4(s) from ξ(rp,π)

Parameters
sscomoving scale where the multipole is computed
rpstd::vector containing the values of rp
pistd::vector containing the values of π
errormatrix containing the errors of ξ(r,μ)
delta_sbin size
Returns
error on xi4(s)

Definition at line 255 of file FuncMultipoles.cpp.

◆ error_multipole_xi4() [2/2]

double cbl::error_multipole_xi4 ( const int  indexR,
const std::vector< double >  mu,
const std::vector< std::vector< double >>  error 
)

error on xi4(s) from ξ(r,μ)

Parameters
indexRindex correspondent to the comoving separation where the multipole is computed
mustd::vector containing the angle between the separation std::vector and the line of sight
errormatrix containing the errors of ξ(r,μ)
Returns
error on xi4(s)

Definition at line 120 of file FuncMultipoles.cpp.

◆ error_xi_ratio()

double cbl::error_xi_ratio ( const double  beta,
const double  error_beta 
)

error on the ratio between the redshift-space and real-space correlation functions

as predicted by the large-scale limit of the Kaiser/Hamilton model:

\[ \delta\left[\frac{\xi(s)}{\xi(r)}\right] = \left(\frac{2}{3} + \frac{2\beta}{5}\right)\cdot\delta(\beta) \]

Parameters
betaβ=f/b
error_betaerror on β
Returns
δ[ξ(s)/ξ(r)]

Definition at line 322 of file FuncXi.cpp.

◆ ErrorCBL()

int cbl::ErrorCBL ( const std::string  msg,
const std::string  functionCBL,
const std::string  fileCBL,
const cbl::glob::ExitCode  exitCode = cbl::glob::ExitCode::_error_ 
)
inline

throw an exception: it is used for handling exceptions inside the CosmoBolognaLib

Parameters
msgthe message describing the exception
functionCBLthe CBL function where the exception is raised
fileCBLthe CBL file containing the function where the exception is raised
exitCodethe exit status
Returns
integer

Definition at line 780 of file Kernel.h.

◆ Euclidean_distance()

double cbl::Euclidean_distance ( const double  x1,
const double  x2,
const double  y1,
const double  y2,
const double  z1,
const double  z2 
)

the Euclidean distance in 3D relative to the origin (0,0,0), i.e. the Euclidean norm

Parameters
x1x coordinate of the first object
x2x coordinate of the second object
y1y coordinate of the first object
y2y coordinate of the second object
z1z coordinate of the first object
z2z coordinate of the second object
Returns
the Euclidean distance

Definition at line 250 of file Func.cpp.

◆ extract_elements()

template<typename T >
std::vector<T> cbl::extract_elements ( std::vector< T >  vec,
std::vector< unsigned int >  index 
)

extract elements from a given vector

Parameters
vecthe input vector
indexvector containing the index of values to extract
Returns
the vector with requested elements

Definition at line 1669 of file Kernel.h.

◆ f_star()

double cbl::f_star ( const double  xx,
const double  f_g,
const double  k_star 
)

velocity distribution used to model BAO

(see Chuang&Wang 2012, 1209.0210)

Parameters
xxs
f_gfg
k_stark*
Returns
f*

Definition at line 642 of file FuncXi.cpp.

◆ f_v() [1/2]

double cbl::f_v ( const double  vel,
const double  rp,
const double  pi,
const double  var,
const double  sigmav0,
const double  cmu,
const double  cs1,
const double  cs2 
)

pairwise velocity distribution

(see Chuang&Wang 2012 (1209.0210), eq. 25)

Parameters
velcomoving velocity
rprp: comoving separation perpendicular to the line-of-sight
piπ: comoving separation parallel to the line-of-sight
var1/[H(z)a(z)]
sigmav0σv,0
cmuCμ
cs1Cσ1
cs2Cσ2
Returns
f(v)

Definition at line 627 of file FuncXi.cpp.

◆ f_v() [2/2]

double cbl::f_v ( const double  vel,
const double  sigmav,
const int  FV 
)

pairwise velocity distribution

Parameters
velcomoving velocity
sigmavσ12
FV0 \( \rightarrow \) exponential; \( \rightarrow \) 1 gaussian
Returns
f(v)

Definition at line 616 of file FuncXi.cpp.

◆ Filter()

double cbl::Filter ( const double  r,
const double  rc 
)

filter W(r/rc), used e.g. for filtering the correlation function

Parameters
rthe scale at which calculate the filter value
rcthe characteristic filter scale
Returns
the filter

Definition at line 94 of file Func.cpp.

◆ fit_covariance_matrix_2PCF_monopole()

std::vector< double > cbl::fit_covariance_matrix_2PCF_monopole ( const std::vector< double >  mean,
const std::vector< std::vector< double >>  mock_xi0,
const bool  doJK,
const cbl::cosmology::Cosmology  cosmology,
const double  nObjects,
const double  Volume,
const double  bias,
const double  redshift,
const double  rMin,
const double  rMax,
const int  nbins,
const cbl::BinType  bin_type,
const std::string  method_Pk = "CAMB",
const double  sigma_NL = 0.,
const bool  NL = true 
)

fit the input covariance matrix using the gaussian model, varying the number of objects and the volume of the sample

Parameters
meanthe 2PCF mean value
mock_xi0the 2CPF of the mocks
doJK0 → normalize to 1/(n-1); 1 → normalize to n-1/n (for Jackknife)
cosmologythe cosmology
nObjectsthe number of objects in the sample
Volumethe volume of the sample
biasthe bias of the sample
redshiftthe redshift of the sample
rMinthe minimum scale
rMaxthe maximum scale
nbinsthe number of bins
bin_typethe binning type
method_Pkmethod used to compute the power spectrum; valid choices for method_Pk are: CAMB [http://camb.info/], CLASS [http://class-code.net/], MPTbreeze-v1 [http://arxiv.org/abs/1207.1465], EisensteinHu [http://background.uchicago.edu/~whu/transfer/transferpage.html]
sigma_NLthe BAO damping parameter
NL0 \(\rightarrow\) linear power spectrum; 1 \(\rightarrow\) non-linear power spectrum
Returns
the best-fit values

Definition at line 46 of file Forecast.cpp.

◆ flatten()

template<typename T >
std::vector<T> cbl::flatten ( std::vector< std::vector< T >>  matrix)

flatten a \(\left( n\times m \right)\) matrix in a vector of size \(x\times m\)

Parameters
matrixthe input matrix
Returns
the vectorized matrix

Definition at line 1686 of file Kernel.h.

◆ FloatSwap()

float cbl::FloatSwap ( const float  f)

endian conversion of a float variable

Parameters
fa flot variable
Returns
the converted variable f

Definition at line 89 of file Kernel.cpp.

◆ gaussian()

template<typename T >
T cbl::gaussian ( xx,
std::shared_ptr< void >  pp,
std::vector< double >  par 
)

the Gaussian function

Parameters
xxthe variable x
ppa void pointer
para std::vector containing the coefficients: par[0]=mean, par[1]=&sigma, pars[2]=normalization
Returns
the Gaussian function
Warning
pp is not used, it is necessary only for GSL operations

Definition at line 1127 of file Func.h.

◆ generate_correlated_data() [1/2]

std::vector< std::vector< double > > cbl::generate_correlated_data ( const int  nExtractions,
const std::vector< double >  mean,
const std::vector< std::vector< double >>  covariance,
const int  idum = 12312 
)

generate a covariant sample of n points using a covariance matrix

Parameters
nExtractionsthe number of correlated samples to extract
meanthe mean values for the sample
covariancethe covariance matrix of the sample
idumseed for random number generator
Returns
std::vector containing a correlated samples of given mean and covariance
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 2613 of file Func.cpp.

◆ generate_correlated_data() [2/2]

std::vector< double > cbl::generate_correlated_data ( const std::vector< double >  mean,
const std::vector< std::vector< double >>  covariance,
const int  idum = 213123 
)

generate a covariant sample of n points using a covariance matrix

Parameters
meanthe mean values for the sample
covariancethe covariance matrix of the sample
idumseed for random number generator
Returns
std::vector containing a correlated sample of given mean and covariance
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t
Examples
correlated_samples.cpp, and covsample.cpp.

Definition at line 2142 of file Func.cpp.

◆ generate_mock_2PCF_monopole()

std::shared_ptr< cbl::data::Data > cbl::generate_mock_2PCF_monopole ( const cbl::cosmology::Cosmology  cosmology,
const double  bias,
const double  nObjects,
const double  Volume,
const double  redshift,
const double  rMin,
const double  rMax,
const int  nbins,
const cbl::BinType  bin_type,
const std::string  method_Pk = "CAMB",
const double  sigma_NL = 0.,
const bool  NL = true 
)

generate mock measurementes of the 2PCF monopole from gaussian covariance matrix

Parameters
cosmologythe cosmology
biasthe bias of the sample
nObjectsthe number of objects in the sample
Volumethe volume of the sample
redshiftthe redshift of the sample
rMinthe minimum scale
rMaxthe maximum scale
nbinsthe number of bins
bin_typethe binning type
method_Pkmethod used to compute the power spectrum; valid choices for method_Pk are: CAMB [http://camb.info/], CLASS [http://class-code.net/], MPTbreeze-v1 [http://arxiv.org/abs/1207.1465], EisensteinHu [http://background.uchicago.edu/~whu/transfer/transferpage.html]
sigma_NLthe BAO damping parameter
NL0 \(\rightarrow\) linear power spectrum; 1 \(\rightarrow\) non-linear power spectrum
Returns
the best-fit values

Definition at line 143 of file Forecast.cpp.

◆ generate_mock_2PCF_multipoles()

std::shared_ptr< cbl::data::Data > cbl::generate_mock_2PCF_multipoles ( const cbl::cosmology::Cosmology  cosmology,
const double  bias,
const double  nObjects,
const double  Volume,
const double  redshift,
const double  rMin,
const double  rMax,
const int  nbins,
const cbl::BinType  bin_type,
const std::string  method_Pk = "CAMB",
const double  sigma_NL = 0.,
const bool  NL = true 
)

generate mock measurementes of the 2PCF multipoles from gaussian covariance matrix

Parameters
cosmologythe cosmology
biasthe bias of the sample
nObjectsthe number of objects in the sample
Volumethe volume of the sample
redshiftthe redshift of the sample
rMinthe minimum scale
rMaxthe maximum scale
nbinsthe number of bins
bin_typethe binning type
method_Pkmethod used to compute the power spectrum; valid choices for method_Pk are: CAMB [http://camb.info/], CLASS [http://class-code.net/], MPTbreeze-v1 [http://arxiv.org/abs/1207.1465], EisensteinHu [http://background.uchicago.edu/~whu/transfer/transferpage.html]
sigma_NLthe BAO damping parameter
NL0 \(\rightarrow\) linear power spectrum; 1 \(\rightarrow\) non-linear power spectrum
Returns
the best-fit values

Definition at line 165 of file Forecast.cpp.

◆ get_mu()

double cbl::get_mu ( const double  r1,
const double  r2,
const double  r3 
)

get the cosine of the angle between two sides of a triangle

\( mu = \frac{r_1^2+r_2^2-r_3^3}{2 \cdot r_1 \cdot r_2}\)

Parameters
r1the first side of the triangle
r2the second side of the triangle
r3the third side of the triangle
Returns
the cosine of the angle between two sides of a triangle

Definition at line 2529 of file Func.cpp.

◆ haversine_distance()

double cbl::haversine_distance ( const double  ra1,
const double  ra2,
const double  dec1,
const double  dec2 
)

the haversine angular separation

Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t
Parameters
ra1the Right Ascension of the first object [radians]
ra2the Right Ascension of the second object [radians]
dec1the Declination of the first object [radians]
dec2the Declination of the second object [radians]
Returns
the haversine angular separation [radians]

Definition at line 286 of file Func.cpp.

◆ headerCBL()

std::ostream& cbl::headerCBL ( std::ostream &  stream)
inline

provide the header for all internal messages

Parameters
streaman std::ostream object
Returns
the header for internal messages

Definition at line 727 of file Kernel.h.

◆ identity()

template<typename T >
T cbl::identity ( xx,
std::shared_ptr< void >  pp,
std::vector< double >  par 
)

the Identity function

Parameters
xxthe variable x
ppa void pointer
para std::vector
Returns
1.
Warning
pp and par are not used, but they are necessary in the function template

Definition at line 1053 of file Func.h.

◆ index_closest()

template<typename T >
T cbl::index_closest ( x,
std::vector< T >  vv 
)

given a number x, return the index of the closest element to x in vv

Parameters
xthe value
vvthe std::vector
Returns
the index of the closest element to x in vv

Definition at line 965 of file Kernel.h.

◆ inRange() [1/3]

template<typename T >
bool cbl::inRange ( std::vector< T >  value,
std::vector< std::vector< T >>  ranges,
bool  include_limits = true 
)

return false \( \rightarrow \) values outside the range; true \( \rightarrow \) values inside the range

Parameters
valuevector containing the values
rangesvector containing the ranges
include_limitstrue \( \rightarrow \) include limits; false \( \rightarrow \) exclude limits.
Returns
vector of booleans: false \( \rightarrow \) if values outside the range; true \( \rightarrow \) values inside the range

Definition at line 1814 of file Kernel.h.

◆ inRange() [2/3]

template<typename T >
bool cbl::inRange ( std::vector< T >  value,
std::vector< T >  min,
std::vector< T >  max,
bool  include_limits = true 
)

return false \( \rightarrow \) if values are outside the range; true \( \rightarrow \) if values are inside the range

Parameters
valuevector containing the values
minvector containing the lower limits
maxvector containing the upper limits
include_limitstrue \( \rightarrow \) include limits; false \( \rightarrow \) exclude limits.
Returns
vector of booleans: false \( \rightarrow \) values outside the range; true \( \rightarrow \) values inside the range

Definition at line 1789 of file Kernel.h.

◆ inRange() [3/3]

template<typename T >
bool cbl::inRange ( value,
min,
max,
bool  include_limits = true 
)

return false \( \rightarrow \) value outside the range; true \( \rightarrow \) value inside the range

Parameters
valuethe value
minthe lower limit
maxthe upper limit
include_limitstrue \( \rightarrow \) include limits; false \( \rightarrow \) exclude limits.
Returns
false \( \rightarrow \) values outside the range; true \( \rightarrow \) value inside the range

Definition at line 1759 of file Kernel.h.

◆ interpolated()

double cbl::interpolated ( const double  _xx,
const std::vector< double >  xx,
const std::vector< double >  yy,
const std::string  type 
)

1D interpolation

Parameters
[in]_xxthe point where the input function will be interpolated or extrapolated
[in]xxstd::vector containing the binned values of x
[in]yystd::vector containing the binned values of the function, y(x), to be interpolated or extrapolated
[in]typethe method used to interpolate or extrapolate: "Linear" → linear interpolation; "Poly" → polynomial interpolation; "Spline" → cubic spline interpolation; "Rat" → diagonal rational function interpolation; "BaryRat" → barycentric rational interpolation
Returns
the interpolated value of the input function
Warning
if _xx is outside the range of the input std::vector xx, the returned value is the extrapolation

Definition at line 445 of file Func.cpp.

◆ interpolated_2D()

double cbl::interpolated_2D ( const double  _x1,
const double  _x2,
const std::vector< double >  x1,
const std::vector< double >  x2,
const std::vector< std::vector< double >>  yy,
const std::string  type 
)

2D interpolation

Parameters
[in]_x1the point in the first dimension where the input function will be interpolated
[in]_x2the point in the second dimension where the input function will be interpolated
[in]x1std::vector containing the binned values of x in the first dimension
[in]x2std::vector containing the binned values of x in the second dimension
[in]yystd::vector containing the binned values of the function, y(x), to be interpolated or extrapolated
[in]typethe method used to interpolate or extrapolate: "Linear" → linear interpolation; "Poly" → polynomial interpolation; "Spline" → cubic spline interpolation; "Rat" → diagonal rational function interpolation; "BaryRat" → barycentric rational interpolation
Returns
the interpolated or extrapolated value of the input function
Warning
if _x1 and/or _x2 are outside the range of the input std::vectors x1 and/or x2, the returned value is the extrapolatation

Definition at line 502 of file Func.cpp.

◆ IntSwap()

int cbl::IntSwap ( const int  i)

endian conversion of an integer variable

Parameters
ian integer variable
Returns
the converted variable i

Definition at line 57 of file Kernel.cpp.

◆ invert_matrix() [1/2]

void cbl::invert_matrix ( const std::vector< std::vector< double >>  mat,
std::vector< std::vector< double >> &  mat_inv,
const double  prec = 1.e-10,
const int  Nres = -1 
)

function to invert a matrix

this function implements the inversion of a given matrix using the GSL

if the input matrix is a covariance estimated with a finite number (Nres>0) of resamples (e.g. via jackknife or bootstrap), the inverted matrix is corrected as follows (Hartlap, Simon and Schneider 2006):

\[ \hat{C}^{-1}=\left(1-\frac{n_b+1}{N_{res}-1}\right)C^{-1} \]

where \(n_b\) is the number of bins and \(N_{res}\) is the number of resamplings

Parameters
[in]matthe matrix to be inverted
[out]mat_invthe inverted matrix
[in]precthe precision required
[in]Nres\(N_{res}\), the number of catalogue resamplings used to estimate the covariance matrix; \(N_{res}=-1\) if the covariance matrix has not been estimated with resampling methods

Definition at line 673 of file Func.cpp.

◆ invert_matrix() [2/2]

void cbl::invert_matrix ( const std::vector< std::vector< double >>  mat,
std::vector< std::vector< double >> &  mat_inv,
const int  i1,
const int  i2,
const double  prec = 1.e-10,
const int  Nres = -1 
)

function to invert a sub-matrix, extracted from a given matrix

this function implements the inversion of a sub-matrix, extracted from a given matrix, using the GSL

if the input matrix is a covariance estimated with a finite number (Nres>0) of resamples (e.g. via jackknife or bootstrap), the inverted matrix is corrected as follows (Hartlap, Simon and Schneider 2006):

\[ \hat{C}^{-1}=\left(1-\frac{n_b+1}{N_{res}-1}\right)C^{-1} \]

where \(n_b\) is the number of bins and \(N_{res}\) is the number of resamplings

Parameters
[in]matthe matrix to be inverted
[out]mat_invthe inverted matrix
[in]i1minimum index considered
[in]i2maximum index considered
[in]precthe precision required
[in]Nres\(N_{res}\), the number of catalogue resamplings used to estimate the covariance matrix; \(N_{res}=-1\) if the covariance matrix has not been estimated with resampling methods

Definition at line 705 of file Func.cpp.

◆ isDimEqual() [1/2]

template<typename T >
bool cbl::isDimEqual ( const std::vector< std::vector< T > >  mat1,
const std::vector< std::vector< T > >  mat2 
)

check if the dimensions of two matrices are equal

Parameters
mat1a matrix
mat2a matrix
Returns
0 \(\rightarrow\) the dimensions are different; 1 \(\rightarrow\) the dimensions are equal

Definition at line 1506 of file Kernel.h.

◆ isDimEqual() [2/2]

template<typename T >
bool cbl::isDimEqual ( const std::vector< T >  vect1,
const std::vector< T >  vect2 
)

check if the dimensions of two std::vectors are equal

Parameters
vect1a std::vector
vect2a std::vector
Returns
0 \(\rightarrow\) the dimensions are different; 1 \(\rightarrow\) the dimensions are equal

Definition at line 1493 of file Kernel.h.

◆ isSet() [1/7]

bool cbl::isSet ( const double  var)
inline

check if the value of a [double] variable has already been set

Parameters
vara double variable
Returns
if var>par::defaultDouble \( \rightarrow \) true; else \( \rightarrow \) false

Definition at line 836 of file Kernel.h.

◆ isSet() [2/7]

bool cbl::isSet ( const int  var)
inline

check if the value of a [int] variable has already been set

Parameters
vara int variable
Returns
if var>par::defaultInt \( \rightarrow \) true; else \( \rightarrow \) false

Definition at line 814 of file Kernel.h.

◆ isSet() [3/7]

bool cbl::isSet ( const long  var)
inline

check if the value of a [long] variable has already been set

Parameters
vara long variable
Returns
if var>par::defaultLong \( \rightarrow \) true; else \( \rightarrow \) false

Definition at line 825 of file Kernel.h.

◆ isSet() [4/7]

bool cbl::isSet ( const std::string  var)
inline

check if the value of a [string] variable has already been set

Parameters
vara string variable
Returns
if var is different than par::defaultString \( \rightarrow \) true; else \( \rightarrow \) false

Definition at line 803 of file Kernel.h.

◆ isSet() [5/7]

bool cbl::isSet ( const std::vector< double >  vect)
inline

check if the values of a [double] std::vector have already been set

Parameters
vecta vactor of double values
Returns
if vect[i]<par::defaultDouble \(\forall\) i \( \rightarrow \) false; else \( \rightarrow \) true

Definition at line 848 of file Kernel.h.

◆ isSet() [6/7]

bool cbl::isSet ( const std::vector< std::vector< unsigned int >>  vect)
inline

check if the values of a [unsigned int] std::vector<std::vector> have already been set

Parameters
vecta vactor of double values
Returns
if vect[i]<par::defaultDouble \(\forall\) i \( \rightarrow \) false; else \( \rightarrow \) true

Definition at line 884 of file Kernel.h.

◆ isSet() [7/7]

bool cbl::isSet ( const std::vector< unsigned int >  vect)
inline

check if the values of a [unsigned int] std::vector have already been set

Parameters
vecta vactor of double values
Returns
if vect[i]<par::defaultDouble \(\forall\) i \( \rightarrow \) false; else \( \rightarrow \) true

Definition at line 866 of file Kernel.h.

◆ j0()

double cbl::j0 ( const double  xx)

the l=0 spherical Bessel function

Parameters
xxthe variable x
Returns
the l=0 spherical Bessel function

Definition at line 2039 of file Func.cpp.

◆ j0_distance_average()

double cbl::j0_distance_average ( const double  kk,
const double  r_down,
const double  r_up 
)

the distance average l=0 spherical Bessel function this function is used to obtain the analytic twop monopole covariance

Parameters
kkthe variable k
r_downthe lower limit of the twopcf bin
r_upthe upper limit of the twopcf bin
Returns
the distance average l=0 spherical Bessel function

Definition at line 2075 of file Func.cpp.

◆ j2()

double cbl::j2 ( const double  xx)

the l=2 spherical Bessel function

Parameters
xxthe variable x
Returns
the l=2 spherical Bessel function

Definition at line 2048 of file Func.cpp.

◆ j2_distance_average()

double cbl::j2_distance_average ( const double  kk,
const double  r_down,
const double  r_up 
)

the distance average l=2 spherical Bessel function this function is used to obtain the analytic twop quadrupole covariance

Parameters
kkthe variable k
r_downthe lower limit of the twopcf bin
r_upthe upper limit of the twopcf bin
Returns
the distance average l=2 spherical Bessel function

Definition at line 2087 of file Func.cpp.

◆ j4()

double cbl::j4 ( const double  xx)

the l=4 spherical Bessel function

Parameters
xxthe variable x
Returns
the l=4 spherical Bessel function

Definition at line 2057 of file Func.cpp.

◆ jl()

double cbl::jl ( const double  xx,
const int  order 
)

the order l spherical Bessel function

Parameters
xxthe variable x
orderthe order l of spherical Bessel function
Returns
the order l spherical Bessel function

Definition at line 2066 of file Func.cpp.

◆ jl_distance_average()

double cbl::jl_distance_average ( const double  kk,
const int  order,
const double  r_down,
const double  r_up 
)

the distance average for the order l-th spherical Bessel function

Parameters
kkthe variable k
orderthe shperical Bessel function order
r_downthe lower limit of the twopcf bin
r_upthe upper limit of the twopcf bin
Returns
the distance average l spherical Bessel function

Definition at line 2109 of file Func.cpp.

◆ jl_spherical_integrand()

double cbl::jl_spherical_integrand ( double  rr,
void *  params 
)

the generic integrand to obtain the distance average spherical Bessel function of order l

Parameters
rrthe variable r
paramsthe parameters for the function
Returns
the distance average l=2 spherical Bessel function

Definition at line 2099 of file Func.cpp.

◆ legendre_polynomial()

double cbl::legendre_polynomial ( const double  mu,
const int  l 
)

the order l Legendre polynomial

Parameters
muthe variable mu
lthe order l Legendre polynomial
Returns
the order l Legendre polynomial

Definition at line 1786 of file Func.cpp.

◆ legendre_polynomial_integral()

double cbl::legendre_polynomial_integral ( double  mu,
void *  params 
)

the order l Legendre polynomial integrand

Parameters
muthe variable mu
paramsthe parameters for the function
Returns
the order l Legendre polynomial integrand

Definition at line 1795 of file Func.cpp.

◆ Legendre_polynomial_mu_average() [1/2]

double cbl::Legendre_polynomial_mu_average ( const double  mu_min,
const double  mu_max,
const int  ll 
)

the average of the Legendre polynomial of the l-th order over the \(\mu=\cos(\theta)\) range

Parameters
mu_minthe lower limit of integration of the Legendre polynomial
mu_maxthe upper limit of integration of the Legendre polynomial
llthe order of the Legendre polynomial
Returns
the average of the Legendre polynomial of the l-th order over the mu range

Definition at line 1816 of file Func.cpp.

◆ Legendre_polynomial_mu_average() [2/2]

double cbl::Legendre_polynomial_mu_average ( const int  ll,
const double  mu,
const double  delta_mu 
)

the average of the Legendre polynomial of the l-th order over the mu range

Parameters
llthe order of the Legendre polynomial
muthe order of the Legendre polynomial
delta_muthe order of the Legendre polynomial
Returns
the average of the Legendre polynomial of the l-th order over the mu range

Definition at line 1806 of file Func.cpp.

◆ Legendre_polynomial_theta_average()

double cbl::Legendre_polynomial_theta_average ( const double  theta_min,
const double  theta_max,
const int  ll 
)

the average of the Legendre polynomial of the l-th order over the \(\theta\) range

Parameters
theta_minthe lower limit of integration of the Legendre polynomial
theta_maxthe upper limit of integration of the Legendre polynomial
llthe order of the Legendre polynomial
Returns
the average of the Legendre polynomial of the l-th order over the mu range

Definition at line 1827 of file Func.cpp.

◆ Legendre_polynomial_triangles_average() [1/2]

vector< vector< double > > cbl::Legendre_polynomial_triangles_average ( const double  r12,
const double  r13,
const double  deltaR,
const int  lMax,
const double  rel_err = 1.e-5,
const double  abs_err = 1.e-8,
const int  nevals = 100 
)

the average of the Legendre polynomial up to a maximum order lMax of all triangles with sides r12, r13

Parameters
r12first triangle side
r13second triangle side
deltaRthe bin width
lMaxthe maximum Legedre polynomial order
rel_errthe relative error
abs_errthe absolute error
nevalsthe maximum number of integrals evaluation
Returns
the average of the Legendre polynomial of the l-th order over the mu range

Definition at line 1866 of file Func.cpp.

◆ Legendre_polynomial_triangles_average() [2/2]

double cbl::Legendre_polynomial_triangles_average ( const double  r12_min,
const double  r12_max,
const double  r13_min,
const double  r13_max,
const double  r23_min,
const double  r23_max,
const int  ll,
const double  rel_err = 1.e-5,
const double  abs_err = 1.e-8,
const int  nevals = 100 
)

the average of the Legendre polynomial of the l-th order over the \(r_{12}, r_{13}, r_{23} \)

Parameters
r12_minthe lower limit of integration for \(r_{12}\)
r12_maxthe upper limit of integration for \(r_{12}\)
r13_minthe lower limit of integration for \(r_{13}\)
r13_maxthe upper limit of integration for \(r_{13}\)
r23_minthe lower limit of integration for \(r_{23}\)
r23_maxthe upper limit of integration for \(r_{23}\)
llthe order of the Legendre polynomial
rel_errthe relative error
abs_errthe absolute error
nevalsthe maximum number of integrals evaluation
Returns
the average of the Legendre polynomial of the l-th order over the mu range

Definition at line 1836 of file Func.cpp.

◆ linear_bin_vector()

template<typename T >
std::vector<T> cbl::linear_bin_vector ( const size_t  nn,
const T  min,
const T  max 
)

fill a std::vector with linearly spaced values

Parameters
[in]nnthe number of steps, i.e. the final dimension of vv
[in]minthe minimum value of the range of values
[in]maxthe maximum value of the range of values
Returns
a linearly spaced vector
Examples
model_power_spectrum_angular.cpp.

Definition at line 1604 of file Kernel.h.

◆ linear_interpolation_3D()

std::vector< double > cbl::linear_interpolation_3D ( const std::vector< double >  min,
std::vector< double >  max,
std::vector< int >  steps,
std::vector< std::vector< std::vector< double >>>  func,
const std::vector< std::vector< double >>  pos 
)

3D interpolation on a 3D regular grid

Parameters
minVector of minimum grid values: [minX, minY, minZ]
maxVector of maximum grid values: [maxX, maxY, maxZ]
stepsVector of step values in the three grid dimensions: [stepX, stepY, stepZ] The grid can therefore have different steps in different dimensions
funcOrderd matrix of the values of the function to be interpolated, defined in the various points of the grid. Each element is called as func[X][Y][Z]
posVector of points to interpolate on. It must have dimension [Npoints][3]
Returns
The interpolated values
Warning
Interpolation only. No extrapolation will be performed

Definition at line 546 of file Func.cpp.

◆ linearfit()

std::vector<double> cbl::linearfit ( const double  xx)
inline

linear function

Parameters
xxthe coordinate x
Returns
a std::vector containing [1, x]

Definition at line 1007 of file Func.h.

◆ Ln()

template<typename T >
T cbl::Ln ( const T  val,
const double  fact = 0.9 
)

natural logarithm

Parameters
vala number
factfactor multiplying par::defaultDouble
Returns
if val>0 \( \rightarrow \) log(val); else \( \rightarrow \) par::defaultDouble

Definition at line 937 of file Kernel.h.

◆ locate()

template<typename T >
int cbl::locate ( const std::vector< T > &  vv,
const T  xx 
)

locate a value in a given std::vector

Author
Carlo Giocoli
cgioc.nosp@m.oli@.nosp@m.gmail.nosp@m..com
Parameters
vva std::vector of generic values
xxa generic number
Returns
the std::vector index i such that vv[i]~xx

Definition at line 1638 of file Kernel.h.

◆ Log()

template<typename T >
T cbl::Log ( const T  val,
const double  fact = 0.9 
)

common logarithm (i.e. logarithm to base 10)

Parameters
vala number
factfactor multiplying par::defaultDouble
Returns
if val>0 \( \rightarrow \) log10(val); else \( \rightarrow \) par::defaultDouble

Definition at line 926 of file Kernel.h.

◆ logarithmic_bin_vector()

template<typename T >
std::vector<T> cbl::logarithmic_bin_vector ( const size_t  nn,
const T  min,
const T  max 
)

fill a std::vector with logarithmically spaced values

Parameters
[in]nnthe number of steps, i.e. the final dimension of vv
[in]minthe minimum value of the range of values
[in]maxthe maximum value of the range of values
Returns
a logarithmically spaced vector
Examples
Pk_BoltzmannSolver.cpp, model_2pt_monopole_RSD.cpp, and sizeFunction.cpp.

Definition at line 1621 of file Kernel.h.

◆ LongSwap()

long long cbl::LongSwap ( const long long  i)

endian conversion of a long integer variable

Parameters
ia long integer variable
Returns
the converted variable i

Definition at line 71 of file Kernel.cpp.

◆ makeDir()

int cbl::makeDir ( std::string  path,
const std::string  rootPath = ".",
const mode_t  mode = 0777,
const bool  verbose = false 
)

function to create multiple directories

http://mylinuxtechcorner.blogspot.com/2012/09/c-version-for-mkdir-p.html

Parameters
paththe name of the directory (or directories) to be created recursively (with parents)
rootPaththe path to the root directory
modethe permissions for the directory
verboseif true it shows a warning message when the directory to be created already exists
Returns
0 if no error occurs

Definition at line 381 of file Kernel.cpp.

◆ Mass()

template<typename T >
T cbl::Mass ( const T  RR,
const T  Rho 
)

the mass of a sphere of a given radius and density

Parameters
RRthe radius
Rhothe density
Returns
the mass

Definition at line 1243 of file Func.h.

◆ Max()

template<typename T >
T cbl::Max ( const std::vector< T >  vect)

maximum element of a std::vector

Parameters
vecta std::vector
Returns
the maximum element of the std::vector vect
Examples
model_cosmology.cpp.

Definition at line 1336 of file Kernel.h.

◆ max_separations_AP()

void cbl::max_separations_AP ( const double  Rp_max,
const double  Pi_max,
const double  redshift,
const cosmology::Cosmology cosm1,
const std::vector< cosmology::Cosmology > &  cosm2,
double &  rpM_AP,
double &  piM_AP,
double &  rM_AP 
)

the maximum comoving separations to be used for the AP test, for a given set of test cosmologies

Parameters
[in]Rp_maxthe maximum value of the comoving distance perpendicular to the line-of-sight, rp,MAX, in the cosmology cosm1
[in]Pi_maxthe maximum value of the comoving distance parallel to the line-of-sight, πMAX, in the cosmology cosm1
[in]redshiftthe redshift
[in]cosm1object of class Cosmology: the assumed (or real) cosmology
[in]cosm2a vector of objects of class Cosmology: the test cosmologies
[out]rpM_APthe maximum value of the comoving distance perpendicular to the line-of-sight, rp,MAX, over all the test cosmologies cosm2
[out]piM_APthe maximum value of the comoving distance parallel to the line-of-sight, πMAX, over all the test cosmologies cosm2
[out]rM_APthe maximum value of the comoving distance over all the test cosmologies cosm2

Definition at line 98 of file FuncCosmology.cpp.

◆ maxwellian_distr()

template<typename T >
T cbl::maxwellian_distr ( const T  vel,
const T  sigma 
)

the Maxwellian distribution

Parameters
velvelocity
sigmaσ
Returns
the Maxwellian distribution, P(vel)

Definition at line 1157 of file Func.h.

◆ MC_Int() [1/3]

double cbl::MC_Int ( double   funcconst double,
const double  x1,
const double  x2,
const int  seed = 3213 
)

simple Monte Carlo integration of f(x)

Parameters
functhe function f(x)
x1minimum limit of the integral
x2maximum limit of the integral
seedthe seed for random number generation
Returns
\(\int_{x1}^{x2} f(x)dx\)

Definition at line 295 of file Func.cpp.

◆ MC_Int() [2/3]

double cbl::MC_Int ( double   funcconst double, const double AA,
const double  AA,
const double  x1,
double  x2,
const int  seed = 3213 
)

simple Monte Carlo integration of f(x,A)

Parameters
functhe function f(x,A)
AAparameter of the function, A
x1minimum limit of the integral
x2maximum limit of the integral
seedthe seed for random number generation
Returns
\(\int_{x1}^{x2} f(x)dx\)

Definition at line 345 of file Func.cpp.

◆ MC_Int() [3/3]

double cbl::MC_Int ( double   funcconst double, const double AA, const double BB, const double CC, const double DD, const double EE,
const double  AA,
const double  BB,
const double  CC,
const double  DD,
const double  EE,
const double  x1,
const double  x2,
const int  seed = 3213 
)

simple Monte Carlo integration of f(x,A,B,C,D,E)

Parameters
functhe function f(x,A,B,C,D,E)
AAparameter of the function, A
BBparameter of the function, B
CCparameter of the function, C
DDparameter of the function, D
EEparameter of the function, E
x1minimum limit of the integral
x2maximum limit of the integral
seedthe seed for random number generation
Returns
\(\int_{x1}^{x2} f(x,A,B,C,D,E)dx\)

Definition at line 395 of file Func.cpp.

◆ measure_var_function()

void cbl::measure_var_function ( const std::vector< double >  var,
const int  bin,
const double  V_min,
const double  V_max,
const double  Volume,
std::vector< double > &  Var,
std::vector< double > &  Phi,
std::vector< double > &  err 
)

measure the var function (where "var" could be the mass, the luminosity, the radius, etc.)

Parameters
[in]varstd::vector containing the set of data
[in]binthe number of bin used
[in]V_minthe minimum value of the range
[in]V_maxthe maximum value of the range
[in]Volumethe volume
[out]Varstd::vector containing the binned values of "var"
[out]Phistd::vector containing the binned values of the var function
[out]errstd::vector containing the Poisson errors

Definition at line 1084 of file Func.cpp.

◆ Min()

template<typename T >
T cbl::Min ( const std::vector< T >  vect)

minimum element of a std::vector

Parameters
vecta std::vector
Returns
the minimum element of the std::vector vect
Examples
model_cosmology.cpp.

Definition at line 1324 of file Kernel.h.

◆ minimum_maximum_indexes()

std::vector< size_t > cbl::minimum_maximum_indexes ( const std::vector< double >  xx,
const double  x_min,
const double  x_max 
)

return the std::vector indexes corresponding to a given interval

Parameters
xxinput std::vector
x_minminimum x value
x_maxmaximum x value
Returns
the 2D std::vector containing the indexes
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 1503 of file Func.cpp.

◆ Moment()

void cbl::Moment ( const std::vector< double >  data,
double &  ave,
double &  adev,
double &  sdev,
double &  var,
double &  skew,
double &  curt 
)

compute the moments of a set of data

Parameters
[in]datathe std::vector containing the input data
[out]avethe mean
[out]adevthe average deviation
[out]sdevthe standard deviation
[out]varthe variance
[out]skewthe skewness
[out]curtthe kurtosis

Definition at line 1058 of file Func.cpp.

◆ multipole_xi0() [1/2]

double cbl::multipole_xi0 ( const double  ss,
const std::vector< double >  rp,
const std::vector< double >  pi,
const std::vector< std::vector< double >>  xi,
const double  delta_s 
)

xi0(s) from ξ(rp,π)

\[ \xi_0(s) = \frac{1}{2}\int_{-1}^1\xi(s,\mu)d\mu \]

Parameters
sscomoving scale where the multipole is computed
rpstd::vector containing the values of rp
pistd::vector containing the values of π
ximatrix containing the values of ξ(r,μ)
delta_sbin size
Returns
xi0(s)

Definition at line 135 of file FuncMultipoles.cpp.

◆ multipole_xi0() [2/2]

double cbl::multipole_xi0 ( const int  indexR,
const std::vector< double >  mu,
const std::vector< std::vector< double >>  xi 
)

xi0(s) from ξ(r,μ)

\[ \xi_0(s) = \frac{1}{2}\int_{-1}^1\xi(s,\mu)d\mu \]

Parameters
indexRindex correspondent to the comoving separation where the multipole is computed
mustd::vector containing the angle between the separation std::vector and the line of sight
ximatrix containing the values of ξ(r,μ)
Returns
xi0(s)

Definition at line 45 of file FuncMultipoles.cpp.

◆ multipole_xi0_model() [1/2]

double cbl::multipole_xi0_model ( const double  beta,
const double  xi_real 
)

the model multipole ξ0 of the two-point correlation function

Parameters
betaβ=f/b, where f is the linear growth rate and b is the bias
xi_realthe real-space two-point correlation function
Returns
the multipole ξ0

Definition at line 353 of file FuncMultipoles.cpp.

◆ multipole_xi0_model() [2/2]

double cbl::multipole_xi0_model ( const double  f_sigma8,
const double  bias_sigma8,
const double  sigma8z,
const double  xi_matter 
)

the model multipole ξ0 of the two-point correlation function

Parameters
f_sigma8f*σ8
bias_sigma8b*σ8
sigma8zσ8
xi_matterthe real-space two-point correlation function of the dark matter
Returns
the multipole ξ0

Definition at line 362 of file FuncMultipoles.cpp.

◆ multipole_xi2() [1/2]

double cbl::multipole_xi2 ( const double  ss,
const std::vector< double >  rp,
const std::vector< double >  pi,
const std::vector< std::vector< double >>  xi,
const double  delta_s 
)

xi2(s) from ξ(rp,π)

\[ \xi_2(s) = \frac{5}{2}\int_{-1}^1\xi(s,\mu)L_2(\mu)d\mu \]

Parameters
sscomoving scale where the multipole is computed
rpstd::vector containing the values of rp
pistd::vector containing the values of π
ximatrix containing the values of ξ(r,μ)
delta_sbin size
Returns
xi2(s)

Definition at line 159 of file FuncMultipoles.cpp.

◆ multipole_xi2() [2/2]

double cbl::multipole_xi2 ( const int  indexR,
const std::vector< double >  mu,
const std::vector< std::vector< double >>  xi 
)

xi2(s) from ξ(r,μ)

\[ \xi_2(s) = \frac{5}{2}\int_{-1}^1\xi(s,\mu)L_2(\mu)d\mu \]

Parameters
indexRindex correspondent to the comoving separation where the multipole is computed
mustd::vector containing the angle between the separation std::vector and the line of sight
ximatrix containing the values of ξ(r,μ)
Returns
xi2(s)

Definition at line 60 of file FuncMultipoles.cpp.

◆ multipole_xi2_model()

double cbl::multipole_xi2_model ( const double  beta,
const double  xi_real,
const double  xi_ 
)

the model multipole ξ2 of the two-point correlation function

Parameters
betaβ=f/b, where f is the linear growth rate and b is the bias
xi_realthe real-space two-point correlation function
xi_\( \overline{\xi}(r) \)
Returns
the multipole ξ2

Definition at line 388 of file FuncMultipoles.cpp.

◆ multipole_xi4() [1/2]

double cbl::multipole_xi4 ( const double  ss,
const std::vector< double >  rp,
const std::vector< double >  pi,
const std::vector< std::vector< double >>  xi,
const double  delta_s 
)

xi4(s) from ξ(rp,π)

\[ \xi_4(s) = \frac{9}{2}\int_{-1}^1\xi(s,\mu)L_4(\mu)d\mu \]

Parameters
sscomoving scale where the multipole is computed
rpstd::vector containing the values of rp
pistd::vector containing the values of π
ximatrix containing the values of ξ(r,μ)
delta_sbin size
Returns
xi4(s)

Definition at line 183 of file FuncMultipoles.cpp.

◆ multipole_xi4() [2/2]

double cbl::multipole_xi4 ( const int  indexR,
const std::vector< double >  mu,
const std::vector< std::vector< double >>  xi 
)

xi4(s) from ξ(r,μ)

\[ \xi_4(s) = \frac{9}{2}\int_{-1}^1\xi(s,\mu)L_4(\mu)d\mu \]

Parameters
indexRindex correspondent to the comoving separation where the multipole is computed
mustd::vector containing the angle between the separation std::vector and the line of sight
ximatrix containing the values of ξ(r,μ)
Returns
xi4(s)

Definition at line 75 of file FuncMultipoles.cpp.

◆ multipole_xi4_model()

double cbl::multipole_xi4_model ( const double  beta,
const double  xi_real,
const double  xi_,
const double  xi__ 
)

the model multipole ξ4 of the two-point correlation function

Parameters
betaβ=f/b, where f is the linear growth rate and b is the bias
xi_realthe real-space two-point correlation function
xi_\( \overline{\xi}(r) \)
xi__\( \overline{\overline{\xi}}(r) \)
Returns
the multipole ξ4

Definition at line 397 of file FuncMultipoles.cpp.

◆ multivariateGaussian()

double cbl::multivariateGaussian ( std::vector< double >  xx,
std::shared_ptr< void >  pars 
)

the multivariate Gaussian function

Parameters
xxthe variable x
parsvector of vectors containing the elements (vectors): pars[0]=mean, pars[1]=&sigma
Returns
the pdf of the multivariate Gaussian

Definition at line 79 of file Func.cpp.

◆ N_different_elements()

template<typename T >
int cbl::N_different_elements ( const std::vector< T >  vect_input)

get the number of unique elements of a std::vector

Parameters
vect_inputthe input std::vector
Returns
the number of unique elements of the input std::vector

Definition at line 1364 of file Kernel.h.

◆ nint()

template<typename T >
int cbl::nint ( const T  val)

the nearest integer

Parameters
vala number
Returns
the integer value nearest to val

Definition at line 915 of file Kernel.h.

◆ number_from_distribution()

double cbl::number_from_distribution ( const std::vector< double >  xx,
const std::vector< double >  fx,
const double  xmin,
const double  xmax,
const int  seed 
)

return a number sampled from a given distribution

Parameters
xxstd::vector containing the x variables
fxstd::vector containing the f(x) variables
xminminimum value of the variable
xmaxmaximum value of the variable
seedrandom seed
Returns
a std::vector containing the numbers extracted from the given distribution
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 1446 of file Func.cpp.

◆ operator*()

std::vector<std::vector<double> > cbl::operator* ( const std::vector< std::vector< double > > &  Mat1,
const std::vector< std::vector< double > > &  Mat2 
)
inline

matrix multiplication

overloading of the * operator used to multiplicate two matrices

Parameters
Mat1STL std::vector of std::vectors, i.e. a matrix
Mat2STL std::vector of std::vectors, i.e. a matrix
Returns
Mat1*Mat2

Definition at line 1922 of file Kernel.h.

◆ operator+()

catalogue::Catalogue cbl::operator+ ( const catalogue::Catalogue c1,
const catalogue::Catalogue c2 
)
inline

overloading of the + operator, to sum two catalogues

Parameters
c1object of class Catalogue
c2object of class Catalogue
Returns
the result of the + operator

Definition at line 58 of file GlobalFunc.h.

◆ P_2()

template<typename T >
T cbl::P_2 ( const T  x)

the Legendre polynomial P2

Parameters
xthe variable x
Returns
P2

Definition at line 1269 of file Func.h.

◆ P_4()

template<typename T >
T cbl::P_4 ( const T  x)

the Legendre polynomial P4

Parameters
xthe variable x
Returns
P4

Definition at line 1280 of file Func.h.

◆ P_6()

template<typename T >
T cbl::P_6 ( const T  x)

the Legendre polynomial P6

Parameters
xthe variable x
Returns
P6

Definition at line 1291 of file Func.h.

◆ perpendicular_distance()

double cbl::perpendicular_distance ( const double  ra1,
const double  ra2,
const double  dec1,
const double  dec2,
const double  d1,
const double  d2 
)

the perpendicular separation, rp

Parameters
ra1the Right Ascension of the first object [radians]
ra2the Right Ascension of the second object [radians]
dec1the Declination of the first object [radians]
dec2the Declination of the second object [radians]
d1the comoving distance of the first object
d2the comoving distance of the second object
Returns
the perpendicular separation, rp

Definition at line 259 of file Func.cpp.

◆ Pk0_Kaiser()

std::vector< double > cbl::Pk0_Kaiser ( const std::vector< double >  kk,
const std::vector< double >  Pk,
const double  bias,
const double  f 
)

function to obtain the linear RSD power spectrum monopole

Parameters
kkthe scales k
Pkthe power spectrum
biasthe bias factor
fthe linear growth factor
Returns
the linear RSD power spectrum monopole

Definition at line 501 of file FuncMultipoles.cpp.

◆ Pk2_Kaiser()

std::vector< double > cbl::Pk2_Kaiser ( const std::vector< double >  kk,
const std::vector< double >  Pk,
const double  bias,
const double  f 
)

function to obtain the linear RSD power spectrum quadrupole

Parameters
kkthe scales k
Pkthe power spectrum
biasthe bias factor
fthe linear growth factor
Returns
the linear RSD power spectrum quadrupole

Definition at line 516 of file FuncMultipoles.cpp.

◆ Pk4_Kaiser()

std::vector< double > cbl::Pk4_Kaiser ( const std::vector< double >  kk,
const std::vector< double >  Pk,
const double  bias,
const double  f 
)

function to obtain the linear RSD power spectrum hexadecapole

Parameters
kkthe scales k
Pkthe power spectrum
biasthe bias factor
fthe linear growth factor
Returns
the linear RSD power spectrum hexadecapole

Definition at line 531 of file FuncMultipoles.cpp.

◆ Pk_from_xi() [1/2]

double cbl::Pk_from_xi ( const double  kk,
const std::string  file,
const int  c1 = 1,
const int  c2 = 2,
const double  r_min = 0.03,
const double  r_max = 100. 
)

the power spectrum computed from the Fourier transform of the two-point correlation function read from a file

Parameters
kkthe wave std::vector, k
filename of the file where the two-point correlation function is stored
c1the column of the file corresponding to the comoving separation, r
c2the column of the file corresponding to the two-point correlation function, ξ(r)
r_minthe minimum value of the comoving separation used in the integral of the Fourier transform
r_maxthe maximum value of the comoving separation used in the integral of the Fourier transform
Returns
the power spectrum, P(k)

Definition at line 160 of file FuncXi.cpp.

◆ Pk_from_xi() [2/2]

double cbl::Pk_from_xi ( const double  kk,
const std::vector< double >  lgrr,
const std::vector< double >  lgxi,
const double  r_min = 0.03,
const double  r_max = 100. 
)

the power spectrum computed from the Fourier transform of the two-point correlation function

Parameters
kkthe wave std::vector, k
lgrrstd::vector containing the logarithm of the comoving separations, log10r
lgxistd::vector containing the logarithm of the two-point correlation function, log10ξ(r)
r_minthe minimum value of the comoving separation used in the integral of the Fourier transform
r_maxthe maximum value of the comoving separation used in the integral of the Fourier transform
Returns
the power spectrum, P(k)

Definition at line 141 of file FuncXi.cpp.

◆ Pkl_Kaiser()

std::vector< std::vector< double > > cbl::Pkl_Kaiser ( const std::vector< int >  orders,
const std::vector< double >  kk,
const std::vector< double >  Pk,
const double  bias,
const double  f 
)

function to obtain Pk multipoles from linear RSD (Kaiser)

Parameters
ordersthe l-th multipole desired
kkthe scales k
Pkthe power spectrum
biasthe bias factor
fthe linear growth factor
Returns
the power spectrum multipoles

Definition at line 546 of file FuncMultipoles.cpp.

◆ Pkl_Kaiser_integral()

double cbl::Pkl_Kaiser_integral ( const int  order,
const double  bias,
const double  f 
)

function to obtain the Kaiser factor

Parameters
orderthe expansion order
biasthe bias factor
fthe linear growth factor
Returns
the Kaiser integral

Definition at line 480 of file FuncMultipoles.cpp.

◆ Pkl_Kaiser_integrand()

double cbl::Pkl_Kaiser_integrand ( const double  mu,
void *  parameters 
)

integrand of the 2d power spectrum to obtain power spectrum multipole

Parameters
muthe value mu
parametersthe parameters for the integration
Returns
the power spectrum multipoles integrand

Definition at line 409 of file FuncMultipoles.cpp.

◆ poisson()

template<typename T >
T cbl::poisson ( xx,
std::shared_ptr< void >  pp,
std::vector< double >  par 
)

the poisson distribution

Parameters
xxthe variable x
ppa void pointer
para std::vector containing the coefficients: par[0]=mean,
Returns
the poisson distribution
Warning
pp is not used, it is necessary only for GSL operations

Definition at line 1143 of file Func.h.

◆ Pol2()

template<typename T >
T cbl::Pol2 ( xx,
std::shared_ptr< void >  pp,
std::vector< double >  par 
)

the quadratic function

Parameters
xxthe variable x
ppa void pointer
para std::vector containing the coefficients
Returns
the quadratic function: par[0]*x2+par[1]*x+par[2]
Warning
pp is not used, it is necessary only for GSL operations

Definition at line 981 of file Func.h.

◆ Pol3()

template<typename T >
T cbl::Pol3 ( xx,
void *  pp,
std::vector< double >  par 
)

the cubic function

Parameters
xxthe variable x
ppa void pointer
para std::vector containing the coefficients
Returns
the cubic function: par[0]*x3+par[1]*x2+par[2]*x+par[3]
Warning
pp is not used, it is necessary only for GSL operations

Definition at line 997 of file Func.h.

◆ polar_coord() [1/2]

void cbl::polar_coord ( const double  XX,
const double  YY,
const double  ZZ,
double &  ra,
double &  dec,
double &  dd 
)

conversion from Cartesian coordinates to polar coordinates

Parameters
[in]XXthe Cartesian coordinate x
[in]YYthe Cartesian coordinate y
[in]ZZthe Cartesian coordinate z
[out]rathe Right Ascension [radians]
[out]decthe Declination [radians]
[out]ddthe comoving distance

Definition at line 214 of file Func.cpp.

◆ polar_coord() [2/2]

void cbl::polar_coord ( const std::vector< double >  XX,
const std::vector< double >  YY,
const std::vector< double >  ZZ,
std::vector< double > &  ra,
std::vector< double > &  dec,
std::vector< double > &  dd 
)

conversion from Cartesian coordinates to polar coordinates used for a set of objects

Parameters
[in]XXstd::vector containing the Cartesian coordinates x
[in]YYstd::vector containing the Cartesian coordinates y
[in]ZZstd::vector containing the Cartesian coordinates z
[out]rastd::vector containing the Right Ascension values [radians]
[out]decstd::vector containing the Declination values [radians]
[out]ddstd::vector containing the comoving distances

Definition at line 228 of file Func.cpp.

◆ powerlaw()

template<typename T >
T cbl::powerlaw ( const T  xx,
const T  x0,
const T  gamma 
)

the power-law function

Parameters
xxthe variable x
x0the normalization, x0
gammathe slope, γ
Returns
the power-law function: (x/x0)γ

Definition at line 1170 of file Func.h.

◆ Print() [1/9]

void cbl::Print ( const std::vector< std::string >  vect)
inline

print the elements of a std::vector of string values on the screen

Parameters
vecta std::vector

Definition at line 1181 of file Kernel.h.

◆ Print() [2/9]

void cbl::Print ( const std::vector< std::string >  vect1,
const std::vector< std::string >  vect2 
)
inline

print the elements of two std::vectors of string values on the screen

Parameters
vect1a std::vector
vect2a std::vector

Definition at line 1218 of file Kernel.h.

◆ Print() [3/9]

void cbl::Print ( const std::vector< std::string >  vect1,
const std::vector< std::string >  vect2,
const std::vector< std::string >  vect3 
)
inline

print the elements of two std::vectors of string values on the screen

Parameters
vect1a std::vector
vect2a std::vector
vect3a std::vector

Definition at line 1266 of file Kernel.h.

◆ Print() [4/9]

void cbl::Print ( const std::vector< std::vector< std::string >>  mat)
inline

print the elements of a matrix of string values on the screen

Parameters
mata matrix (i.e. a std::vector of std::vectors)

Definition at line 1305 of file Kernel.h.

◆ Print() [5/9]

template<typename T >
void cbl::Print ( const std::vector< std::vector< T >>  mat,
const int  prec = 4,
const int  ww = 8 
)

print the elements of a matrix of non string values on the screen

Parameters
mata matrix (i.e. a std::vector of std::vectors)
precdecimal precision
wwnumber of characters to be used as field width

Definition at line 1287 of file Kernel.h.

◆ Print() [6/9]

template<typename T >
void cbl::Print ( const std::vector< T >  vect,
const int  prec = 4,
const int  ww = 8 
)

print the elements of a std::vector of non string values on the screen

Parameters
vecta std::vector
precdecimal precision
wwnumber of characters to be used as field width

Definition at line 1169 of file Kernel.h.

◆ Print() [7/9]

template<typename T >
void cbl::Print ( const std::vector< T >  vect1,
const std::vector< T >  vect2,
const int  prec = 4,
const int  ww = 8 
)

print the elements of a two std::vectors of non string values on the screen

Parameters
vect1a std::vector
vect2a std::vector
precdecimal precision
wwnumber of characters to be used as field width

Definition at line 1198 of file Kernel.h.

◆ Print() [8/9]

template<typename T >
void cbl::Print ( const std::vector< T >  vect1,
const std::vector< T >  vect2,
const std::vector< T >  vect3,
const int  prec = 4,
const int  ww = 8 
)

print the elements of a three std::vectors of non string values on the screen

Parameters
vect1a std::vector
vect2a std::vector
vect3a std::vector
precdecimal precision
wwnumber of characters to be used as field width

Definition at line 1243 of file Kernel.h.

◆ Print() [9/9]

template<typename T >
void cbl::Print ( const T  value,
const int  prec,
const int  ww,
const std::string  header = "",
const std::string  end = "\n",
const bool  use_coutCBL = true,
std::ostream &  stream = std::cout,
const std::string  colour = cbl::par::col_default 
)

function to print values with a proper homegenised format

Parameters
valuethe value print
precdecimal precision
wwnumber of characters to be used as field width
headerstring that is added at the beginning of the line
endstring that is added at the end of the line
use_coutCBLif true, coutCBL is used instead of std::cout
streamobject of class std::ostream
colouroutput colour
Examples
2pt_monopole_errors.cpp, correlated_samples.cpp, minimisation_gsl.cpp, and vectors.cpp.

Definition at line 1142 of file Kernel.h.

◆ quadratic()

std::vector<double> cbl::quadratic ( const double  xx)
inline

quadratic function

Parameters
xxthe coordinate x
Returns
a std::vector containing [1, x, x2]

Definition at line 1020 of file Func.h.

◆ Quartile()

vector< double > cbl::Quartile ( const std::vector< double >  Vect)

the first, second and third quartiles of a std::vector

Parameters
Vectthe input std::vector
Returns
a std::vector containing the first, second and third quartiles

Definition at line 1002 of file Func.cpp.

◆ radial_velocity()

template<typename T >
T cbl::radial_velocity ( const T  vx,
const T  vy,
const T  vz,
const T  ra,
const T  dec 
)

the radial velocity

Parameters
vxthe velocity along the x direction
vythe velocity along the y direction
vzthe velocity along the z direction
rathe Right Ascension
decthe Declination
Returns
the radial velocity

Definition at line 1258 of file Func.h.

◆ radians()

double cbl::radians ( const double  angle,
const CoordinateUnits  inputUnits = CoordinateUnits::_degrees_ 
)

conversion to radians

Parameters
anglethe input angle
inputUnitsthe units of the input angle
Returns
the angle in radians

Definition at line 126 of file Func.cpp.

◆ Radius()

template<typename T >
T cbl::Radius ( const T  Mass,
const T  Rho 
)

the radius of a sphere of a given mass and density

Parameters
Massthe mass
Rhothe density
Returns
the radius

Definition at line 1220 of file Func.h.

◆ read_file() [1/2]

std::vector< std::vector< double > > cbl::read_file ( const std::string  file_name,
const std::string  path_name,
const std::vector< int >  column_data,
const int  skip_nlines = 0 
)

read a data from a file ASCII

Parameters
file_namethe name of the file to read
path_namethe path where the file is stored
column_datavector containing the indices of the columns to read, starting the counting from 1
skip_nlinesthe number of lines to skip
Returns
a vector of vectors containing the columns (first index) and the lines (second index) read from the file
Author
Sofia Contarini
sofia.nosp@m..con.nosp@m.tarin.nosp@m.i3@u.nosp@m.nibo..nosp@m.it

Definition at line 410 of file Kernel.cpp.

◆ read_file() [2/2]

std::vector< std::vector< double > > cbl::read_file ( const std::string  file_name,
const std::string  path_name,
const std::vector< int >  column_data,
const std::string  delimiter,
const char  comment = '#' 
)

read a data from a file ASCII. Useful e.g. when the data are written between comment lines.

Parameters
file_namethe name of the file to read
path_namethe path where the file is stored
column_datavector containing the indices of the columns to read, starting the counting from 0
delimiterthe delimiter between the columns
commentthe comment char at the beginning of the line
Returns
a vector of vectors containing the columns (first index) and the lines (second index) read from the file
Author
Giorgio Lesci
giorg.nosp@m.io.l.nosp@m.esci2.nosp@m.@uni.nosp@m.bo.it

Definition at line 464 of file Kernel.cpp.

◆ read_invert_covariance()

void cbl::read_invert_covariance ( const std::string  filecov,
std::vector< std::vector< double >> &  cov,
std::vector< std::vector< double >> &  cov_inv,
const size_t  i1,
const size_t  i2,
const double  prec = 1.e-10,
const int  Nres = -1 
)

read and invert the covariance matrix

Parameters
[in]filecovinput file where the covariance matrix is stored
[out]covthe covariance matrix
[out]cov_invthe inverse of the covariance matrix
[in]i1mininum index
[in]i2maximum index
[in]precthe precision required
[in]Nres\(N_{res}\), the number of catalogue resamplings used to estimate the covariance matrix; \(N_{res}=-1\) if the covariance matrix has not been estimated with resampling methods
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 1522 of file Func.cpp.

◆ read_matrix()

void cbl::read_matrix ( const std::string  file_matrix,
std::vector< double > &  xx,
std::vector< double > &  yy,
std::vector< std::vector< double >> &  matrix,
const std::vector< int >  col = {} 
)

read a matrix from file

Parameters
[in]file_matrixinput file where the matrix is stored
[out]xxthe variable in row
[out]yythe variable in column
[out]matrixthe matrix
[in]colthe columns to be read
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 612 of file Func.cpp.

◆ read_vector()

void cbl::read_vector ( const std::string  file_vector,
std::vector< double > &  xx,
std::vector< double > &  vector,
const std::vector< int >  col = {} 
)

read a vector from file

Parameters
[in]file_vectorinput file where the vector is stored
[out]xxthe variable
[out]vectorthe vector
[in]colthe columns to be read
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 582 of file Func.cpp.

◆ reconstruction_fourier_space()

void cbl::reconstruction_fourier_space ( const catalogue::Catalogue  data,
const catalogue::Catalogue  random,
const bool  random_RSD,
const cosmology::Cosmology  cosmology,
const double  redshift,
const double  bias,
const double  cell_size,
const double  smoothing_radius,
const int  interpolation_type = 0 
)

compute the non linear displacements of the density field

Parameters
datathe data catalogue
randomthe random catalogue
random_RSDtrue \( \rightarrow \) RSD displacements for the random sample; false no-RSD displacements for the random sample
cosmologythe cosmology
redshiftthe redshift
biasthe bias
cell_sizethe cell size for density field computation
smoothing_radiusthe smoothing radius for density field computation
interpolation_type0 \( \rightarrow \) compute density field using Nearest Grid Point (NGP) method; 0 \( \rightarrow \) compute density field using Cloud-in-cell (CIC) method

Definition at line 45 of file Reconstruction.cpp.

◆ rectangular()

template<typename T >
T cbl::rectangular ( xx,
std::shared_ptr< void >  pp,
std::vector< double >  par 
)

the rectangular distribution

Parameters
xxthe variable x
ppa void pointer
para std::vector containing the coefficients: par[0]=lower limix, par[1]=upper limit;
Returns
the probability of x
Warning
pp is not used, but they are necessary in the function template

Definition at line 1071 of file Func.h.

◆ redshift_range()

void cbl::redshift_range ( const double  mean_redshift,
const double  boxSide,
cosmology::Cosmology real_cosm,
double &  redshift_min,
double &  redshift_max 
)

compute the redsfhit range of a simulation box centered at z=mean_redshift

Parameters
[in]mean_redshiftthe mean redshift
[in]boxSidethe box side
[in]real_cosman object of class Cosmology
[out]redshift_minthe minimum redshift
[out]redshift_maxthe maximum redshift

Definition at line 45 of file Func.cpp.

◆ relative_error_beta()

double cbl::relative_error_beta ( const double  bias,
const double  Volume,
const double  density 
)

estimated relative error on \(\beta=f/b\)

\( \delta\beta/\beta\sim Cb^{0.7}V^{-0.5} \exp\left[n_0/(b^2n)\right] \)

where \(n_0=1.7\times10^{-4} h^3 Mpc^{-3}\) and \(C=4.9\times10^2 h^{-1.5} Mpc^{1.5}\)

see Eq. 20 of Bianchi et al. 2012, http://arxiv.org/abs/1203.1545

Parameters
biasthe linear galaxy bias, b
Volumethe survey volume, V
densitythe galaxy density, n
Returns
\(\delta\beta/\beta\)

Definition at line 1072 of file Func.cpp.

◆ reshape()

template<typename T >
std::vector<std::vector<T> > cbl::reshape ( std::vector< T >  vec,
const int  size1,
const int  size2 
)

reshape a vector into a matrix of given number of rows and columns

Parameters
vecthe input vector
size1the number of rows
size2the number of columns
Returns
the reshaped matrix

Definition at line 1707 of file Kernel.h.

◆ round_to_digits()

double cbl::round_to_digits ( const double  num,
const int  ndigits 
)

reduce the digit figures of an input double

e.g. round(0.2363, 2) = 0.24, round(13.24, 1) = 10

Parameters
numthe input double number
ndigitsthe number of digit figures
Returns
the input number with the required digit figures

Definition at line 133 of file Kernel.cpp.

◆ round_to_precision()

double cbl::round_to_precision ( const double  num,
const int  ndigits 
)

reduce the precision of an input double

e.g. round(0.2363, 2) = 0.23, round(13.24, 1) = 13.2

Parameters
numthe input double number
ndigitsthe number of digit figures
Returns
the input number with the required digit figures

Definition at line 150 of file Kernel.cpp.

◆ sdss2eq()

void cbl::sdss2eq ( const std::vector< double >  lambda,
const std::vector< double >  eta,
std::vector< double > &  ra,
std::vector< double > &  dec 
)

convert sdss coordinates \( \lambda, \eta \) to R.A., Dec.

Parameters
lambdavector containing the \( \lambda \) values
etavector containing the \( \eta \) values
ravector containing R.A. values
decvector containing Dec. values

Definition at line 1397 of file Func.cpp.

◆ sdss_atbound()

void cbl::sdss_atbound ( double &  angle,
const double  minval,
const double  maxval 
)

check if ra coordinate is inside the boundaries

Parameters
anglethe angle
minvalangle lower limit
maxvalangle upper limit

Definition at line 1347 of file Func.cpp.

◆ sdss_atbound2()

void cbl::sdss_atbound2 ( double &  theta,
double &  phi 
)

set the angular coordinates in the SDSS boundaries

Parameters
thetathe first angular coordinate
phithe second angular coordinate

Definition at line 1356 of file Func.cpp.

◆ sdss_stripe()

void cbl::sdss_stripe ( const std::vector< double >  eta,
const std::vector< double >  lambda,
std::vector< int > &  stripe,
std::vector< int > &  str_u 
)

compute the SDSS stripe given SDSS coordinates \( \lambda, \eta \)

Parameters
etavector containing the \( \eta \) values
lambdavector containing the \( \lambda \) values
stripevector containing the stripe value
str_uvector containing the list of stripes

Definition at line 1420 of file Func.cpp.

◆ set_EnvVar()

void cbl::set_EnvVar ( const std::vector< std::string >  Var)

set evironment variables

Parameters
Varstd::vector containing the evironment variables to be set

Definition at line 186 of file Kernel.cpp.

◆ set_ObjectRegion_mangle() [1/2]

void cbl::set_ObjectRegion_mangle ( catalogue::Catalogue data,
catalogue::Catalogue random,
const int  nSamples,
const std::string  polygonfile 
)

set the object region in sub-regions using mangle

Parameters
datainput data catalogue
randomrandom catalogue
nSamplesnumber of sub-regions
polygonfilename of the input file with polygons

Definition at line 387 of file SubSample.cpp.

◆ set_ObjectRegion_mangle() [2/2]

void cbl::set_ObjectRegion_mangle ( catalogue::Catalogue data,
const int  nSamples,
const std::string  polygonfile 
)

set the object region in sub-regions using mangle

Parameters
datainput data catalogue
nSamplesnumber of sub-regions
polygonfilename of the input file with polygons

Definition at line 268 of file SubSample.cpp.

◆ set_ObjectRegion_RaDec() [1/2]

void cbl::set_ObjectRegion_RaDec ( catalogue::Catalogue data,
catalogue::Catalogue random,
const int  nCells_Ra,
const int  nCells_Dec,
const bool  use_colatitude = true 
)

set the object region in angular SubBoxes

Parameters
datainput data catalogue
randomrandom catalogue
nCells_Rathe number of cells along the R.A. direction
nCells_Decthe number of cells along the Dec. direction
use_colatitudeconvert declination to colatitude. This allows a contigous pixelization. Default is true. Set to false if you sample already uses colatitude
Warning
The cell area is:

\[ S \, = \Delta \alpha \left(cos(\delta_{max})-\cos(\delta_{min})\right) \]

with \(\alpha\) the right ascension and \(\delta\) the declination. The area discretization is done w.r.t. the right ascension and the cosine of the declination. This implies that the number of cells in the declination axis will not correspond to a constant spacing in \(\delta\).

Definition at line 541 of file SubSample.cpp.

◆ set_ObjectRegion_RaDec() [2/2]

void cbl::set_ObjectRegion_RaDec ( catalogue::Catalogue data,
const int  nCells_Ra,
const int  nCells_Dec,
const bool  use_colatitude = true 
)

set the object region in angular SubBoxes

Parameters
datainput data catalogue
nCells_Rathe number of cells along the R.A. direction
nCells_Decthe number of cells along the Dec. direction
use_colatitudeconvert declination to colatitude. This allows a contigous pixelization. Default is true. Set to false if you sample already uses colatitude
Warning
The cell area is:

\[ S \, = \Delta \alpha \left(cos(\delta_{max})-\cos(\delta_{min})\right) \]

with \(\alpha\) the right ascension and \(\delta\) the declination. The area discretization is done w.r.t. the right ascension and the cosine of the declination. This implies that the number of cells in the declination axis will not correspond to a constant spacing in \(\delta\).
Examples
numberCounts_errors.cpp, and power_spectrum_angular.cpp.

Definition at line 498 of file SubSample.cpp.

◆ set_ObjectRegion_SDSS_stripes()

void cbl::set_ObjectRegion_SDSS_stripes ( catalogue::Catalogue data,
catalogue::Catalogue random 
)

set the object region in SDSS stripes

Parameters
datainput data catalogue
randomrandom catalogue

Definition at line 672 of file SubSample.cpp.

◆ set_ObjectRegion_SubBoxes() [1/2]

void cbl::set_ObjectRegion_SubBoxes ( catalogue::Catalogue data,
catalogue::Catalogue random,
const int  nx,
const int  ny,
const int  nz 
)

set the object region in sub-boxes

Parameters
datainput data catalogue
randomrandom catalogue
nxside fraction used to divide the box in the x direction
nyside fraction used to divide the box in the y direction
nzside fraction used to divide the box in the z direction

Definition at line 338 of file SubSample.cpp.

◆ set_ObjectRegion_SubBoxes() [2/2]

void cbl::set_ObjectRegion_SubBoxes ( catalogue::Catalogue data,
const int  nx,
const int  ny,
const int  nz 
)

set the object region in sub-boxes

Parameters
datainput data catalogue
nxside fraction used to divide the box in the x direction
nyside fraction used to divide the box in the y direction
nzside fraction used to divide the box in the z direction
Examples
2pt_monopole_errors.cpp, and 3pt.cpp.

Definition at line 236 of file SubSample.cpp.

◆ set_ObjectRegion_Tiles_Redshift()

void cbl::set_ObjectRegion_Tiles_Redshift ( catalogue::Catalogue data,
catalogue::Catalogue random,
const int  nz 
)

set data and random objects' regions given R.A.-Dec tiles and a number of redshift sub-samples. The user must set the identification number of the tiles (cbl::catalogue::Var::_Region_), with cbl::catalogue::Catalogue::set_region(), both in the input data catalogue and in the random catalogue.

Author
Giorgio Lesci (giorg.nosp@m.io.l.nosp@m.esci2.nosp@m.@uni.nosp@m.bo.it)
Parameters
datainput data catalogue
randomrandom catalogue
nznumber of redshift sub-samples

Definition at line 44 of file SubSample.cpp.

◆ sgn()

template<typename T >
double cbl::sgn ( val)

sgn the sign function

Parameters
valthe input value
Returns
the sign value

Definition at line 2227 of file Func.cpp.

◆ ShortSwap()

short cbl::ShortSwap ( const short  s)

endian conversion of a short variable

Parameters
sa short variable
Returns
the converted variable s

Definition at line 45 of file Kernel.cpp.

◆ Sigma() [1/2]

double cbl::Sigma ( const std::vector< double >  vect)

the standard deviation of a std::vector

for the derivation of the formulae used here for numerically stable calculation see Chan et al. 1979, Finch 2009 and reference therein

Parameters
vectthe input std::vector
Returns
σ
Examples
correlated_samples.cpp.

Definition at line 925 of file Func.cpp.

◆ Sigma() [2/2]

double cbl::Sigma ( const std::vector< double >  vect,
const std::vector< double >  weight 
)

the weighted standard deviation of a std::vector

for the derivation of the formulae used here for numerically stable calculation see Chan et al. 1979, Finch 2009 and reference therein

Parameters
vectthe input std::vector
weightthe weight
Returns
σ

Definition at line 963 of file Func.cpp.

◆ sigma2_integrand()

double cbl::sigma2_integrand ( const double  mu,
void *  parameters 
)

integrand of the 2d power spectrum to obtain sigma^2(k)

Parameters
muthe value mu
parametersthe parameters for the integration
Returns
the sigma2 integrand

Definition at line 446 of file FuncMultipoles.cpp.

◆ sigma2_k()

std::vector< std::vector< double > > cbl::sigma2_k ( const double  nObjects,
const double  Volume,
const std::vector< double >  kk,
const std::vector< std::vector< double >>  Pk_multipoles,
const std::vector< int >  orders 
)

multipole expansion of the per-mode covariance sigma2_k (see Grieb et al. 2016, eq. 15 https://arxiv.org/pdf/1509.04293)

\[ \sigma_{\ell_{1} \ell_{2}}^{2}(k) \equiv \frac{\left(2 \ell_{1}+1\right)\left(2 \ell_{2}+1\right)}{V_{\mathrm{s}}} \times \int_{-1}^{1}\left[P(k, \mu)+\frac{1}{\bar{n}}\right]^{2} \mathcal{L}_{\ell_{1}}(\mu) \mathcal{L}_{\ell_{2}}(\mu) \mathrm{d} \mu \]

where \(P(k, \mu)\) is the polar power spectrum computed from input power spectrum multipoles and \(\mathcal{L}\) are the Legendre polynomials.

Parameters
nObjectsnumber of objects in the sample
Volumethe sample volume
kkthe scales kk
Pk_multipolesthe power spectrum multipoles
ordersthe power spectrum multipoles orders
Returns
the sigma2_k (see i.e. Grieb et al. 2016, eq. 15)

Definition at line 944 of file FuncMultipoles.cpp.

◆ sigmaR()

double cbl::sigmaR ( const double  RR,
const int  corrType,
const std::vector< double >  rr,
const std::vector< double >  corr 
)

the rms mass fluctuation within a given radius

computed with the spherically averaged correlation function as follows:

\[ \sigma_R^2=\int_0^2dy\,y^2\xi(yR)\left(3-\frac{9y}{4}+\frac{3y^3}{16}\right) \]

or with the projected correlation function as follows:

\[ \sigma_R^2=\frac{1}{R^3}\int_0^\infty dr_p\,r_pw_p(r_p)g(r_p/R) \]

where g(x) is:

\[ \left\{ \begin{array}{ll} \frac{1}{2\pi}\left(3\pi-9x+x^3\right) & \mbox{for}\,x\le2 \\ \frac{1}{2\pi}\left(\frac{-x^4+11x^2-28}{\sqrt{x^2-4}}+x^3-9x+6\sin^{-1}(2/x)\right) & \mbox{for}\,x>2 \\ \end{array} \right. \]

see e.g. Zehavi et al. 2005, ApJ, 621, 22

Parameters
RRthe radius R [Mpc/h]
corrType1 → the spherically averaged correlation function is used; 2 → the projected correlation function is used
rrstd::vector containing comoving separations
corrstd::vector containing the two-point correlation function
Returns
σR: the rms mass fluctuation within a radius R [Mpc/h]

Definition at line 227 of file FuncXi.cpp.

◆ slice()

template<typename T >
std::vector<T> cbl::slice ( const std::vector< T >  v,
const int  start = 0,
const int  end = -1 
)

slice a std::vector from start to stop

Parameters
voriginal std::vector
startstarting position
endending position
Returns
the sliced std::vector

Definition at line 1947 of file Kernel.h.

◆ sort_2vectors()

void cbl::sort_2vectors ( std::vector< double >::iterator  p1,
std::vector< double >::iterator  p2,
const int  dim 
)

sort the elements of a std::vectors, and the elements of a second std::vector according to the first sorting

Parameters
p1iterator to the first std::vector
p2iterator to the second std::vector
dimdimension of the two std::vectors

Definition at line 323 of file Kernel.cpp.

◆ sort_3vectors()

void cbl::sort_3vectors ( std::vector< double >::iterator  p1,
std::vector< double >::iterator  p2,
std::vector< double >::iterator  p3,
const int  dim 
)

sort the elements of a std::vectors, and the elements of two other std::vectors according to the first sorting

Parameters
p1iterator to the first std::vector
p2iterator to the second std::vector
p3iterator to the third std::vector
dimdimension of the three std::vectors

Definition at line 341 of file Kernel.cpp.

◆ sort_4vectors()

void cbl::sort_4vectors ( std::vector< double >::iterator  p1,
std::vector< double >::iterator  p2,
std::vector< double >::iterator  p3,
std::vector< double >::iterator  p4,
const int  dim 
)

sort the elements of a std::vectors, and the elements of three other std::vectors according to the first sorting

Parameters
p1iterator to the first std::vector
p2iterator to the second std::vector
p3iterator to the third std::vector
p4iterator to the four std::vector
dimdimension of the four std::vectors

Definition at line 359 of file Kernel.cpp.

◆ spherical_harmonics() [1/2]

complex< double > cbl::spherical_harmonics ( cbl::CoordinateType  coordinate_type,
const int  l,
const int  m,
const double  coord1,
const double  coord2,
const double  coord3 
)

the order l, degree m spherical harmonics

Parameters
coordinate_typethe coordinate type (comoving, observed)
lthe degree l
mthe order m
coord1the variable 1 (xx or RA)
coord2the variable 2 (yy or Dec)
coord3the variable 3 (zz or redshift)
Returns
the order l, degree m spherical harmonics

Definition at line 1939 of file Func.cpp.

◆ spherical_harmonics() [2/2]

std::vector< std::vector< complex< double > > > cbl::spherical_harmonics ( const int  lmax,
const double  xx,
const double  yy,
const double  zz 
)

the spherical harmonics up to \(l_{max}\)

Parameters
lmaxthe maximum degree l
xxthe variable x
yythe variable y
zzthe variable z
Returns
the spherical harmonics up to \(l_{max}\)

Definition at line 1973 of file Func.cpp.

◆ spherical_harmonics_array()

std::vector< std::complex< double > > cbl::spherical_harmonics_array ( const int  lmax,
const double  xx,
const double  yy,
const double  zz 
)

the spherical harmonics up to \(l_{max}\)

Parameters
lmaxthe maximum degree l
xxthe variable x
yythe variable y
zzthe variable z
Returns
the spherical harmonics up to \(l_{max}\)

Definition at line 2009 of file Func.cpp.

◆ SubMatrix()

template<typename T >
void cbl::SubMatrix ( std::vector< T > &  xx,
std::vector< T > &  yy,
std::vector< std::vector< T > > &  Mat,
val 
)

select a submatrix containing lines and columns with all elements major than val

Warning
this function works only with rectangular matrices and only for a small set of specific cases: use it with care and check carefully the results!
Parameters
[in,out]xxthe std::vector x
[in,out]yythe std::vector y
[in,out]Matthe matrix Mat(x,y) (i.e. a std::vector of std::vectors)
[in]vala number

Definition at line 1461 of file Kernel.h.

◆ three_spherical_bessel_integral()

double cbl::three_spherical_bessel_integral ( const double  r1,
const double  r2,
const double  r3,
const int  L1,
const int  L2,
const int  L3 
)

compute the integral of three spherical bessel function, from Mehrem (2011)

\[ \int_{0}^{\infty} k^{2} j_{L_{1}}\left(k r_{1}\right) j_{L_{2}}\left(k r_{2}\right) j_{L_{3}}\left(k r_{3}\right) d k = \frac{\pi \beta(\Delta)}{8 \pi^2 r_{1} r_{2} r_{3} \left\langle L_{1} L_{2} 00 | L_{3} 0\right\rangle}(i)^{L_{1}+L_{2}+L_{3}} \left(2 L_{3}+1\right)\left(\frac{r_{1}}{r_{3}}\right)^{L_{3}} \sum_{L=0}^{L_{3}}\left(\begin{array}{c}{2 L_{3}} \\ {2 L}\end{array}\right)^{1 / 2}\left(\frac{r_{2}}{r_{1}}\right)^{L} \times \sum_{l}\left\langle L_{1}\left(L_{3}-L\right) 00 | 0\right\rangle \left\langle L_{2} L 00 | l 0\right\rangle\left\{\begin{array}{lll}{L_{1}} & {L_{2}} & {L_{3}} \\ {L} & {L_{3}-L} & {l}\end{array}\right\} P_{l}(\Delta) \]

where \(\sum_{l}\left\langle l_1 l_2 m_1 m_2 | l_3 m_3 \right\rangle\) is the Clebsh-Gordan coefficient, computed by cbl::clebsh_gordan, and \(\left\{\begin{array}{lll}{L_{1}} & {L_{2}} & {L_{3}} \\ {L} & {L_{3}-L} & {l}\end{array}\right\}\) is the \(6-j\) Wigner symbol.

Parameters
r1
r2
r3
L1the order of the first spherical bessel function
L2the order of the second spherical bessel function
L3the order of the third spherical bessel function
Returns
the integral of three spherical bessel function

Definition at line 2554 of file Func.cpp.

◆ TopHat_WF()

template<typename T >
T cbl::TopHat_WF ( const T  kR)

the top-hat window function

Parameters
kRthe variable k*R
Returns
the top-hat window function

Definition at line 1195 of file Func.h.

◆ TopHat_WF_D1()

template<typename T >
T cbl::TopHat_WF_D1 ( const T  kR)

the derivative of the top-hat window function

Parameters
kRthe variable k*R
Returns
the derivative of the top-hat window function

Definition at line 1208 of file Func.h.

◆ transpose()

template<typename T >
std::vector<std::vector<T> > cbl::transpose ( std::vector< std::vector< T >>  matrix)

transpose a matrix

Parameters
matrixthe input matrix
Returns
the transposed matrix
Examples
correlated_samples.cpp.

Definition at line 1729 of file Kernel.h.

◆ trapezoid_integration()

double cbl::trapezoid_integration ( const std::vector< double >  xx,
const std::vector< double >  yy 
)

integral, computed with the trapezoid rule, using ordered data

Parameters
xxthe point in which function is defined
yyvalues of the function
Returns
the definite integral of the function

Definition at line 2203 of file Func.cpp.

◆ unique_unsorted() [1/3]

void cbl::unique_unsorted ( std::vector< double > &  vv)

erase all the equal elements of the input std::vector

Parameters
[in,out]vva std::vector of double values

Definition at line 296 of file Kernel.cpp.

◆ unique_unsorted() [2/3]

void cbl::unique_unsorted ( std::vector< int > &  vv)

erase all the equal elements of the input std::vector

Parameters
[in,out]vva std::vector of integer values

Definition at line 284 of file Kernel.cpp.

◆ unique_unsorted() [3/3]

void cbl::unique_unsorted ( std::vector< std::string > &  vv)

erase all the equal elements of the input std::vector

Parameters
[in,out]vva std::vector of integer values

Definition at line 308 of file Kernel.cpp.

◆ used_memory()

int cbl::used_memory ( const int  type)

get the memory used by current process in kB

Warning
this function works only on Linux systems
Parameters
type1 \(\rightarrow\) Physical Memory (RAM); 2 \(\rightarrow\) Virtual Memory
Returns
the Physical (RAM) or Virtual Memory used by current process in kB

Definition at line 211 of file Kernel.cpp.

◆ v_M_vt()

template<typename T >
T cbl::v_M_vt ( const std::vector< T >  vv,
const std::vector< std::vector< T >>  MM 
)

return the value of

\[ \vec{x} M \vec{x}^T \]

Parameters
[in]vvthe std::vector v
[in]MMthe matrix M
Returns
result

Definition at line 1833 of file Kernel.h.

◆ vector_from_distribution()

std::vector< double > cbl::vector_from_distribution ( const int  nRan,
const std::vector< double >  xx,
const std::vector< double >  fx,
const double  xmin,
const double  xmax,
const int  seed 
)

return a std::vector of numbers sampled from a given distribution

Parameters
nRannumber of elements to be extracted
xxstd::vector containing the x variables
fxstd::vector containing the f(x) variables
xminminimum value of the variable
xmaxmaximum value of the variable
seedrandom seed
Returns
a std::vector containing the numbers extracted from the given distribution
Author
Alfonso Veropalumbo
alfon.nosp@m.so.v.nosp@m.eropa.nosp@m.lumb.nosp@m.o@uni.nosp@m.bo.i.nosp@m.t

Definition at line 1455 of file Func.cpp.

◆ vectorReadFromBinary()

template<typename T >
void cbl::vectorReadFromBinary ( std::ifstream &  fin,
std::vector< T > &  vec,
size_t  NN 
)

reads a vector from a binary file

Parameters
fininput stream
vecthe vector container where data will be stored
NNthe number of elements to be read
Author
Tommaso Ronconi
tronc.nosp@m.oni@.nosp@m.sissa.nosp@m..it

Definition at line 867 of file Func.h.

◆ Vmax_DC_distribution()

void cbl::Vmax_DC_distribution ( std::vector< double > &  dc,
std::vector< double > &  nObj,
const std::vector< double >  D_C,
const std::vector< double >  zobj_min,
const std::vector< double >  zobj_max,
const double  z_min,
const double  z_max,
const double  zbin_min,
const double  zbin_max,
cosmology::Cosmology cosm,
const double  Area,
const int  nObjRan,
const bool  norm = 1,
const std::string  file_Vmax = par::defaultString,
const double  delta_dc_Vmax = 100.,
const int  seed = 3213 
)

get a smoothed distribution of comoving distances, estimated with the Vmax method

this function is useful to construct random catalogues

Parameters
[out]dcdc: vector containing the output values of the binned comoving distances
[out]nObjvector containing the smoothed number of objects at each dc, estimated with the Vmax method
[in]D_Cvector containing the comoving distances of the objects
[in]zobj_minminimum redshift of the objects
[in]zobj_maxmaximum redshift of the objects
[in]z_minminimum redshift used to enlarge the range, useful to smooth the redshift distributions
[in]z_maxmaximum redshift used to enlarge the range, useful to smooth the redshift distributions
[in]zbin_minminimum redshift of the output binning
[in]zbin_maxmaximum redshift of the output binning
[in]cosmobject of class Cosmology
[in]Areaarea of the survey
[in]nObjRannumber of random objects used to assess the smoothed distribution
[in]norm0 → don't normalize; 1 → normalize the distribution to the number of objects
[in]file_Vmaxthe output file used to store the smoothed distribution
[in]delta_dc_VmaxΔdc: the bin size of the output smoothed distribution
[in]seedthe random seed

Definition at line 44 of file FuncCosmology.cpp.

◆ volume()

double cbl::volume ( const double  boxSize,
const int  frac,
const double  Bord,
const double  mean_redshift,
cosmology::Cosmology real_cosm 
)

get the volume of a simulation box

Parameters
boxSizethe box side
fracthe side fraction (if the input box is a sub-box of a box with side equal to boxSize)
Bordthe redshift interval that is cutted at the bords of the box
mean_redshiftthe mean redshift
real_cosman object of class Cosmology
Returns
the volume of the simulation

Definition at line 78 of file Func.cpp.

◆ volume_sphere()

template<typename T >
T cbl::volume_sphere ( const T  RR)

the volume of a sphere of a given radius

Parameters
RRthe radius
Returns
the volume

Definition at line 1231 of file Func.h.

◆ WarningMsgCBL()

void cbl::WarningMsgCBL ( const std::string  msg,
const std::string  functionCBL,
const std::string  fileCBL 
)
inline

internal CBL warning message

Parameters
msgstd::string containing the warning message
functionCBLthe CBL function in which the warning message is called
fileCBLthe CBL file containing the function in which the warning message is called

Definition at line 747 of file Kernel.h.

◆ wigner3j() [1/2]

double cbl::wigner3j ( double  l1,
double  l2,
double  l3,
double  m1,
double  m2,
double  m3 
)

Wigner \(3-j\) symbol.

Parameters
l1index
l2index
l3index
m1index
m2index
m3index
Returns
the Clebsh-Gordan coefficient

Definition at line 2464 of file Func.cpp.

◆ wigner3j() [2/2]

std::vector< double > cbl::wigner3j ( double  l2,
double  l3,
double  m1,
double  m2,
double  m3 
)

Wigner \(3-j\) symbol.

Parameters
l2index
l3index
m1index
m2index
m3index
Returns
the Clebsh-Gordan coefficient

Definition at line 2267 of file Func.cpp.

◆ wigner3j_auxA()

double cbl::wigner3j_auxA ( double  l1,
double  l2,
double  l3,
double  m1,
double  m2,
double  m3 
)

Wigner \(3-j\) auxiliar function A.

Parameters
l1index
l2index
l3index
m1index
m2index
m3index
Returns
value used in wigner_3j

Definition at line 2240 of file Func.cpp.

◆ wigner3j_auxB()

double cbl::wigner3j_auxB ( double  l1,
double  l2,
double  l3,
double  m1,
double  m2,
double  m3 
)

Wigner \(3-j\) auxiliar function B.

Parameters
l1index
l2index
l3index
m1index
m2index
m3index
Returns
value used in wigner_3j

Definition at line 2253 of file Func.cpp.

◆ wigner_3j()

double cbl::wigner_3j ( int  j1,
int  j2,
int  j3,
int  m1,
int  m2,
int  m3 
)

Wigner \(3-j\) symbol, use it for l<100.

Parameters
j1index
j2index
j3index
m1index
m2index
m3index
Returns
the Clebsh-Gordan coefficient

Definition at line 2493 of file Func.cpp.

◆ wigner_6j()

double cbl::wigner_6j ( const int  j1,
const int  j2,
const int  j3,
const int  j4,
const int  j5,
const int  j6 
)

Wigner \(6-j\) symbol.

Parameters
j1index
j2index
j3index
j4index
j5index
j6index
Returns
the Clebsh-Gordan coefficient

Definition at line 2502 of file Func.cpp.

◆ window_function()

double cbl::window_function ( const double  x,
const double  min = -1,
const double  max = 1 
)

the unnormalized window function

Parameters
xthe function variable
minwindow function minimum
maxwindof function maximum
Returns
unnormalized window function

Definition at line 2538 of file Func.cpp.

◆ wp() [1/2]

double cbl::wp ( const double  rp,
const std::string  file,
const double  r_max = 100. 
)

the projected two-point correlation function

this function estimates the projected correlation function by integrating a given two-point correlation function as follows:

\[ w_p(r_p)=\int_{r_p}^{r_{max}}\frac{\xi(r)}{\sqrt{r^2-r_p^2}}rdr \]

the two-point correlation function is read from a file

Parameters
rprp: comoving separation perpendicular to the line-of-sight
filename of the file where the two-point correlation function is stored
r_maxthe maximum value of the comoving separation used in the integral
Returns
the projected correlation function, wp(rp)

Definition at line 207 of file FuncXi.cpp.

◆ wp() [2/2]

double cbl::wp ( const double  rp,
const std::vector< double >  rr,
const std::vector< double >  xi,
const double  r_max = 100. 
)

the projected two-point correlation function

this function estimates the projected correlation function by integrating a given two-point correlation function as follows:

\[ w_p(r_p)=2\int_{r_p}^{r_{max}}\frac{\xi(r)}{\sqrt{r^2-r_p^2}}r{\rm d}r \]

Parameters
rprp: comoving separation perpendicular to the line-of-sight
rrstd::vector containing the central values of the binned comoving separations, r
xistd::vector containing the central values of the binned two-point correlation function, ξ(r)
r_maxthe maximum value of the comoving separation used in the integral
Returns
the projected correlation function, w(rp)

Definition at line 192 of file FuncXi.cpp.

◆ Xi0()

std::vector< double > cbl::Xi0 ( const std::vector< double >  r,
const std::vector< double >  kk,
const std::vector< double >  Pk0,
const double  k_cut = 0.7,
const double  cut_pow = 2,
const int  IntegrationMethod = 1 
)

function to obtain the two point correlation funciton monopole

Parameters
rthe scales r
kkthe scales k
Pk0the power spectrum monopole
k_cutthe k scale to cut the integrand
cut_powthe power of the integrand cut
IntegrationMethodmethod for integration
Returns
the linear RSD power spectrum monopole

Definition at line 569 of file FuncMultipoles.cpp.

◆ Xi024_AP() [1/2]

std::vector< std::vector< double > > cbl::Xi024_AP ( const double  alpha_perpendicular,
const double  alpha_parallel,
const std::vector< double >  rr,
const std::shared_ptr< glob::FuncGrid xi0_interp,
const std::shared_ptr< glob::FuncGrid xi2_interp,
const std::shared_ptr< glob::FuncGrid xi4_interp 
)

function to obtain the monopole, quadrupole and hexadecapole of the two-point correlation function

Parameters
alpha_perpendicularthe shift along the line of sight
alpha_parallelthe shift parallel to the line of sight
rrthe scales r
xi0_interpthe xi0 interpolator
xi2_interpthe xi2 interpolator
xi4_interpthe xi4 interpolator
Returns
the monopole, quadrupole and hexadecapole of the two point correlation function

Definition at line 772 of file FuncMultipoles.cpp.

◆ Xi024_AP() [2/2]

std::vector< std::vector< double > > cbl::Xi024_AP ( const double  alpha_perpendicular,
const double  alpha_parallel,
const std::vector< double >  rr,
const std::vector< double >  rl,
const std::vector< double >  Xi0,
const std::vector< double >  Xi2,
const std::vector< double >  Xi4 
)

function to obtain the monopole, quadrupole and hexadecapole of the two-point correlation function

Parameters
alpha_perpendicularthe shift along the line of sight
alpha_parallelthe shift parallel to the line of sight
rrthe scales r
rlthe scales at which the multipoles are defined
Xi0the 2pfc monopole
Xi2the 2pfc quadrupole
Xi4the 2pfc hexadecapole
Returns
the monopole, quadrupole and hexadecapole of the two point correlation function

Definition at line 853 of file FuncMultipoles.cpp.

◆ Xi02_AP() [1/2]

std::vector< std::vector< double > > cbl::Xi02_AP ( const double  alpha_perpendicular,
const double  alpha_parallel,
const std::vector< double >  rr,
const std::shared_ptr< glob::FuncGrid xi0_interp,
const std::shared_ptr< glob::FuncGrid xi2_interp 
)

function to obtain the monopole and quadrupole of the two point correlation function

Parameters
alpha_perpendicularthe shift along the line of sight
alpha_parallelthe shift parallel to the line of sight
rrthe scales r
xi0_interpthe xi0 interpolator
xi2_interpthe xi2 interpolator
Returns
the monopole and quadrupole of the two point correlation function

Definition at line 736 of file FuncMultipoles.cpp.

◆ Xi02_AP() [2/2]

std::vector< std::vector< double > > cbl::Xi02_AP ( const double  alpha_perpendicular,
const double  alpha_parallel,
const std::vector< double >  rr,
const std::vector< double >  rl,
const std::vector< double >  Xi0,
const std::vector< double >  Xi2 
)

function to obtain the monopole and quadrupole of the two point correlation function

Parameters
alpha_perpendicularthe shift along the line of sight
alpha_parallelthe shift parallel to the line of sight
rrthe scales r
rlthe scales at which the multipoles are defined
Xi0the 2pfc monopole
Xi2the 2pfc quadrupole
Returns
the monopole and quadrupole of the two point correlation function

Definition at line 811 of file FuncMultipoles.cpp.

◆ Xi2()

std::vector< double > cbl::Xi2 ( const std::vector< double >  rr,
const std::vector< double >  kk,
const std::vector< double >  Pk2,
const double  k_cut = 0.58,
const double  cut_pow = 4,
const int  IntegrationMethod = 1 
)

function to obtain the two point correlation function quadrupole

Parameters
rrthe scales r
kkthe scales k
Pk2the power spectrum quadrupole
k_cutthe k scale to cut the integrand
cut_powthe power of the integrand cut
IntegrationMethodmethod for integration
Returns
the linear RSD power spectrum quadrupole

Definition at line 624 of file FuncMultipoles.cpp.

◆ xi2D_lin_model() [1/3]

double cbl::xi2D_lin_model ( const double  beta,
const double  bias,
const double  xi_real,
const double  xi_,
const double  xi__,
const double  P_2,
const double  P_4 
)

the linear dispersion model for ξ(rp,π)

Parameters
betaβ=f/b, where f is the linear growth rate and b is the bias
biasthe bias
xi_realthe real-space correlation function
xi_\( \overline{\xi}(r) \)
xi__\( \overline{\overline{\xi}}(r) \)
P_2the Legendre polynomial P2
P_4the Legendre polynomial P4
Returns
ξ(rp,π)

Definition at line 473 of file FuncXi.cpp.

◆ xi2D_lin_model() [2/3]

double cbl::xi2D_lin_model ( const double  rp,
const double  pi,
const double  beta,
const double  bias,
const std::shared_ptr< void >  funcXiR,
const std::shared_ptr< void >  funcXiR_,
const std::shared_ptr< void >  funcXiR__,
const bool  bias_nl = 0,
const double  bA = 0. 
)

the linear dispersion model for ξ(rp,π)

Parameters
rprp: comoving separation perpendicular to the line-of-sight
piπ: comoving separation parallel to the line-of-sight
betaβ=f/b, where f is the linear growth rate and b is the bias
biasthe bias
funcXiRpointer to an object of type FuncGrid, to interpolate on \( \xi(r) \)
funcXiR_pointer to an object of type FuncGrid, to interpolate on \( \overline{\xi}(r) \)
funcXiR__pointer to an object of type FuncGrid, to interpolate on \( \overline{\overline{\xi}} (r) \)
bias_nl0 \( \rightarrow \) linear bias; \( \rightarrow \) 1 non-linear bias
bAthe parameter bA used to model the bias
Returns
ξ(rp,π)

Definition at line 664 of file FuncXi.cpp.

◆ xi2D_lin_model() [3/3]

double cbl::xi2D_lin_model ( const double  rp,
const double  pi,
const double  beta,
const double  bias,
const std::vector< double >  rad_real,
const std::vector< double >  xi_real,
const std::vector< double >  xi_,
const std::vector< double >  xi__,
const int  index = -1,
const bool  bias_nl = 0,
const double  bA = 0. 
)

the linear dispersion model for ξ(rp,π)

Parameters
rprp: comoving separation perpendicular to the line-of-sight
piπ: comoving separation parallel to the line-of-sight
betaβ=f/b, where f is the linear growth rate and b is the bias
biasthe bias
rad_realstd::vector containing the binnend values of the comoving separations
xi_realstd::vector containing the binnend values of the real-space correlation function
xi_std::vector containing the binnend values of \( \overline{\xi}(r) \)
xi__std::vector containing the binnend values of \( \overline{\overline{\xi}}(r) \)
indexindex for internal use
bias_nl0 \( \rightarrow \) linear bias; \( \rightarrow \) 1 non-linear bias
bAthe parameter bA used to model the bias
Returns
ξ(rp,π)

Definition at line 491 of file FuncXi.cpp.

◆ xi2D_model() [1/2]

double cbl::xi2D_model ( const double  rp,
const double  pi,
const double  beta,
const double  bias,
const double  sigmav,
const std::shared_ptr< void >  funcXiR,
const std::shared_ptr< void >  funcXiR_,
const std::shared_ptr< void >  funcXiR__,
const double  var,
const int  FV,
const bool  bias_nl = 0,
const double  bA = 0.,
const double  v_min = -3000.,
const double  v_max = 3000.,
const int  step_v = 500 
)

the non-linear dispersion model for ξ(rp,π)

Parameters
rprp: comoving separation perpendicular to the line-of-sight
piπ: comoving separation parallel to the line-of-sight
betaβ=f/b, where f is the linear growth rate and b is the bias
biasthe bias
sigmavσ12
funcXiRpointer to an object of type FuncGrid, to interpolate on \( \xi(r) \)
funcXiR_pointer to an object of type FuncGrid, to interpolate on \( \overline{\xi}(r) \)
funcXiR__pointer to an object of type FuncGrid, to interpolate on \( \overline{\overline{\xi}} (r) \)
var1/[H(z)a(z)]
FV0 \( \rightarrow \) exponential; \( \rightarrow \) 1 gaussian
bias_nl0 \( \rightarrow \) linear bias; \( \rightarrow \) 1 non-linear bias
bAthe parameter bA used to model the bias
v_minthe minimum value of the velocity used in the convolution
v_maxthe maximum value of the velocity used in the convolution
step_vthe step of the convolution integral
Returns
ξ(rp,π)

Definition at line 696 of file FuncXi.cpp.

◆ xi2D_model() [2/2]

double cbl::xi2D_model ( const double  rp,
const double  pi,
const double  beta,
const double  bias,
const double  sigmav,
const std::vector< double >  rad_real,
const std::vector< double >  xi_real,
const std::vector< double >  xi_,
const std::vector< double >  xi__,
const double  var,
const int  FV,
int  index = -1,
const bool  bias_nl = 0,
const double  bA = 0.,
const double  v_min = -3000.,
const double  v_max = 3000.,
const int  step_v = 500 
)

the non-linear dispersion model for ξ(rp,π)

Parameters
rprp: comoving separation perpendicular to the line-of-sight
piπ: comoving separation parallel to the line-of-sight
betaβ=f/b, where f is the linear growth rate and b is the bias
biasthe bias
sigmavσ12
rad_realstd::vector containing the binnend values of the comoving separations
xi_realstd::vector containing the binnend values of the real-space correlation function
xi_std::vector containing the binnend values of \( \overline{\xi}(r) \)
xi__std::vector containing the binnend values of \( \overline{\overline{\xi}}(r) \)
var1/[H(z)a(z)]
FV0 \( \rightarrow \) exponential; \( \rightarrow \) Gaussian
indexindex for internal use
bias_nl0 \( \rightarrow \) linear bias; \( \rightarrow \) non-linear bias
bAthe parameter bA used to model the bias
v_minthe minimum value of the velocity used in the convolution
v_maxthe maximum value of the velocity used in the convolution
step_vthe step of the convolution integral
Returns
ξ(rp,π)

Definition at line 574 of file FuncXi.cpp.

◆ Xi4()

std::vector< double > cbl::Xi4 ( const std::vector< double >  rr,
const std::vector< double >  kk,
const std::vector< double >  Pk4,
const double  k_cut = 0.6,
const double  cut_pow = 2,
const int  IntegrationMethod = 1 
)

function to obtain the two point correlation function hexadecapole

Parameters
rrthe scales r
kkthe scales k
Pk4the power spectrum hexadecapole
k_cutthe k scale to cut the integrand
cut_powthe power of the integrand cut
IntegrationMethodmethod for integration
Returns
the linear RSD power spectrum hexadecapole

Definition at line 680 of file FuncMultipoles.cpp.

◆ xi_from_Pk() [1/2]

double cbl::xi_from_Pk ( const double  rr,
const std::string  file,
const int  c1 = 1,
const int  c2 = 2,
const double  k_min = 0.,
const double  k_max = 100.,
const double  aa = 0.,
const double  prec = 1.e-2 
)

the two-point correlation function computed from the Fourier transform of the power spectrum read from a file

Parameters
rrthe comoving separation, r
filename of the file where the power spectrum is stored
c1the column of the file corresponding to the wave std::vector, k
c2the column of the file corresponding to the power spectrum, P(k)
k_minthe minimum value of the wave std::vector used in the integral of the Fourier transform
k_maxthe maximum value of the wave std::vector used in the integral of the Fourier transform
aaparameter used to smooth the integrand, given by the eq. 24 of Anderson et al. 2012
precaccuracy of the GSL integration
Returns
the two-point correlation function, ξ(r)

Definition at line 109 of file FuncXi.cpp.

◆ xi_from_Pk() [2/2]

double cbl::xi_from_Pk ( const double  rr,
const std::vector< double >  lgkk,
const std::vector< double >  lgPk,
const double  k_min = 0.,
const double  k_max = 100.,
const double  aa = 0.,
const double  prec = 1.e-2 
)

the two-point correlation function computed from the Fourier transform of the power spectrum

Parameters
rrthe comoving separation, r
lgkkstd::vector containing the logarithm of the wave std::vectors, log10k
lgPkstd::vector containing the logarithm of the power spectrum, log10P(k)
k_minthe minimum value of the wave std::vector used in the integral of the Fourier transform
k_maxthe maximum value of the wave std::vector used in the integral of the Fourier transform
aaparameter used to smooth the integrand, given by the eq. 24 of Anderson et al. 2012
precaccuracy of the GSL integration
Returns
the two-point correlation function, ξ(r)

Definition at line 80 of file FuncXi.cpp.

◆ xi_projected_powerlaw()

double cbl::xi_projected_powerlaw ( const double  rp,
const double  r0,
const double  gamma 
)

the projected correlation function, wp(rp), computed by modelling the two-point correlation function, ξ(r), as a power-law

Parameters
rprp: comoving separation perpendicular to the line-of-sight
r0r0: the clustering normalization
gammaγ: the clustering slope
Returns
the projected correlation function wp(rp)

Definition at line 278 of file FuncXi.cpp.

◆ xi_ratio() [1/2]

double cbl::xi_ratio ( const double  beta)

the ratio between the redshift-space and real-space correlation functions

as predicted by the large-scale limit of the Kaiser/Hamilton model:

\[ \frac{\xi(s)}{\xi(r)} = 1 + \frac{2\beta}{3} + \frac{\beta^2}{5} \]

Parameters
betaβ=f/b, where f is the linear growth rate and b is the bias
Returns
ξ(s)/ξ(r)

Definition at line 287 of file FuncXi.cpp.

◆ xi_ratio() [2/2]

double cbl::xi_ratio ( const double  f_sigma8,
const double  bias_sigma8 
)

the ratio between the redshift-space and real-space correlation functions

as predicted by the large-scale limit of the Kaiser/Hamilton model:

\[ \frac{\xi(s)}{\xi(r)} = 1 + \frac{2}{3}\frac{f\sigma_8}{b\sigma_8} + \frac{1}{5}\left(\frac{f\sigma_8}{b\sigma_8}\right)^2 \]

Parameters
f_sigma8f*σ8
bias_sigma8b*σ8
Returns
ξ(s)/ξ(r)

Definition at line 296 of file FuncXi.cpp.

◆ XiMultipoles_from_Xi2D_integrand()

double cbl::XiMultipoles_from_Xi2D_integrand ( const double  mu,
void *  parameters 
)

integrand to obtain the 2PCF multipoles from 2D 2pcf in polar coordinates

Parameters
muthe value mu
parametersthe parameters for the integration
Returns
the 2pcf multipoles integrand

Definition at line 435 of file FuncMultipoles.cpp.

◆ XiMultipoles_integrand()

double cbl::XiMultipoles_integrand ( const double  kk,
void *  parameters 
)

integrand to obtain covariance for the 2PCF multipoles

Parameters
kkthe value kk
parametersthe parameters for the integration
Returns
the covariance of 2pcf multipoles integrand

Definition at line 420 of file FuncMultipoles.cpp.

◆ XiWedges_AP() [1/2]

std::vector< std::vector< double > > cbl::XiWedges_AP ( const std::vector< double >  mu_min,
const std::vector< double >  delta_mu,
const double  alpha_perpendicular,
const double  alpha_parallel,
const std::vector< double >  rr,
const std::shared_ptr< glob::FuncGrid xi0_interp,
const std::shared_ptr< glob::FuncGrid xi2_interp,
const std::shared_ptr< glob::FuncGrid xi4_interp 
)

function to obtain the 2pcf wedges

Parameters
mu_minthe lower limit of integration for wedges
delta_muthe mu width for wedges
alpha_perpendicularthe shift along the line of sight
alpha_parallelthe shift parallel to the line of sight
rrthe scales r
xi0_interpthe xi0 interpolator
xi2_interpthe xi2 interpolator
xi4_interpthe xi4 interpolator
Returns
the 2pcf wedges

Definition at line 901 of file FuncMultipoles.cpp.

◆ XiWedges_AP() [2/2]

std::vector< std::vector< double > > cbl::XiWedges_AP ( const std::vector< double >  mu_min,
const std::vector< double >  delta_mu,
const double  alpha_perpendicular,
const double  alpha_parallel,
const std::vector< double >  rr,
const std::vector< double >  rl,
const std::vector< double >  Xi0,
const std::vector< double >  Xi2,
const std::vector< double >  Xi4 
)

function to obtain the 2pcf wedges

Parameters
mu_minthe lower limit of integration for wedges
delta_muthe mu width for wedges
alpha_perpendicularthe shift along the line of sight
alpha_parallelthe shift parallel to the line of sight
rrthe scales r
rlthe scales at which the multipoles are defined
Xi0the 2pfc monopole
Xi2the 2pfc quadrupole
Xi4the 2pfc hecadecapole
Returns
the 2pcf wedges

Definition at line 923 of file FuncMultipoles.cpp.