![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
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> | |
T | 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> | |
T | 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< BinType > | BinTypeCast (const std::vector< int > binTypeIndeces) |
cast an enum of type BinType from indeces More... | |
std::vector< BinType > | BinTypeCast (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< CoordinateUnits > | CoordinateUnitsCast (const std::vector< int > coordinateUnitsIndeces) |
cast an enum of type CoordinateUnits from indeces More... | |
std::vector< CoordinateUnits > | CoordinateUnitsCast (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< CoordinateType > | CoordinateTypeCast (const std::vector< int > coordinateTypeIndeces) |
cast an enum of type CoordinateType from indeces More... | |
std::vector< CoordinateType > | CoordinateTypeCast (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 > | |
T | Pol2 (T xx, std::shared_ptr< void > pp, std::vector< double > par) |
the quadratic function More... | |
template<typename T > | |
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 > | |
T | identity (T xx, std::shared_ptr< void > pp, std::vector< double > par) |
the Identity function More... | |
template<typename T > | |
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 > | |
T | gaussian (T xx, std::shared_ptr< void > pp, std::vector< double > par) |
the Gaussian function More... | |
template<typename T > | |
T | poisson (T xx, std::shared_ptr< void > pp, std::vector< double > par) |
the poisson distribution More... | |
template<typename T > | |
T | maxwellian_distr (const T vel, const T sigma) |
the Maxwellian distribution More... | |
template<typename T > | |
T | powerlaw (const T xx, const T x0, const T gamma) |
the power-law function More... | |
template<typename T > | |
T | double_powerlaw (const T xx, const T x0, const T alpha, const T beta) |
the double power-law function More... | |
template<typename T > | |
T | TopHat_WF (const T kR) |
the top-hat window function More... | |
template<typename T > | |
T | TopHat_WF_D1 (const T kR) |
the derivative of the top-hat window function More... | |
template<typename T > | |
T | Radius (const T Mass, const T Rho) |
the radius of a sphere of a given mass and density More... | |
template<typename T > | |
T | volume_sphere (const T RR) |
the volume of a sphere of a given radius More... | |
template<typename T > | |
T | Mass (const T RR, const T Rho) |
the mass of a sphere of a given radius and density More... | |
template<typename T > | |
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 > | |
T | P_2 (const T x) |
the Legendre polynomial P2 More... | |
template<typename T > | |
T | P_4 (const T x) |
the Legendre polynomial P4 More... | |
template<typename T > | |
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::Data > | 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 More... | |
std::shared_ptr< cbl::data::Data > | 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 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 > | |
T | Log (const T val, const double fact=0.9) |
common logarithm (i.e. logarithm to base 10) More... | |
template<typename T > | |
T | Ln (const T val, const double fact=0.9) |
natural logarithm More... | |
template<typename T > | |
T | closest (T x, T a, T b) |
given a number x, return the closest of two values a, b More... | |
template<typename T > | |
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 > | |
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 > | |
T | Min (const std::vector< T > vect) |
minimum element of a std::vector More... | |
template<typename T > | |
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 > | |
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... | |
The global namespace of the CosmoBolognaLib
The cbl namespace contains all the main functions and classes of the CosmoBolognaLib
typedef std::function<double(double, std::shared_ptr<void>, std::vector<double>)> cbl::distribution_func |
generic distribution function
Definition at line 50 of file RandomNumbers.h.
typedef std::function<double(std::vector<double>, std::shared_ptr<void>)> cbl::nDim_distribution_func |
distribution function used for a n-dimensional distribution
Definition at line 57 of file RandomNumbers.h.
|
strong |
|
strong |
|
strong |
|
strong |
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
x1 | x coordinate of the first object |
x2 | x coordinate of the second object |
y1 | y coordinate of the first object |
y2 | y coordinate of the second object |
z1 | z coordinate of the first object |
z2 | z coordinate of the second object |
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
redshift | the redshift |
cosm1 | object of class Cosmology |
cosm2 | object of class Cosmology |
Definition at line 89 of file FuncCosmology.cpp.
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
redshift | the redshift |
cosm1 | object of class Cosmology |
cosm2 | object of class Cosmology |
Definition at line 79 of file FuncCosmology.cpp.
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
redshift | the redshift |
cosm1 | object of class Cosmology |
cosm2 | object of class Cosmology |
Definition at line 84 of file FuncCosmology.cpp.
double cbl::arcminutes | ( | const double | angle, |
const CoordinateUnits | inputUnits = CoordinateUnits::_radians_ |
||
) |
double cbl::arcseconds | ( | const double | angle, |
const CoordinateUnits | inputUnits = CoordinateUnits::_radians_ |
||
) |
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
vect | the input std::vector |
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
vect | the input std::vector |
weight | the weight |
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
r1_min | |
r1_max | |
r2_min | |
r2_max | |
r3 | |
L1 | the order of the first spherical bessel function |
L2 | the order of the second spherical bessel function |
L3 | the order of the third spherical bessel function |
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}}} \)
rr | the comoving scale |
bA | bA |
bB | bB |
bC | bC |
Definition at line 653 of file FuncXi.cpp.
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} \]
RR | the comoving separation, r, where the barred correlation function is computed |
rr | std::vector containing the input comoving separations |
xi | std::vector containing the input two-point correlation function |
rAPP | comoving scale below which a power-law model for the two-point correlation function is assumed in the integral |
r0 | the power-law normalization, r0 |
gamma | the power-law slope, γ |
Definition at line 392 of file FuncXi.cpp.
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} \]
RR | the comoving separation, r, where the barred correlation function is computed |
rr | std::vector containing the input comoving separations |
xi | std::vector containing the input two-point correlation function |
rAPP | comoving scale below which a power-law model for the two-point correlation function is assumed in the integral |
r0 | the power-law normalization, r0 |
gamma | the power-law slope, γ |
Definition at line 412 of file FuncXi.cpp.
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} \]
RR | the comoving separation, r, where the barred correlation function is computed |
rr | std::vector containing the input comoving separations |
xi | std::vector containing the input two-point correlation function |
rAPP | comoving scale below which a power-law model for the two-point correlation function is assumed in the integral |
r0 | the power-law normalization, r0 |
gamma | the power-law slope, γ |
Definition at line 361 of file FuncXi.cpp.
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} \]
RR | the comoving separation, r, where the barred correlation function is computed |
rr | std::vector containing the input comoving separations |
xi | std::vector containing the input two-point correlation function |
rAPP | comoving scale below which a power-law model for the two-point correlation function is assumed in the integral |
r0 | the power-law normalization, r0 |
gamma | the power-law slope, γ |
Definition at line 331 of file FuncXi.cpp.
|
inline |
produce a beep
function to produce a nice, useful beep
beep | produced sound, to be specified to customize the beep |
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
file_grid | the file with the input function | |
[in] | func | the input function |
[in] | par | the function parameters |
[in] | bin | the number of bins in the grid |
[in] | x_min | the minimum limit of the grid |
[in] | x_max | the maximum limit of the grid |
[in] | binning | the binning type: it can be "lin", "loglin" or "log" |
[in,out] | xx | std::vector containing the grid points |
[in,out] | yy | std::vector containing the values of the function at the grid points |
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
[in] | file_grid | the file with the input function |
[in] | func | the input function |
[in] | par | the function parameters |
[in] | bin | the number of bins in the grid |
[in] | x1_min | the minimum limit of the grid in one direction |
[in] | x1_max | the maximum limit of the grid in one direction |
[in] | x2_min | the minimum limit of the grid in one direction |
[in] | x2_max | the maximum limit of the grid in one direction |
[in] | binning | the binning type: it can be "lin", "loglin" or "log" |
[in,out] | xx1 | std::vector containing the grid points in one direction |
[in,out] | xx2 | std::vector containing the grid points in one direction |
[in,out] | yy | std::vector containing the values of the function at the grid points |
double cbl::binomial_coefficient | ( | const int | n, |
const int | m | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
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
[in] | ra | the Right Ascension [radians] |
[in] | dec | the Declination [radians] |
[in] | dd | the comoving distance |
[out] | XX | the Cartesian coordinate x |
[out] | YY | the Cartesian coordinate y |
[out] | ZZ | the Cartesian coordinate z |
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
[in] | ra | std::vector containing the Right Ascension values [radians] |
[in] | dec | std::vector containing the Declination values [radians] |
[in] | dd | std::vector containing the comoving distances |
[out] | XX | std::vector containing the Cartesian coordinates x |
[out] | YY | std::vector containing the Cartesian coordinates y |
[out] | ZZ | std::vector containing the Cartesian coordinates z |
T cbl::castFromName | ( | const std::string | name, |
const std::vector< std::string > | list | ||
) |
cast an object of type enum class from its name
name | the enum name |
list | std::vector containing the names of the enum |
Definition at line 59 of file EnumCast.h.
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
names | the enum names |
list | std::vector containing the names of the enum |
Definition at line 97 of file EnumCast.h.
T cbl::castFromValue | ( | const int | i | ) |
cast an object of type enum class from its index
i | the enum index |
Definition at line 47 of file EnumCast.h.
std::vector<T> cbl::castFromValues | ( | const std::vector< int > | ii | ) |
cast objects of type enum class from indeces
ii | the enum indeces |
Definition at line 79 of file EnumCast.h.
double cbl::chainMeshInterpolate | ( | std::vector< double > | xx, |
std::shared_ptr< void > | pars | ||
) |
void cbl::check_EnvVar | ( | const std::string | Var | ) |
check if an environment variable exists
Var | the evironment variable to be checked |
Definition at line 196 of file Kernel.cpp.
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
frac | the fraction of the available memory that is allowed |
func | a std::string that should contain the name of the function from which check_memory is called; it is used when printing the error message |
exit | 0 \(\rightarrow\) warning message; 1 \(\rightarrow\) error message; (and exit) |
type | 1 \(\rightarrow\) Physical Memory (RAM); 2 \(\rightarrow\) Virtual Memory |
Definition at line 252 of file Kernel.cpp.
void cbl::check_regions | ( | catalogue::Catalogue & | data, |
catalogue::Catalogue & | random | ||
) |
check if the subdivision process produced the correct results
data | input data catalogue |
random | random catalogue |
Definition at line 601 of file SubSample.cpp.
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
mat | a matrix |
val_i | an input value |
val_j | an input value |
matrix | the name of the matrix (using only to write the error message) |
equal | true \(\rightarrow\) check if the dimension is equal to val; false \(\rightarrow\) check if the dimension is lower than val |
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
vect | a std::vector |
val | the input value |
vector | the name of the std::vector (used only to write the error message) |
equal | true \(\rightarrow\) check if the dimension is equal to val; false \(\rightarrow\) check if the dimension is lower than val |
void cbl::checkEqual | ( | const std::vector< T > | vect1, |
const std::vector< T > | vect2 | ||
) |
void cbl::checkIO | ( | const std::ifstream & | fin, |
const std::string | file = "NULL" |
||
) |
check if an input file can be opened
fin | std::ifstream object |
file | the file name |
Definition at line 160 of file Kernel.cpp.
void cbl::checkIO | ( | const std::ofstream & | fout, |
const std::string | file = "NULL" |
||
) |
check if an output file can be opened
fout | std::ofstream object |
file | the file name |
Definition at line 173 of file Kernel.cpp.
double cbl::clebsh_gordan | ( | const int | j1, |
const int | j2, | ||
const int | m1, | ||
const int | m2, | ||
const int | j3, | ||
const int | m3 | ||
) |
T cbl::closest | ( | T | x, |
std::vector< T > | values | ||
) |
T cbl::closest | ( | T | x, |
T | a, | ||
T | b | ||
) |
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
xx | the variable x |
pp | a void pointer |
par | a std::vector containing the coefficients: |
vector< double > cbl::colatitude | ( | std::vector< double > | latitude | ) |
convert to colatitude
\[ \theta = 90 - \delta \]
latitude | vector containing the latitudes |
Definition at line 484 of file SubSample.cpp.
std::string cbl::conv | ( | const T | val, |
const char * | fact | ||
) |
convert a number to a std::string
val | number of any type |
fact | output format |
double cbl::converted_angle | ( | const double | angle, |
const CoordinateUnits | inputUnits = CoordinateUnits::_radians_ , |
||
const CoordinateUnits | outputUnits = CoordinateUnits::_degrees_ |
||
) |
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
RP | the comoving separation perpendicular to the line-of-sight, Rp |
PI | the comoving separation parallel to the line-of-sight, Π |
redshift | the redshift |
rp | vector containing the comoving separations perpendicular to the line-of-sight, rp |
pi | vector containing the comoving separations parallel to the line-of-sight, π |
Xi | matrix containing the two-point correlation function, ξ(rp,π) |
cosm1 | object of class Cosmology |
cosm2 | object of class Cosmology |
direction | 0 → cosm2 \( \rightarrow \) cosm1; 1 → cosm1 \( \rightarrow \) cosm2; |
Definition at line 140 of file FuncCosmology.cpp.
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
RR | the comoving separation, R |
redshift | the redshift |
rr | vector containing the comoving separations, r |
Xi | vector containing the two-point correlation function, ξ(r) |
cosm1 | object of class Cosmology |
cosm2 | object of class Cosmology |
direction | 0 → cosm2 \( \rightarrow \) cosm1; 1 → cosm1 \( \rightarrow \) cosm2; |
Definition at line 117 of file FuncCosmology.cpp.
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.
[in] | f1 | first function, f1(x) |
[in] | f2 | second function, f2(x) |
[out] | res | convolution function |
[in] | deltaX | Δx = (xmax-xmin)/nx |
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
[in,out] | ra | vector containing the Right Ascensions |
[in,out] | dec | vector containing the Declinations |
[in,out] | redshift | vector containing the redshifts |
[in,out] | xx | vector containing the x coordinates |
[in,out] | yy | vector containing the y coordinates |
[in,out] | zz | vector containing the z coordinates |
[in] | vx | vector containing the peculiar velocities along the x direction |
[in] | vy | vector containing the peculiar velocities along the y direction |
[in] | vz | vector containing the peculiar velocities along the z direction |
[in] | sigmaV | the error on the peculiar velocities |
[in] | real_cosm | an object of class Cosmology |
[in] | mean_redshift | the mean redshift |
[in] | redshift_min | the minimum redshift |
[in] | redshift_max | the maximum redshift |
[in] | seed | the random seed |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
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) \]
l | the first index |
l_prime | the second index |
l2 | the third index |
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
[in] | file | the std::vector containing the input files |
[out] | covariance_matrix_file | the output covariance matrix file |
[in] | JK | false → normalize to 1/(n-1); true → normalize to n-1/n (for Jackknife) |
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
[in] | file | the std::vector containing the input files |
[out] | rad | the std::vector containing the binned radii |
[out] | mean | the std::vector containing the mean values |
[out] | cov | the output covariance matrix |
[in] | JK | false → normalize to 1/(n-1); true → normalize to n-1/n (for Jackknife) |
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
[in] | mat | the data input matrix |
[out] | cov | the output covariance matrix |
[in] | JK | false → normalize to 1/(n-1); true → normalize to n-1/n (for Jackknife) |
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.
rr | output scales |
covariance | analytic covariance matrix |
nbins | number of configuration space bins |
rMin | minimum configuration space scale |
rMax | maximum configuration space scale |
nObjects | number of objects in the sample |
Volume | the sample volume |
kk | the scales kk |
Pk_multipoles | the power spectrum multipoles |
orders | the power spectrum multipoles orders |
bin_type | the bin type |
Definition at line 994 of file FuncMultipoles.cpp.
double cbl::covariance_XiMultipoles_integrand | ( | const double | kk, |
void * | parameters | ||
) |
integrand to obtain the 2PCF multipoles
kk | the value kk |
parameters | the parameters for the integration |
Definition at line 466 of file FuncMultipoles.cpp.
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.
rr | output scales |
covariance | analytic covariance matrix |
mu | the lower wedge integratin limit |
delta_mu | the wedge mu bin size |
nbins | number of configuration space bins |
rMin | minimum configuration space scale |
rMax | maximum configuration space scale |
nObjects | number of objects in the sample |
Volume | the sample volume |
kk | the scales kk |
Pk_multipoles | the power spectrum multipoles |
orders | the power spectrum multipoles orders |
bin_type | the bin type |
Definition at line 1096 of file FuncMultipoles.cpp.
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
[in] | xx | vector containing the x coordinates |
[in] | yy | vector containing the y coordinates |
[in] | zz | vector containing the z coordinates |
[in] | vx | vector containing the peculiar velocities along the x direction |
[in] | vy | vector containing the peculiar velocities along the y direction |
[in] | vz | vector containing the peculiar velocities along the z direction |
[in] | var1 | vector containing a generic quantity (e.g. masses or luminosities) |
[in] | var2 | vector containing a generic quantity (e.g. masses or luminosities) |
[in] | var3 | vector containing a generic quantity (e.g. masses or luminosities) |
[in] | output_dir | name of directory used to store the outputs |
[in] | boxSize | the box side |
[in] | frac | the side fraction (if the input box is a sub-box of a box with side equal to boxSize) |
[in] | Bord | the redshift interval that is cutted at the bords of the box |
[in] | mean_redshift | the mean redshift |
[in] | real_cosm | an object of class Cosmology |
[in] | REAL | 0 → redshift-space; 1 → real-space |
[in] | sigmaV | the error on the peculiar velocities |
[in] | idum | the random seed |
[out] | Volume | the mock volume |
|
inline |
double cbl::degrees | ( | const double | angle, |
const CoordinateUnits | inputUnits = CoordinateUnits::_radians_ |
||
) |
double cbl::determinant_matrix | ( | const std::vector< std::vector< double >> | mat | ) |
std::vector<T> cbl::different_elements | ( | const std::vector< T > | vect_input | ) |
|
inline |
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
input_catalogue | input catalogue |
Definition at line 145 of file Reconstruction.cpp.
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
[out] | xx | std::vector containing the binned values of the variable |
[out] | fx | std::vector containing the binned values of the distribution |
[out] | err | std::vector containing the binned Poisson errors |
[in] | FF | std::vector containing the given set of data |
[in] | WW | std::vector containing the weights |
[in] | nbin | the number of bins |
[in] | linear | true → linear binning; false → logarithmic binning |
[in] | file_out | the output file where the distribution is stored |
[in] | fact | factor used to normalized the distribution |
[in] | V1 | the minimum limit of the distribution |
[in] | V2 | the maximum limit of the distribution |
[in] | bin_type | "Linear" → dn/dvar; "Log10" → dn/dlog(var); "Log" → dn/dln(var) |
[in] | conv | true → compute the Gaussian convolvolution of the distribution; false → do not convolve |
[in] | sigma | σ of the Gaussian kernel |
double cbl::distribution_probability | ( | double | xx, |
std::shared_ptr< void > | pp, | ||
std::vector< double > | par | ||
) |
probability of an interpolated distribution
xx | the variable x |
pp | a void pointer |
par | a std::vector containing the coefficients: |
T cbl::double_powerlaw | ( | const T | xx, |
const T | x0, | ||
const T | alpha, | ||
const T | beta | ||
) |
double cbl::DoubleSwap | ( | const double | d | ) |
endian conversion of a double variable
d | a double variable |
Definition at line 109 of file Kernel.cpp.
void cbl::eq2sdss | ( | const std::vector< double > | ra, |
const std::vector< double > | dec, | ||
std::vector< double > & | lambda, | ||
std::vector< double > & | eta | ||
) |
void cbl::Erase | ( | std::vector< T > & | vv, |
std::vector< int > | ind | ||
) |
erase some elements of a std::vector
[in,out] | vv | a std::vector |
[in] | ind | a std::vector containing the elements of the input std::vector vv to be erased |
void cbl::Erase_columns | ( | std::vector< std::vector< T > > & | Mat, |
std::vector< int > | col | ||
) |
erase some columns of a matrix
[in,out] | Mat | a matrix (i.e. a std::vector of std::vectors) |
[in] | col | a std::vector containing the columns of the input matrix Mat to be erased |
void cbl::Erase_lines | ( | std::vector< std::vector< T > > & | Mat, |
std::vector< int > | ll | ||
) |
erase some lines of a matrix
[in,out] | Mat | a matrix (i.e. a std::vector of std::vectors) |
[in] | ll | a std::vector containing the lines of the input matrix Mat to be erased |
|
inline |
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,π)
ss | comoving scale where the multipole is computed |
rp | std::vector containing the values of rp |
pi | std::vector containing the values of π |
error | matrix containing the errors of ξ(r,μ) |
delta_s | bin size |
Definition at line 207 of file FuncMultipoles.cpp.
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,μ)
indexR | index correspondent to the comoving separation where the multipole is computed |
mu | std::vector containing the angle between the separation std::vector and the line of sight |
error | matrix containing the errors of ξ(r,μ) |
Definition at line 90 of file FuncMultipoles.cpp.
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,π)
ss | comoving scale where the multipole is computed |
rp | std::vector containing the values of rp |
pi | std::vector containing the values of π |
error | matrix containing the errors of ξ(r,μ) |
delta_s | bin size |
Definition at line 231 of file FuncMultipoles.cpp.
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,μ)
indexR | index correspondent to the comoving separation where the multipole is computed |
mu | std::vector containing the angle between the separation std::vector and the line of sight |
error | matrix containing the errors of ξ(r,μ) |
Definition at line 105 of file FuncMultipoles.cpp.
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,π)
ss | comoving scale where the multipole is computed |
rp | std::vector containing the values of rp |
pi | std::vector containing the values of π |
error | matrix containing the errors of ξ(r,μ) |
delta_s | bin size |
Definition at line 255 of file FuncMultipoles.cpp.
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,μ)
indexR | index correspondent to the comoving separation where the multipole is computed |
mu | std::vector containing the angle between the separation std::vector and the line of sight |
error | matrix containing the errors of ξ(r,μ) |
Definition at line 120 of file FuncMultipoles.cpp.
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) \]
beta | β=f/b |
error_beta | error on β |
Definition at line 322 of file FuncXi.cpp.
|
inline |
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib
msg | the message describing the exception |
functionCBL | the CBL function where the exception is raised |
fileCBL | the CBL file containing the function where the exception is raised |
exitCode | the exit status |
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
x1 | x coordinate of the first object |
x2 | x coordinate of the second object |
y1 | y coordinate of the first object |
y2 | y coordinate of the second object |
z1 | z coordinate of the first object |
z2 | z coordinate of the second object |
std::vector<T> cbl::extract_elements | ( | std::vector< T > | vec, |
std::vector< unsigned int > | index | ||
) |
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)
xx | s |
f_g | fg |
k_star | k* |
Definition at line 642 of file FuncXi.cpp.
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)
vel | comoving velocity |
rp | rp: comoving separation perpendicular to the line-of-sight |
pi | π: comoving separation parallel to the line-of-sight |
var | 1/[H(z)a(z)] |
sigmav0 | σv,0 |
cmu | Cμ |
cs1 | Cσ1 |
cs2 | Cσ2 |
Definition at line 627 of file FuncXi.cpp.
double cbl::f_v | ( | const double | vel, |
const double | sigmav, | ||
const int | FV | ||
) |
pairwise velocity distribution
vel | comoving velocity |
sigmav | σ12 |
FV | 0 \( \rightarrow \) exponential; \( \rightarrow \) 1 gaussian |
Definition at line 616 of file FuncXi.cpp.
double cbl::Filter | ( | const double | r, |
const double | rc | ||
) |
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
mean | the 2PCF mean value |
mock_xi0 | the 2CPF of the mocks |
doJK | 0 → normalize to 1/(n-1); 1 → normalize to n-1/n (for Jackknife) |
cosmology | the cosmology |
nObjects | the number of objects in the sample |
Volume | the volume of the sample |
bias | the bias of the sample |
redshift | the redshift of the sample |
rMin | the minimum scale |
rMax | the maximum scale |
nbins | the number of bins |
bin_type | the binning type |
method_Pk | method 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_NL | the BAO damping parameter |
NL | 0 \(\rightarrow\) linear power spectrum; 1 \(\rightarrow\) non-linear power spectrum |
Definition at line 46 of file Forecast.cpp.
std::vector<T> cbl::flatten | ( | std::vector< std::vector< T >> | matrix | ) |
float cbl::FloatSwap | ( | const float | f | ) |
endian conversion of a float variable
f | a flot variable |
Definition at line 89 of file Kernel.cpp.
T cbl::gaussian | ( | T | xx, |
std::shared_ptr< void > | pp, | ||
std::vector< double > | par | ||
) |
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
nExtractions | the number of correlated samples to extract |
mean | the mean values for the sample |
covariance | the covariance matrix of the sample |
idum | seed for random number generator |
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
mean | the mean values for the sample |
covariance | the covariance matrix of the sample |
idum | seed for random number generator |
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
cosmology | the cosmology |
bias | the bias of the sample |
nObjects | the number of objects in the sample |
Volume | the volume of the sample |
redshift | the redshift of the sample |
rMin | the minimum scale |
rMax | the maximum scale |
nbins | the number of bins |
bin_type | the binning type |
method_Pk | method 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_NL | the BAO damping parameter |
NL | 0 \(\rightarrow\) linear power spectrum; 1 \(\rightarrow\) non-linear power spectrum |
Definition at line 143 of file Forecast.cpp.
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
cosmology | the cosmology |
bias | the bias of the sample |
nObjects | the number of objects in the sample |
Volume | the volume of the sample |
redshift | the redshift of the sample |
rMin | the minimum scale |
rMax | the maximum scale |
nbins | the number of bins |
bin_type | the binning type |
method_Pk | method 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_NL | the BAO damping parameter |
NL | 0 \(\rightarrow\) linear power spectrum; 1 \(\rightarrow\) non-linear power spectrum |
Definition at line 165 of file Forecast.cpp.
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}\)
r1 | the first side of the triangle |
r2 | the second side of the triangle |
r3 | the third side of the triangle |
double cbl::haversine_distance | ( | const double | ra1, |
const double | ra2, | ||
const double | dec1, | ||
const double | dec2 | ||
) |
the haversine angular separation
ra1 | the Right Ascension of the first object [radians] |
ra2 | the Right Ascension of the second object [radians] |
dec1 | the Declination of the first object [radians] |
dec2 | the Declination of the second object [radians] |
|
inline |
T cbl::identity | ( | T | xx, |
std::shared_ptr< void > | pp, | ||
std::vector< double > | par | ||
) |
T cbl::index_closest | ( | T | x, |
std::vector< T > | vv | ||
) |
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
value | vector containing the values |
ranges | vector containing the ranges |
include_limits | true \( \rightarrow \) include limits; false \( \rightarrow \) exclude limits. |
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
value | vector containing the values |
min | vector containing the lower limits |
max | vector containing the upper limits |
include_limits | true \( \rightarrow \) include limits; false \( \rightarrow \) exclude limits. |
bool cbl::inRange | ( | T | value, |
T | min, | ||
T | max, | ||
bool | include_limits = true |
||
) |
return false \( \rightarrow \) value outside the range; true \( \rightarrow \) value inside the range
value | the value |
min | the lower limit |
max | the upper limit |
include_limits | true \( \rightarrow \) include limits; false \( \rightarrow \) exclude limits. |
double cbl::interpolated | ( | const double | _xx, |
const std::vector< double > | xx, | ||
const std::vector< double > | yy, | ||
const std::string | type | ||
) |
1D interpolation
[in] | _xx | the point where the input function will be interpolated or extrapolated |
[in] | xx | std::vector containing the binned values of x |
[in] | yy | std::vector containing the binned values of the function, y(x), to be interpolated or extrapolated |
[in] | type | the 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 |
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
[in] | _x1 | the point in the first dimension where the input function will be interpolated |
[in] | _x2 | the point in the second dimension where the input function will be interpolated |
[in] | x1 | std::vector containing the binned values of x in the first dimension |
[in] | x2 | std::vector containing the binned values of x in the second dimension |
[in] | yy | std::vector containing the binned values of the function, y(x), to be interpolated or extrapolated |
[in] | type | the 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 |
int cbl::IntSwap | ( | const int | i | ) |
endian conversion of an integer variable
i | an integer variable |
Definition at line 57 of file Kernel.cpp.
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
[in] | mat | the matrix to be inverted |
[out] | mat_inv | the inverted matrix |
[in] | prec | the 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 |
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
[in] | mat | the matrix to be inverted |
[out] | mat_inv | the inverted matrix |
[in] | i1 | minimum index considered |
[in] | i2 | maximum index considered |
[in] | prec | the 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 |
bool cbl::isDimEqual | ( | const std::vector< std::vector< T > > | mat1, |
const std::vector< std::vector< T > > | mat2 | ||
) |
bool cbl::isDimEqual | ( | const std::vector< T > | vect1, |
const std::vector< T > | vect2 | ||
) |
|
inline |
check if the value of a [double] variable has already been set
var | a double variable |
|
inline |
check if the value of a [int] variable has already been set
var | a int variable |
|
inline |
check if the value of a [long] variable has already been set
var | a long variable |
|
inline |
check if the value of a [string] variable has already been set
var | a string variable |
|
inline |
check if the values of a [double] std::vector have already been set
vect | a vactor of double values |
|
inline |
check if the values of a [unsigned int] std::vector<std::vector> have already been set
vect | a vactor of double values |
|
inline |
check if the values of a [unsigned int] std::vector have already been set
vect | a vactor of double values |
double cbl::j0 | ( | const double | xx | ) |
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
kk | the variable k |
r_down | the lower limit of the twopcf bin |
r_up | the upper limit of the twopcf bin |
double cbl::j2 | ( | const double | xx | ) |
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
kk | the variable k |
r_down | the lower limit of the twopcf bin |
r_up | the upper limit of the twopcf bin |
double cbl::j4 | ( | const double | xx | ) |
double cbl::jl | ( | const double | xx, |
const int | order | ||
) |
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
kk | the variable k |
order | the shperical Bessel function order |
r_down | the lower limit of the twopcf bin |
r_up | the upper limit of the twopcf bin |
double cbl::jl_spherical_integrand | ( | double | rr, |
void * | params | ||
) |
double cbl::legendre_polynomial | ( | const double | mu, |
const int | l | ||
) |
double cbl::legendre_polynomial_integral | ( | double | mu, |
void * | params | ||
) |
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
mu_min | the lower limit of integration of the Legendre polynomial |
mu_max | the upper limit of integration of the Legendre polynomial |
ll | the order of the Legendre polynomial |
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
ll | the order of the Legendre polynomial |
mu | the order of the Legendre polynomial |
delta_mu | the order of the Legendre polynomial |
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
theta_min | the lower limit of integration of the Legendre polynomial |
theta_max | the upper limit of integration of the Legendre polynomial |
ll | the order of the Legendre polynomial |
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
r12 | first triangle side |
r13 | second triangle side |
deltaR | the bin width |
lMax | the maximum Legedre polynomial order |
rel_err | the relative error |
abs_err | the absolute error |
nevals | the maximum number of integrals evaluation |
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} \)
r12_min | the lower limit of integration for \(r_{12}\) |
r12_max | the upper limit of integration for \(r_{12}\) |
r13_min | the lower limit of integration for \(r_{13}\) |
r13_max | the upper limit of integration for \(r_{13}\) |
r23_min | the lower limit of integration for \(r_{23}\) |
r23_max | the upper limit of integration for \(r_{23}\) |
ll | the order of the Legendre polynomial |
rel_err | the relative error |
abs_err | the absolute error |
nevals | the maximum number of integrals evaluation |
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
[in] | nn | the number of steps, i.e. the final dimension of vv |
[in] | min | the minimum value of the range of values |
[in] | max | the maximum value of the range of values |
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
min | Vector of minimum grid values: [minX, minY, minZ] |
max | Vector of maximum grid values: [maxX, maxY, maxZ] |
steps | Vector of step values in the three grid dimensions: [stepX, stepY, stepZ] The grid can therefore have different steps in different dimensions |
func | Orderd 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] |
pos | Vector of points to interpolate on. It must have dimension [Npoints][3] |
|
inline |
T cbl::Ln | ( | const T | val, |
const double | fact = 0.9 |
||
) |
natural logarithm
val | a number |
fact | factor multiplying par::defaultDouble |
int cbl::locate | ( | const std::vector< T > & | vv, |
const T | xx | ||
) |
T cbl::Log | ( | const T | val, |
const double | fact = 0.9 |
||
) |
common logarithm (i.e. logarithm to base 10)
val | a number |
fact | factor multiplying par::defaultDouble |
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
[in] | nn | the number of steps, i.e. the final dimension of vv |
[in] | min | the minimum value of the range of values |
[in] | max | the maximum value of the range of values |
long long cbl::LongSwap | ( | const long long | i | ) |
endian conversion of a long integer variable
i | a long integer variable |
Definition at line 71 of file Kernel.cpp.
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
path | the name of the directory (or directories) to be created recursively (with parents) |
rootPath | the path to the root directory |
mode | the permissions for the directory |
verbose | if true it shows a warning message when the directory to be created already exists |
Definition at line 381 of file Kernel.cpp.
T cbl::Mass | ( | const T | RR, |
const T | Rho | ||
) |
T cbl::Max | ( | const std::vector< T > | vect | ) |
maximum element of a std::vector
vect | a std::vector |
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
[in] | Rp_max | the maximum value of the comoving distance perpendicular to the line-of-sight, rp,MAX, in the cosmology cosm1 |
[in] | Pi_max | the maximum value of the comoving distance parallel to the line-of-sight, πMAX, in the cosmology cosm1 |
[in] | redshift | the redshift |
[in] | cosm1 | object of class Cosmology: the assumed (or real) cosmology |
[in] | cosm2 | a vector of objects of class Cosmology: the test cosmologies |
[out] | rpM_AP | the maximum value of the comoving distance perpendicular to the line-of-sight, rp,MAX, over all the test cosmologies cosm2 |
[out] | piM_AP | the maximum value of the comoving distance parallel to the line-of-sight, πMAX, over all the test cosmologies cosm2 |
[out] | rM_AP | the maximum value of the comoving distance over all the test cosmologies cosm2 |
Definition at line 98 of file FuncCosmology.cpp.
T cbl::maxwellian_distr | ( | const T | vel, |
const T | sigma | ||
) |
double cbl::MC_Int | ( | double | funcconst double, |
const double | x1, | ||
const double | x2, | ||
const int | seed = 3213 |
||
) |
double cbl::MC_Int | ( | double | funcconst double, const double AA, |
const double | AA, | ||
const double | x1, | ||
double | x2, | ||
const int | seed = 3213 |
||
) |
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)
func | the function f(x,A,B,C,D,E) |
AA | parameter of the function, A |
BB | parameter of the function, B |
CC | parameter of the function, C |
DD | parameter of the function, D |
EE | parameter of the function, E |
x1 | minimum limit of the integral |
x2 | maximum limit of the integral |
seed | the seed for random number generation |
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.)
[in] | var | std::vector containing the set of data |
[in] | bin | the number of bin used |
[in] | V_min | the minimum value of the range |
[in] | V_max | the maximum value of the range |
[in] | Volume | the volume |
[out] | Var | std::vector containing the binned values of "var" |
[out] | Phi | std::vector containing the binned values of the var function |
[out] | err | std::vector containing the Poisson errors |
T cbl::Min | ( | const std::vector< T > | vect | ) |
minimum element of a std::vector
vect | a std::vector |
std::vector< size_t > cbl::minimum_maximum_indexes | ( | const std::vector< double > | xx, |
const double | x_min, | ||
const double | x_max | ||
) |
void cbl::Moment | ( | const std::vector< double > | data, |
double & | ave, | ||
double & | adev, | ||
double & | sdev, | ||
double & | var, | ||
double & | skew, | ||
double & | curt | ||
) |
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 \]
ss | comoving scale where the multipole is computed |
rp | std::vector containing the values of rp |
pi | std::vector containing the values of π |
xi | matrix containing the values of ξ(r,μ) |
delta_s | bin size |
Definition at line 135 of file FuncMultipoles.cpp.
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 \]
indexR | index correspondent to the comoving separation where the multipole is computed |
mu | std::vector containing the angle between the separation std::vector and the line of sight |
xi | matrix containing the values of ξ(r,μ) |
Definition at line 45 of file FuncMultipoles.cpp.
double cbl::multipole_xi0_model | ( | const double | beta, |
const double | xi_real | ||
) |
the model multipole ξ0 of the two-point correlation function
beta | β=f/b, where f is the linear growth rate and b is the bias |
xi_real | the real-space two-point correlation function |
Definition at line 353 of file FuncMultipoles.cpp.
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
f_sigma8 | f*σ8 |
bias_sigma8 | b*σ8 |
sigma8z | σ8 |
xi_matter | the real-space two-point correlation function of the dark matter |
Definition at line 362 of file FuncMultipoles.cpp.
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 \]
ss | comoving scale where the multipole is computed |
rp | std::vector containing the values of rp |
pi | std::vector containing the values of π |
xi | matrix containing the values of ξ(r,μ) |
delta_s | bin size |
Definition at line 159 of file FuncMultipoles.cpp.
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 \]
indexR | index correspondent to the comoving separation where the multipole is computed |
mu | std::vector containing the angle between the separation std::vector and the line of sight |
xi | matrix containing the values of ξ(r,μ) |
Definition at line 60 of file FuncMultipoles.cpp.
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
beta | β=f/b, where f is the linear growth rate and b is the bias |
xi_real | the real-space two-point correlation function |
xi_ | \( \overline{\xi}(r) \) |
Definition at line 388 of file FuncMultipoles.cpp.
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 \]
ss | comoving scale where the multipole is computed |
rp | std::vector containing the values of rp |
pi | std::vector containing the values of π |
xi | matrix containing the values of ξ(r,μ) |
delta_s | bin size |
Definition at line 183 of file FuncMultipoles.cpp.
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 \]
indexR | index correspondent to the comoving separation where the multipole is computed |
mu | std::vector containing the angle between the separation std::vector and the line of sight |
xi | matrix containing the values of ξ(r,μ) |
Definition at line 75 of file FuncMultipoles.cpp.
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
beta | β=f/b, where f is the linear growth rate and b is the bias |
xi_real | the real-space two-point correlation function |
xi_ | \( \overline{\xi}(r) \) |
xi__ | \( \overline{\overline{\xi}}(r) \) |
Definition at line 397 of file FuncMultipoles.cpp.
double cbl::multivariateGaussian | ( | std::vector< double > | xx, |
std::shared_ptr< void > | pars | ||
) |
int cbl::N_different_elements | ( | const std::vector< T > | vect_input | ) |
int cbl::nint | ( | const T | val | ) |
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
xx | std::vector containing the x variables |
fx | std::vector containing the f(x) variables |
xmin | minimum value of the variable |
xmax | maximum value of the variable |
seed | random seed |
|
inline |
|
inline |
overloading of the + operator, to sum two catalogues
c1 | object of class Catalogue |
c2 | object of class Catalogue |
Definition at line 58 of file GlobalFunc.h.
T cbl::P_2 | ( | const T | x | ) |
T cbl::P_4 | ( | const T | x | ) |
T cbl::P_6 | ( | const T | x | ) |
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
ra1 | the Right Ascension of the first object [radians] |
ra2 | the Right Ascension of the second object [radians] |
dec1 | the Declination of the first object [radians] |
dec2 | the Declination of the second object [radians] |
d1 | the comoving distance of the first object |
d2 | the comoving distance of the second object |
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
kk | the scales k |
Pk | the power spectrum |
bias | the bias factor |
f | the linear growth factor |
Definition at line 501 of file FuncMultipoles.cpp.
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
kk | the scales k |
Pk | the power spectrum |
bias | the bias factor |
f | the linear growth factor |
Definition at line 516 of file FuncMultipoles.cpp.
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
kk | the scales k |
Pk | the power spectrum |
bias | the bias factor |
f | the linear growth factor |
Definition at line 531 of file FuncMultipoles.cpp.
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
kk | the wave std::vector, k |
file | name of the file where the two-point correlation function is stored |
c1 | the column of the file corresponding to the comoving separation, r |
c2 | the column of the file corresponding to the two-point correlation function, ξ(r) |
r_min | the minimum value of the comoving separation used in the integral of the Fourier transform |
r_max | the maximum value of the comoving separation used in the integral of the Fourier transform |
Definition at line 160 of file FuncXi.cpp.
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
kk | the wave std::vector, k |
lgrr | std::vector containing the logarithm of the comoving separations, log10r |
lgxi | std::vector containing the logarithm of the two-point correlation function, log10ξ(r) |
r_min | the minimum value of the comoving separation used in the integral of the Fourier transform |
r_max | the maximum value of the comoving separation used in the integral of the Fourier transform |
Definition at line 141 of file FuncXi.cpp.
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)
orders | the l-th multipole desired |
kk | the scales k |
Pk | the power spectrum |
bias | the bias factor |
f | the linear growth factor |
Definition at line 546 of file FuncMultipoles.cpp.
double cbl::Pkl_Kaiser_integral | ( | const int | order, |
const double | bias, | ||
const double | f | ||
) |
function to obtain the Kaiser factor
order | the expansion order |
bias | the bias factor |
f | the linear growth factor |
Definition at line 480 of file FuncMultipoles.cpp.
double cbl::Pkl_Kaiser_integrand | ( | const double | mu, |
void * | parameters | ||
) |
integrand of the 2d power spectrum to obtain power spectrum multipole
mu | the value mu |
parameters | the parameters for the integration |
Definition at line 409 of file FuncMultipoles.cpp.
T cbl::poisson | ( | T | xx, |
std::shared_ptr< void > | pp, | ||
std::vector< double > | par | ||
) |
T cbl::Pol2 | ( | T | xx, |
std::shared_ptr< void > | pp, | ||
std::vector< double > | par | ||
) |
T cbl::Pol3 | ( | T | xx, |
void * | pp, | ||
std::vector< double > | par | ||
) |
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
[in] | XX | the Cartesian coordinate x |
[in] | YY | the Cartesian coordinate y |
[in] | ZZ | the Cartesian coordinate z |
[out] | ra | the Right Ascension [radians] |
[out] | dec | the Declination [radians] |
[out] | dd | the comoving distance |
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
[in] | XX | std::vector containing the Cartesian coordinates x |
[in] | YY | std::vector containing the Cartesian coordinates y |
[in] | ZZ | std::vector containing the Cartesian coordinates z |
[out] | ra | std::vector containing the Right Ascension values [radians] |
[out] | dec | std::vector containing the Declination values [radians] |
[out] | dd | std::vector containing the comoving distances |
T cbl::powerlaw | ( | const T | xx, |
const T | x0, | ||
const T | gamma | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
void cbl::Print | ( | const std::vector< std::vector< T >> | mat, |
const int | prec = 4 , |
||
const int | ww = 8 |
||
) |
void cbl::Print | ( | const std::vector< T > | vect, |
const int | prec = 4 , |
||
const int | ww = 8 |
||
) |
void cbl::Print | ( | const std::vector< T > | vect1, |
const std::vector< T > | vect2, | ||
const int | prec = 4 , |
||
const int | ww = 8 |
||
) |
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 |
||
) |
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
value | the value print |
prec | decimal precision |
ww | number of characters to be used as field width |
header | string that is added at the beginning of the line |
end | string that is added at the end of the line |
use_coutCBL | if true, coutCBL is used instead of std::cout |
stream | object of class std::ostream |
colour | output colour |
|
inline |
vector< double > cbl::Quartile | ( | const std::vector< double > | Vect | ) |
T cbl::radial_velocity | ( | const T | vx, |
const T | vy, | ||
const T | vz, | ||
const T | ra, | ||
const T | dec | ||
) |
double cbl::radians | ( | const double | angle, |
const CoordinateUnits | inputUnits = CoordinateUnits::_degrees_ |
||
) |
T cbl::Radius | ( | const T | Mass, |
const T | Rho | ||
) |
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
file_name | the name of the file to read |
path_name | the path where the file is stored |
column_data | vector containing the indices of the columns to read, starting the counting from 1 |
skip_nlines | the number of lines to skip |
Definition at line 410 of file Kernel.cpp.
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.
file_name | the name of the file to read |
path_name | the path where the file is stored |
column_data | vector containing the indices of the columns to read, starting the counting from 0 |
delimiter | the delimiter between the columns |
comment | the comment char at the beginning of the line |
Definition at line 464 of file Kernel.cpp.
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
[in] | filecov | input file where the covariance matrix is stored |
[out] | cov | the covariance matrix |
[out] | cov_inv | the inverse of the covariance matrix |
[in] | i1 | mininum index |
[in] | i2 | maximum index |
[in] | prec | the 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 |
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 = {} |
||
) |
void cbl::read_vector | ( | const std::string | file_vector, |
std::vector< double > & | xx, | ||
std::vector< double > & | vector, | ||
const std::vector< int > | col = {} |
||
) |
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
data | the data catalogue |
random | the random catalogue |
random_RSD | true \( \rightarrow \) RSD displacements for the random sample; false no-RSD displacements for the random sample |
cosmology | the cosmology |
redshift | the redshift |
bias | the bias |
cell_size | the cell size for density field computation |
smoothing_radius | the smoothing radius for density field computation |
interpolation_type | 0 \( \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.
T cbl::rectangular | ( | T | xx, |
std::shared_ptr< void > | pp, | ||
std::vector< double > | par | ||
) |
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
[in] | mean_redshift | the mean redshift |
[in] | boxSide | the box side |
[in] | real_cosm | an object of class Cosmology |
[out] | redshift_min | the minimum redshift |
[out] | redshift_max | the maximum redshift |
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
bias | the linear galaxy bias, b |
Volume | the survey volume, V |
density | the galaxy density, n |
std::vector<std::vector<T> > cbl::reshape | ( | std::vector< T > | vec, |
const int | size1, | ||
const int | size2 | ||
) |
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
num | the input double number |
ndigits | the number of digit figures |
Definition at line 133 of file Kernel.cpp.
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
num | the input double number |
ndigits | the number of digit figures |
Definition at line 150 of file Kernel.cpp.
void cbl::sdss2eq | ( | const std::vector< double > | lambda, |
const std::vector< double > | eta, | ||
std::vector< double > & | ra, | ||
std::vector< double > & | dec | ||
) |
void cbl::sdss_atbound | ( | double & | angle, |
const double | minval, | ||
const double | maxval | ||
) |
void cbl::sdss_atbound2 | ( | double & | theta, |
double & | phi | ||
) |
void cbl::sdss_stripe | ( | const std::vector< double > | eta, |
const std::vector< double > | lambda, | ||
std::vector< int > & | stripe, | ||
std::vector< int > & | str_u | ||
) |
void cbl::set_EnvVar | ( | const std::vector< std::string > | Var | ) |
set evironment variables
Var | std::vector containing the evironment variables to be set |
Definition at line 186 of file Kernel.cpp.
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
data | input data catalogue |
random | random catalogue |
nSamples | number of sub-regions |
polygonfile | name of the input file with polygons |
Definition at line 387 of file SubSample.cpp.
void cbl::set_ObjectRegion_mangle | ( | catalogue::Catalogue & | data, |
const int | nSamples, | ||
const std::string | polygonfile | ||
) |
set the object region in sub-regions using mangle
data | input data catalogue |
nSamples | number of sub-regions |
polygonfile | name of the input file with polygons |
Definition at line 268 of file SubSample.cpp.
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
data | input data catalogue |
random | random catalogue |
nCells_Ra | the number of cells along the R.A. direction |
nCells_Dec | the number of cells along the Dec. direction |
use_colatitude | convert declination to colatitude. This allows a contigous pixelization. Default is true. Set to false if you sample already uses colatitude |
\[ 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.
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
data | input data catalogue |
nCells_Ra | the number of cells along the R.A. direction |
nCells_Dec | the number of cells along the Dec. direction |
use_colatitude | convert declination to colatitude. This allows a contigous pixelization. Default is true. Set to false if you sample already uses colatitude |
\[ 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 498 of file SubSample.cpp.
void cbl::set_ObjectRegion_SDSS_stripes | ( | catalogue::Catalogue & | data, |
catalogue::Catalogue & | random | ||
) |
set the object region in SDSS stripes
data | input data catalogue |
random | random catalogue |
Definition at line 672 of file SubSample.cpp.
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
data | input data catalogue |
random | random catalogue |
nx | side fraction used to divide the box in the x direction |
ny | side fraction used to divide the box in the y direction |
nz | side fraction used to divide the box in the z direction |
Definition at line 338 of file SubSample.cpp.
void cbl::set_ObjectRegion_SubBoxes | ( | catalogue::Catalogue & | data, |
const int | nx, | ||
const int | ny, | ||
const int | nz | ||
) |
set the object region in sub-boxes
data | input data catalogue |
nx | side fraction used to divide the box in the x direction |
ny | side fraction used to divide the box in the y direction |
nz | side fraction used to divide the box in the z direction |
Definition at line 236 of file SubSample.cpp.
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.
data | input data catalogue |
random | random catalogue |
nz | number of redshift sub-samples |
Definition at line 44 of file SubSample.cpp.
double cbl::sgn | ( | T | val | ) |
short cbl::ShortSwap | ( | const short | s | ) |
endian conversion of a short variable
s | a short variable |
Definition at line 45 of file Kernel.cpp.
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
vect | the input std::vector |
double cbl::Sigma | ( | const std::vector< double > | vect, |
const std::vector< double > | weight | ||
) |
double cbl::sigma2_integrand | ( | const double | mu, |
void * | parameters | ||
) |
integrand of the 2d power spectrum to obtain sigma^2(k)
mu | the value mu |
parameters | the parameters for the integration |
Definition at line 446 of file FuncMultipoles.cpp.
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.
nObjects | number of objects in the sample |
Volume | the sample volume |
kk | the scales kk |
Pk_multipoles | the power spectrum multipoles |
orders | the power spectrum multipoles orders |
Definition at line 944 of file FuncMultipoles.cpp.
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
RR | the radius R [Mpc/h] |
corrType | 1 → the spherically averaged correlation function is used; 2 → the projected correlation function is used |
rr | std::vector containing comoving separations |
corr | std::vector containing the two-point correlation function |
Definition at line 227 of file FuncXi.cpp.
std::vector<T> cbl::slice | ( | const std::vector< T > | v, |
const int | start = 0 , |
||
const int | end = -1 |
||
) |
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
p1 | iterator to the first std::vector |
p2 | iterator to the second std::vector |
dim | dimension of the two std::vectors |
Definition at line 323 of file Kernel.cpp.
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
p1 | iterator to the first std::vector |
p2 | iterator to the second std::vector |
p3 | iterator to the third std::vector |
dim | dimension of the three std::vectors |
Definition at line 341 of file Kernel.cpp.
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
p1 | iterator to the first std::vector |
p2 | iterator to the second std::vector |
p3 | iterator to the third std::vector |
p4 | iterator to the four std::vector |
dim | dimension of the four std::vectors |
Definition at line 359 of file Kernel.cpp.
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
coordinate_type | the coordinate type (comoving, observed) |
l | the degree l |
m | the order m |
coord1 | the variable 1 (xx or RA) |
coord2 | the variable 2 (yy or Dec) |
coord3 | the variable 3 (zz or redshift) |
std::vector< std::vector< complex< double > > > cbl::spherical_harmonics | ( | const int | lmax, |
const double | xx, | ||
const double | yy, | ||
const double | zz | ||
) |
std::vector< std::complex< double > > cbl::spherical_harmonics_array | ( | const int | lmax, |
const double | xx, | ||
const double | yy, | ||
const double | zz | ||
) |
void cbl::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
[in,out] | xx | the std::vector x |
[in,out] | yy | the std::vector y |
[in,out] | Mat | the matrix Mat(x,y) (i.e. a std::vector of std::vectors) |
[in] | val | a number |
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.
r1 | |
r2 | |
r3 | |
L1 | the order of the first spherical bessel function |
L2 | the order of the second spherical bessel function |
L3 | the order of the third spherical bessel function |
T cbl::TopHat_WF | ( | const T | kR | ) |
T cbl::TopHat_WF_D1 | ( | const T | kR | ) |
std::vector<std::vector<T> > cbl::transpose | ( | std::vector< std::vector< T >> | matrix | ) |
transpose a matrix
matrix | the input matrix |
double cbl::trapezoid_integration | ( | const std::vector< double > | xx, |
const std::vector< double > | yy | ||
) |
void cbl::unique_unsorted | ( | std::vector< double > & | vv | ) |
erase all the equal elements of the input std::vector
[in,out] | vv | a std::vector of double values |
Definition at line 296 of file Kernel.cpp.
void cbl::unique_unsorted | ( | std::vector< int > & | vv | ) |
erase all the equal elements of the input std::vector
[in,out] | vv | a std::vector of integer values |
Definition at line 284 of file Kernel.cpp.
void cbl::unique_unsorted | ( | std::vector< std::string > & | vv | ) |
erase all the equal elements of the input std::vector
[in,out] | vv | a std::vector of integer values |
Definition at line 308 of file Kernel.cpp.
int cbl::used_memory | ( | const int | type | ) |
get the memory used by current process in kB
type | 1 \(\rightarrow\) Physical Memory (RAM); 2 \(\rightarrow\) Virtual Memory |
Definition at line 211 of file Kernel.cpp.
T cbl::v_M_vt | ( | const std::vector< T > | vv, |
const std::vector< std::vector< T >> | MM | ||
) |
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
nRan | number of elements to be extracted |
xx | std::vector containing the x variables |
fx | std::vector containing the f(x) variables |
xmin | minimum value of the variable |
xmax | maximum value of the variable |
seed | random seed |
void cbl::vectorReadFromBinary | ( | std::ifstream & | fin, |
std::vector< T > & | vec, | ||
size_t | NN | ||
) |
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
[out] | dc | dc: vector containing the output values of the binned comoving distances |
[out] | nObj | vector containing the smoothed number of objects at each dc, estimated with the Vmax method |
[in] | D_C | vector containing the comoving distances of the objects |
[in] | zobj_min | minimum redshift of the objects |
[in] | zobj_max | maximum redshift of the objects |
[in] | z_min | minimum redshift used to enlarge the range, useful to smooth the redshift distributions |
[in] | z_max | maximum redshift used to enlarge the range, useful to smooth the redshift distributions |
[in] | zbin_min | minimum redshift of the output binning |
[in] | zbin_max | maximum redshift of the output binning |
[in] | cosm | object of class Cosmology |
[in] | Area | area of the survey |
[in] | nObjRan | number of random objects used to assess the smoothed distribution |
[in] | norm | 0 → don't normalize; 1 → normalize the distribution to the number of objects |
[in] | file_Vmax | the output file used to store the smoothed distribution |
[in] | delta_dc_Vmax | Δdc: the bin size of the output smoothed distribution |
[in] | seed | the random seed |
Definition at line 44 of file FuncCosmology.cpp.
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
boxSize | the box side |
frac | the side fraction (if the input box is a sub-box of a box with side equal to boxSize) |
Bord | the redshift interval that is cutted at the bords of the box |
mean_redshift | the mean redshift |
real_cosm | an object of class Cosmology |
T cbl::volume_sphere | ( | const T | RR | ) |
|
inline |
double cbl::wigner3j | ( | double | l1, |
double | l2, | ||
double | l3, | ||
double | m1, | ||
double | m2, | ||
double | m3 | ||
) |
std::vector< double > cbl::wigner3j | ( | double | l2, |
double | l3, | ||
double | m1, | ||
double | m2, | ||
double | m3 | ||
) |
double cbl::wigner3j_auxA | ( | double | l1, |
double | l2, | ||
double | l3, | ||
double | m1, | ||
double | m2, | ||
double | m3 | ||
) |
double cbl::wigner3j_auxB | ( | double | l1, |
double | l2, | ||
double | l3, | ||
double | m1, | ||
double | m2, | ||
double | m3 | ||
) |
double cbl::wigner_3j | ( | int | j1, |
int | j2, | ||
int | j3, | ||
int | m1, | ||
int | m2, | ||
int | m3 | ||
) |
double cbl::wigner_6j | ( | const int | j1, |
const int | j2, | ||
const int | j3, | ||
const int | j4, | ||
const int | j5, | ||
const int | j6 | ||
) |
double cbl::window_function | ( | const double | x, |
const double | min = -1 , |
||
const double | max = 1 |
||
) |
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
rp | rp: comoving separation perpendicular to the line-of-sight |
file | name of the file where the two-point correlation function is stored |
r_max | the maximum value of the comoving separation used in the integral |
Definition at line 207 of file FuncXi.cpp.
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 \]
rp | rp: comoving separation perpendicular to the line-of-sight |
rr | std::vector containing the central values of the binned comoving separations, r |
xi | std::vector containing the central values of the binned two-point correlation function, ξ(r) |
r_max | the maximum value of the comoving separation used in the integral |
Definition at line 192 of file FuncXi.cpp.
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
r | the scales r |
kk | the scales k |
Pk0 | the power spectrum monopole |
k_cut | the k scale to cut the integrand |
cut_pow | the power of the integrand cut |
IntegrationMethod | method for integration |
Definition at line 569 of file FuncMultipoles.cpp.
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
alpha_perpendicular | the shift along the line of sight |
alpha_parallel | the shift parallel to the line of sight |
rr | the scales r |
xi0_interp | the xi0 interpolator |
xi2_interp | the xi2 interpolator |
xi4_interp | the xi4 interpolator |
Definition at line 772 of file FuncMultipoles.cpp.
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
alpha_perpendicular | the shift along the line of sight |
alpha_parallel | the shift parallel to the line of sight |
rr | the scales r |
rl | the scales at which the multipoles are defined |
Xi0 | the 2pfc monopole |
Xi2 | the 2pfc quadrupole |
Xi4 | the 2pfc hexadecapole |
Definition at line 853 of file FuncMultipoles.cpp.
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
alpha_perpendicular | the shift along the line of sight |
alpha_parallel | the shift parallel to the line of sight |
rr | the scales r |
xi0_interp | the xi0 interpolator |
xi2_interp | the xi2 interpolator |
Definition at line 736 of file FuncMultipoles.cpp.
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
alpha_perpendicular | the shift along the line of sight |
alpha_parallel | the shift parallel to the line of sight |
rr | the scales r |
rl | the scales at which the multipoles are defined |
Xi0 | the 2pfc monopole |
Xi2 | the 2pfc quadrupole |
Definition at line 811 of file FuncMultipoles.cpp.
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
rr | the scales r |
kk | the scales k |
Pk2 | the power spectrum quadrupole |
k_cut | the k scale to cut the integrand |
cut_pow | the power of the integrand cut |
IntegrationMethod | method for integration |
Definition at line 624 of file FuncMultipoles.cpp.
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,π)
beta | β=f/b, where f is the linear growth rate and b is the bias |
bias | the bias |
xi_real | the real-space correlation function |
xi_ | \( \overline{\xi}(r) \) |
xi__ | \( \overline{\overline{\xi}}(r) \) |
P_2 | the Legendre polynomial P2 |
P_4 | the Legendre polynomial P4 |
Definition at line 473 of file FuncXi.cpp.
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,π)
rp | rp: 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 |
bias | the bias |
funcXiR | pointer 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_nl | 0 \( \rightarrow \) linear bias; \( \rightarrow \) 1 non-linear bias |
bA | the parameter bA used to model the bias |
Definition at line 664 of file FuncXi.cpp.
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,π)
rp | rp: 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 |
bias | the bias |
rad_real | std::vector containing the binnend values of the comoving separations |
xi_real | std::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) \) |
index | index for internal use |
bias_nl | 0 \( \rightarrow \) linear bias; \( \rightarrow \) 1 non-linear bias |
bA | the parameter bA used to model the bias |
Definition at line 491 of file FuncXi.cpp.
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,π)
rp | rp: 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 |
bias | the bias |
sigmav | σ12 |
funcXiR | pointer 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) \) |
var | 1/[H(z)a(z)] |
FV | 0 \( \rightarrow \) exponential; \( \rightarrow \) 1 gaussian |
bias_nl | 0 \( \rightarrow \) linear bias; \( \rightarrow \) 1 non-linear bias |
bA | the parameter bA used to model the bias |
v_min | the minimum value of the velocity used in the convolution |
v_max | the maximum value of the velocity used in the convolution |
step_v | the step of the convolution integral |
Definition at line 696 of file FuncXi.cpp.
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,π)
rp | rp: 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 |
bias | the bias |
sigmav | σ12 |
rad_real | std::vector containing the binnend values of the comoving separations |
xi_real | std::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) \) |
var | 1/[H(z)a(z)] |
FV | 0 \( \rightarrow \) exponential; \( \rightarrow \) Gaussian |
index | index for internal use |
bias_nl | 0 \( \rightarrow \) linear bias; \( \rightarrow \) non-linear bias |
bA | the parameter bA used to model the bias |
v_min | the minimum value of the velocity used in the convolution |
v_max | the maximum value of the velocity used in the convolution |
step_v | the step of the convolution integral |
Definition at line 574 of file FuncXi.cpp.
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
rr | the scales r |
kk | the scales k |
Pk4 | the power spectrum hexadecapole |
k_cut | the k scale to cut the integrand |
cut_pow | the power of the integrand cut |
IntegrationMethod | method for integration |
Definition at line 680 of file FuncMultipoles.cpp.
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
rr | the comoving separation, r |
file | name of the file where the power spectrum is stored |
c1 | the column of the file corresponding to the wave std::vector, k |
c2 | the column of the file corresponding to the power spectrum, P(k) |
k_min | the minimum value of the wave std::vector used in the integral of the Fourier transform |
k_max | the maximum value of the wave std::vector used in the integral of the Fourier transform |
aa | parameter used to smooth the integrand, given by the eq. 24 of Anderson et al. 2012 |
prec | accuracy of the GSL integration |
Definition at line 109 of file FuncXi.cpp.
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
rr | the comoving separation, r |
lgkk | std::vector containing the logarithm of the wave std::vectors, log10k |
lgPk | std::vector containing the logarithm of the power spectrum, log10P(k) |
k_min | the minimum value of the wave std::vector used in the integral of the Fourier transform |
k_max | the maximum value of the wave std::vector used in the integral of the Fourier transform |
aa | parameter used to smooth the integrand, given by the eq. 24 of Anderson et al. 2012 |
prec | accuracy of the GSL integration |
Definition at line 80 of file FuncXi.cpp.
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
rp | rp: comoving separation perpendicular to the line-of-sight |
r0 | r0: the clustering normalization |
gamma | γ: the clustering slope |
Definition at line 278 of file FuncXi.cpp.
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} \]
beta | β=f/b, where f is the linear growth rate and b is the bias |
Definition at line 287 of file FuncXi.cpp.
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 \]
f_sigma8 | f*σ8 |
bias_sigma8 | b*σ8 |
Definition at line 296 of file FuncXi.cpp.
double cbl::XiMultipoles_from_Xi2D_integrand | ( | const double | mu, |
void * | parameters | ||
) |
integrand to obtain the 2PCF multipoles from 2D 2pcf in polar coordinates
mu | the value mu |
parameters | the parameters for the integration |
Definition at line 435 of file FuncMultipoles.cpp.
double cbl::XiMultipoles_integrand | ( | const double | kk, |
void * | parameters | ||
) |
integrand to obtain covariance for the 2PCF multipoles
kk | the value kk |
parameters | the parameters for the integration |
Definition at line 420 of file FuncMultipoles.cpp.
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
mu_min | the lower limit of integration for wedges |
delta_mu | the mu width for wedges |
alpha_perpendicular | the shift along the line of sight |
alpha_parallel | the shift parallel to the line of sight |
rr | the scales r |
xi0_interp | the xi0 interpolator |
xi2_interp | the xi2 interpolator |
xi4_interp | the xi4 interpolator |
Definition at line 901 of file FuncMultipoles.cpp.
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
mu_min | the lower limit of integration for wedges |
delta_mu | the mu width for wedges |
alpha_perpendicular | the shift along the line of sight |
alpha_parallel | the shift parallel to the line of sight |
rr | the scales r |
rl | the scales at which the multipoles are defined |
Xi0 | the 2pfc monopole |
Xi2 | the 2pfc quadrupole |
Xi4 | the 2pfc hecadecapole |
Definition at line 923 of file FuncMultipoles.cpp.