CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
sizeFunction.cpp

This example shows how to compute the theoretical size function of cosmic voids

// ==========================================================================
// Example code: how to compute the theoretical size function of cosmic voids
// ==========================================================================
#include "Cosmology.h"
int main () {
try {
// -------------------------------------------------------------
// ----- compute the Sheth & van de Weygaert size function -----
// -------------------------------------------------------------
// set the cosmology using Planck18 parameters
// logarithmic binning in the void effectiv radii
const std::vector<double> radius = cbl::logarithmic_bin_vector(10, 1., 30.);
// redshift
const double redshift = 0.;
// effective bias of the tracers (e.g. galaxies or galaxy clusters) used to detect the voids
const double b_eff = 1.;
// print the size function
std::cout << "The size function at z = " << redshift << " is :" << std::endl;
for (auto && rr : radius)
std::cout << std::scientific << std::setprecision(6) << Planck18.size_function(rr, redshift, "SvdW", b_eff) << " (h/Mpc)^3 at R = " << std::defaultfloat << std::setprecision(3) << rr << " Mpc/h" << std::endl;
}
catch (cbl::glob::Exception &exc) { std::cerr << exc.what() << std::endl; exit(1); }
return 0;
}
The class Cosmology.
int main()
main function to create the logo of the CosmoBolognaLib
Definition: Logo.cpp:41
The class Cosmology.
Definition: Cosmology.h:277
The class Exception.
Definition: Exception.h:111
const char * what() const noexcept override
the error description
Definition: Exception.h:203
@ _Planck18_
Planck collaboration 2018, Paper VI: Table 2, TT,TE,EE+lowE+lensing.
std::vector< T > logarithmic_bin_vector(const size_t nn, const T min, const T max)
fill a std::vector with logarithmically spaced values
Definition: Kernel.h:1621