FML
Typedefs | Functions
Main.cpp File Reference

Go to the source code of this file.

Typedefs

using Spline = FML::INTERPOLATION::SPLINE::Spline
 

Functions

int main ()
 

Typedef Documentation

◆ Spline

Definition at line 3 of file Main.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 5 of file Main.cpp.

5 {
6
7 double Omegab = 0.049;
8 double OmegaCDM = 0.2637;
9 double kpivot = 0.05;
10 double As = 2.215e-9;
11 double ns = 0.966;
12 double h = 0.671;
13
14 // Read all the CAMB transfer function data and spline the functions T_i(k,a) and P_i(k,a)
15 std::string infofile = "transfer_infofile.txt";
16 FML::FILEUTILS::LinearTransferData camb(Omegab, OmegaCDM, kpivot, As, ns, h);
17 camb.read_transfer(infofile);
18
19 // If we only have a single power-spectrum file: read it and spline it
20 std::string pofkfile = "camb_transfer_data/lcdm_nu0.2_matterpower_z0.000.dat";
21 auto data = camb.read_power_single(pofkfile);
22 Spline pofk_cb_spline(data.first, data.second);
23
24 // Output the power-spectrum
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}
const double h
Definition: Main.cpp:66
const double kpivot
Definition: Main.cpp:69
This class reads transfer/power-spectrum data from the output of a Einstein-Boltzmann solver.
Definition: CAMBReader.h:50
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are...
Definition: Spline.h:80
const double exp
Definition: Global.h:259
data
Definition: test.py:10