CAMB/EFTCAMB/CosmoMC - icg.port.ac.ukicg.port.ac.uk/~jschewts/cantata/CAMB/CAMB_lecture.pdf ·...
Transcript of CAMB/EFTCAMB/CosmoMC - icg.port.ac.ukicg.port.ac.uk/~jschewts/cantata/CAMB/CAMB_lecture.pdf ·...
What will we do?1. How to use the codes
2. Learn settings and possible customizations
3. A glimpse at their structuresWe will not go through all the source code, only things needed for the most common modifications
4. Exercises on use and modifications
Requirements● gfortran (gcc6) or intel (ifort14+) compiler● python2.7 or python3.4
How to get these:
● Linux/Mac: sudo apt-get install “package” should do the trick● Windows:
For windows users, we suggest to use the CosmoBox virtual machine.Once that is set up you will not need to install much (or anything at all)
Step 0: install the working environmentGo to http://cosmologist.info/CosmoBox/ and follow the instructions to install Cosmobox Desktop.
As explained you just need to download and install
❏ VirtualBox (https://www.virtualbox.org/wiki/Downloads)❏ Vagrant (https://www.vagrantup.com/downloads.html)❏ Or use the DockerToolbox (Mac and windows...I used this)
Create your working directory ( e.g. Corfu2017/) and run
> cd Corfu2017/> vagrant init cmbant/cosmobox> vagrant up
Step 0.1: run cosmobox
You can suspend and resume the virtual machine by running
> vagrant suspend> vagrant resume
Inside cosmobox you can download, compile the code as shown in few slides!
If you need further tools (e.g. plotting tools) you can get them as in any unix system > sudo apt-get install gnuplot
On the workstationsWe add issues in installing all the requirements there
To solve it quickly we installed the CosmoBox also thereFrom your home folder:> vagrant resume
You now have an Ubuntu machine within an Ubuntu machine!
CAMBCode for Anisotropies in the Microwave Background
Main authors: Antony Lewis and Anthony Challinor
Documentation: README, CAMB notes and python documentation
Main references:definitely too many to list, refer to the references section of the README
Outline1. The black box approach: compiling and running
2. Exercise: how to use CAMB
3. A glimpse at the structure
4. Exercise: modify CAMB
5. Extra exercise (additional transfer function)
What’s CAMB?
Code for Anisotropies in the Microwave BackgroundLanguage: fortran + python wrapper
Given a set of cosmological parameters, it solves Boltzmann equations and computes:
● CMB power spectra● Transfer functions● Matter power spectrum
Assuming ~ΛCDM (can use w=w(z) dark energy)
DownloadingCAMB is available at camb.info (with an informative readme page) or on github
Get the code with:
> git clone https://github.com/cmbant/CAMB.git
There is also a web interface on the LAMBDA website
Schematic structure
camb.f90Module CAMB(main wrapper for camb routines)
params.iniInput cosmologyAnd options
inidriver.F90Reads iniRuns the code
cmbmain.f90Module CAMBmain(main integration modules, computes cls, etc…)
calls
calls
Cosmology calculators
callscalls
Output
CompilingMakefile and Makefile_main contain instructions to compile the code.Generally, they don’t need to be modified.
Some choices can be done at the level of the Makefile:
Switch to equations_ppf.f90 and then compile:> make
...fingers crossed!
Cosmology and options: params.iniCosmology and general options are passed to CAMB through the params.ini(or through the python wrapper).
What the code should do and how
Cosmological parameters(other parameters below)
Output control and accuracy
Transfer functions output and usage
Accuracy options: trade speed for accurate calculations
Run the codeDepending on the choices you made in the params.ini file you will have different kind of output.
Let’s give it a try...
> ./camb params.ini
Python wrapperCAMB now has also a python wrapper.From the pylab folder
> python setup.py install --user
How to use it? Call it in your python scriptsGood extensive demo in the docs
http://camb.readthedocs.io/en/latest/CAMBdemo.html
Exercise:Reproduce the Planck best fit!
● Use the marginalized values obtained analyzed temperature (Table 4 - fitst column) and temperature+lensing (Table 4 second column) from the Planck 2015 parameter paperto obtain CMB spectra
● Plot temperature and lensing theoretical spectra on top of the data
● use the data available on Google Drive (temperature and lensing data point)These are taken from the LAMBDA website
Is there a difference between the two cases? Why?
Planck and lensingThere is a difference in lensing amplitude if you measure it with Planck T,E,B spectra or with lensing extraction algorithms
Planck 2015 XIII
Schematic structure
camb.f90Module CAMB(main wrapper for camb routines)
params.iniInput cosmologyAnd options
inidriver.F90Reads iniRuns the code
cmbmain.f90Module CAMBmain(main integration modules, computes cls, etc…)
calls
calls
Cosmology calculators
callscalls
Output
To use CAMB in an external code: use CAMB, call CAMB_GetResults (see CosmoMC)
What’s in the files?Utilities
● bessels.f90● inifile.f90● Matrix_utils.f90● subroutines.f90● utils.F90● writefits.f90
Cosmology
● camb.f90● cmbmain.f90● cosmorec.f90● equations.f90● halofit.f90● hyrec.f90● lensing.f90● modules.f90● power_tilt.f90● recfast.f90● reionization.90● SeparableBispectrum.f90
Driver and params
● inidriver.F90● params.ini
A closer look at cosmology Recombination:
● recfast.f90● cosmorec.f90● hyrec.f90
Modules:
● Modules.f90variables declaration, background functions, P(k), output
Reionization:
● reionization.f90
CMB lensing:
● lensing.f90
Non linear P(k):
● halofit.f90● halofit_ppf.90
Bispectrum:
● SeparableBispectrum.f90
Initial power spectrum:
● power_tilt.f90initial power parameters definition and reading
Evolution and transfer :
● equations.f90● equations_ppf.f90
CMB Cls:
● cmbmain.f90
A “small” subtletyCAMB stores the evolution in two different places:
1. EV%OutputTransfer These functions contain the evolution used to compute P(k,z) for the given choice of species. This is not transformed in spherical harmonics, thus Bessel functions are not used here.
2. sources(1-3)These terms are integrated together with the Bessel functions to obtain Cls
Transfer functions and P(k)Starting from primordial power spectrum, evolved observables are computed in terms of the transfer functions, e.g.
These are computed in equations and used in various parts of the code
Sources and CMBTo obtain Cls one has to integrate the source terms with the Bessel functions in k and z (see Ingunn’s lecture). This is done in cmbmain.f90
Source_q are interpolations of the source term computed in equations.f90 multiplied by the bessel functions
Background functionsGiven the evolution computed in equations.f90 CAMB computes some relevant functions that are used throughout the code and can be also called by external codes.
In module.f90 you can find for example all the routines computing the P(k).You can also find several functions computing background quantities, e.g.
Cosmological parameters
CAMB has two different procedures for parameters definitions.We can broadly divide parameters in two classes:
1. Expansion and density parametersH_0, baryon, DM and neutrino densities, w, …
2. Initial power parametersA_s, n_s, ...
Exercise: features in the primordial P(k)At low multipoles, data seem to prefer a lower power than what we expect
Inflation features?The low-l problem can be tackled thinking of inflationary features in the primordial power spectrum, e.g.
Benetti et al. 2012
A phenomenological approachYou want to investigate this issue, but you don’t know much about inflation.
What to do?
1. Work with your inflationary friend2. Give up and go enjoy the sun on the beach3. Use a phenomenological parametrization
A phenomenological approach Try to include a parametrized modification to the primordial power spectrum
Initial P(k) is computed in power_tilt.f90Include here new parameters and modify P(k)
Include a print to see the new primordial spectrum
Tips● Modifications need to be done where primordial power spectrum is defined:
power_tilt.f90
● Define the parameters in InitialPowerParams type● Read them in InitialPower_ReadParams● Set default value SetDefPowerParams● Modify the power spectrum in ScalarPower
Basically follow one of the standard initial power parameters, e.g. k_0_scalar
And remember to include the new parameter in params.ini!
Extra exercise: a modified transfer functionAdd an extra contribution to CDM transfer function
This is an effect of models such as Unified Dark Matter models, see 1103.0234
Implement equations (8) and (11) in CAMB.Transfer functions are defined in equations_ppf.f90 (or equations.f90)
Remember to define the new parameter.
Tips● Define a new subroutine, where the new transfer function is computed
● Call the subroutine in the relevant part of the codes (output and derivs subroutines in equations_ppf.f90)
● Add the result properly to the transfer functions, i.e. to EV%OutputTransfer(Transfer_cdm)EV%OutputTransfer(Transfer_tot)and to the lensing source term, sources(3)
● Use CAMB’s subroutine for bessel functionscall BJL(order,argument,result)