5 {
6
7 double Omegab = 0.049;
8 double OmegaCDM = 0.2637;
10 double As = 2.215e-9;
11 double ns = 0.966;
13
14
15 std::string infofile = "transfer_infofile.txt";
17 camb.read_transfer(infofile);
18
19
20 std::string pofkfile = "camb_transfer_data/lcdm_nu0.2_matterpower_z0.000.dat";
21 auto data = camb.read_power_single(pofkfile);
23
24
25 const double scale_factor = 1.0;
26 const double kmin = 0.001;
27 const double kmax = 10.0;
28 const int npts = 200;
29 std::cout << "# k (h/Mpc) P(k) (Mpc/h)^3 Pcb(k) (Mpc/h)^3 Pcb(k) (Mpc/h)^3 \n";
30 for (int i = 0; i < npts; i++) {
31 double k =
std::exp(std::log(kmin) + std::log(kmax / kmin) * i /
double(npts));
32 std::cout << std::setw(15) <<
k <<
" ";
33 std::cout << std::setw(15) << camb.get_total_power_spectrum(
k, scale_factor) <<
" ";
34 std::cout << std::setw(15) << camb.get_cdm_baryon_power_spectrum(
k, scale_factor) <<
" ";
35 std::cout << std::setw(15) << pofk_cb_spline(
k) <<
"\n";
36 }
37}
This class reads transfer/power-spectrum data from the output of a Einstein-Boltzmann solver.
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are...