You are on page 1of 16

In this notes I am going to document my experience in an summer research

internship at University of Texas at Dallas, place where I am/was working


with Dr. Mustapha Ishak and his PhD student Weikang Lin using CAMB and
CosmoMC in order to constraint cosmological parameters(for the moment...).

Cosmological parameters
In this section I will describe to my understand, what are the cosmological
models? but more precisely, what are the cosmological parameters?, what
is the importance of constraint them and how we can do this?. In this
kind of questions we are going to understand why programs like CAMB and
CosmoMC are importants.

The Friedmann-Lemaitre-Robertson-Walker model


The first approximation to a model in order to describe the composition and
the evolution of the universe is the Friedmann-Lemaitre-Robertson-Walker
model(FLRW model), this model is based principally in two hypothesis, that
the universe is isotropic and homogeneous at very large scales. In this model,
we begin with the metric:

dr2
 
2 2 2 2 2 2 2 2
ds = dt + a(t) + r d + r sen d , (1)
1 r2
where we used spherical coordinates, a(t) is the scale factor which evolve
with time, also, is a constant which could be 1, 0 or -1 and tell us the
spacial curvature(see fig.??), this is, if the universe is closed( = 1),
open( = 1) or flat( = 0).

First, we have to compute the solutions using Einstein equations, so we


can use the relation between the line element given by equation (1) and the
metric tensor ds2 = g dx dx in order to get
 
1 O
g = , (2)
O a(t)2 gij
1
1kr2
0 0
where, O corresponds to 3x3 zero matrices and gij = 0 r2 0 .
2 2
0 0 r sen ()

1
Figure 1: Shape of the universe

Then, the non-zero Christoffel Symbols are

0ij = aa
gij , (3)

a
i0j = ji (4)
a
and
lij .
lij = (5)
We want to form the Einstein equations R 21 g R + g = 8GT
with c = 1, so now with the Christoffel Symbols we can compute the non-zero
Ricci Tensors, that are given by

ij + gij (2a 2 + a
Rij = R a) (6)
and
a

R00 = 3 . (7)
a
We have to note, that R ij = k(d 1)
gij where d is the dimension of the

matrix gij , in this case d = 3 so Rij = 2kgij .

2
Furthermore, we need to get the Ricci scalar,

a 2
 
a k
R=6 + + . (8)
a a2 a2
Now, with these equation calculated we can compute the Einstein equa-
tions, but before we have to define our stress-energy tensor, we set

T = ( + p)u u + pg . (9)
This way of define T is consistent with the cosmological principle, that
the universe is isotropic and homogeneous, u is the four velocity vector,
is the density of the universe and p is its pressure. Then, in a comoving
framework, that is a framework in which the observer moves with the fluid,
we can set u = (1, 0, 0, 0), then the stress-energy tensor is given by
 
O
T = (10)
O pa2 (t) gij
Thus, now we can form the Einstein equations, first G00 + g00 = 8GT00
leads to

a 2 + k
3 = 8G, (11)
a2
and from Gij + gij = 8GTij we get

a
k a 2
2 2 2 + = 8Gp (12)
a a a
These last equations, are the solutions of the Einstein equations.
Finally, applying the energy conservation law, from T;0 = 0(where ;
denotes covariant derivative) we obtain
d a
+ 3 (p + ) = 0. (13)
dt a
If we set an equation of state p = w we can solve (13) and then obtain
a33w . Then, for matter (w = 0) we have a3 and we can set
 a 3
0
m = m0 (14)
a
Analogously, for radiation (w = 13 ) we have a4 and we can set

3
 a 4
0
R = R0 (15)
a
This equations will be very important when we define the density param-
eters.

Hubbles law and redshift


In order to shows what is the redshift and how is this related to the Hubbles
law we used Robertson-Walker coordinates in which we are in the center of
our framework. Now, using the line element given in equation (1), we are
going to considering a light ray coming in the radial direction(this is, d = 0
and d = 0), then for light-like event we have to set ds2 = 0, thus from (1)
is easy to deduce
dr
dt = a, (16)
1 kr2
where the minus sign is chosen because if r decreases t increases.

Now, we need to see fig. in order to imagine a far source of light from
us, imagine that the source is at a distance R and emitted a light ray at
a time te , then that light arrives to us at a time t0 , also, at another time
te + ce (where e is the wavelength of the light ray emitted and c is the speed
of light) other light ray is emitted and arrives to us at t0 + c0 where 0 is the
wavelength of the light ray that we observed here and it could be different
for the initial wavelength because of the expansion of the universe. Then,
both light rays departed practically at the same distance at arrive to us(we
are in the 0 coordinate in our reference frame), then we can set
0
Z t0 Z 0 Z t0 +
dt dr c dt
= = . (17)
te a(t) R 1 k2 te + ce a(t)
From here, with a little calculus, is not difficult to obtain
0
Z te + ce Z t0 +
dt c dt
= . (18)
te a(t) t0 a(t)
Then, we can suppose a(t) constant with values a(te ) and a(t0 )(this as-
sumption is very logically, because 109 m and c 109 m/s, this give us

4
a difference of time of 1018 s!) , then, we can solve, change
c
= 1 (where
is the frequency) and obtain

a(t0 ) e
= , (19)
a(te ) 0
but this is precisely a redshift equation! if a(t) increase for our source
of light, then decreases and that corresponds to a redshift, inversely, if
a(t) decreases, then increases and this case corresponds to a blueshift.
Furthermore, is convenient to define

a(t0 )
1+z , (20)
a(t)
where we dropped the e sub index for the time in which the light ray was
emitted.

One time defined an equation for the redshift, the next thing to do is
expand a(t) around a(t0 )(this is equivalent to set z nearly to 0), we get

a(t) = a(t0 ) + (t t0 )a(t


0) +
(21)
= a(t0 ) + (t t0 )a(t0 )H0 + ,
a(t
0)
where we are defined H0 a(t 0)
, also called the Hubble constant which
approximately value is 70 km s M pc1 . Is important to note that, if
1

we evaluated a(t)

a(t)
instead of the previous quantity, this is called the Hubble
parameter(is not evaluated at today) and is identifying by H.

Also, from equation (21) and using (20) we can get

1 + (t t0 )H0 + = (1 + z)1 . (22)


Expanding last equation for small redshifts leads to

z ' H0 (t0 t) (23)


If we recall that c(t0 t) = d (but we have set c = 1) and consider small
redshifts we can approximate the last equation to

z ' H0 d. (24)

5
This equation is the famous Hubbles law, this is, a proportional equiva-
lence between the redshift and the distance for the stars, that for many years
astronomers wanted to find, even until now. Is important to note that this
relation is only valid for small redshifts.

Density parameters and the age of the universe


Another useful parameters are the density parameters, that are fractions of
densities. In order to define these parameters we have to use equation(11)
and we shall rewrite the equation (11) as
k
2 2+ =1 (25)
c H a 3H 2
3H02
where c 8G
is the critic density and H is the Hubble parameter.

Now, we can split the density into = m + R . Using equations (14)


and (15) we can obtain a more convenient form,
 a 3  a 4
0 0
= m0 + R0 . (26)
a a
If we substitute equation (25) into (24), we obtain
m0  a0 3 R0  a0 4 k
+ 2 2+ = 1. (27)
c a c a H a 3H 2
We are interested to know the composition of the universe in our time, so
if we set t = t0 we are able to define density parameters that we can measure
at today. Thus, with the previous considerations equation (26) leads to
m0 R0 k
+ 2 2+ = 1, (28)
c c H0 a0 3H02
and we define our density parameters as
m0 R0 k
m = , R = , k = , = . (29)
c c H02 a20 3H02
Thus, with these definitions, equation (27) can be rewritten as

m + R + k + = 1. (30)

6
Also, is useful sometimes to split m into m = b + c for baryons and
cold dark matter, respectively.

Another useful parameter is t0 , the age of the universe, in order to com-


pute this parameter we are going to rewrite equation (11) as
r
a k 8G
H(a) = 2+ . (31)
a 3 a 3
Then, using definitions given in equation (28) we can obtain
r
a  a 2
0
 a 3
0
 a 4
0
= H0 + k + m + R . (32)
a a a a
We can rearrange the last equation in order to put time in terms of redshift
using the definition given in (20), so we get

dz
dt = p . (33)
H0 (1 + z) + k (1 + z)2 + m (1 + z)3 + R (1 + z)4
From this point, one need to integrate the last relation in order to obtain
1
the age of the universe, but for simplicity it is useful to define x = 1+z as a
change of variable and integrate from x = 0(when z ) to x = 1(when
z 0), that is, from the beginning until now. Doing these change we obtain
Z 1
1 dx
t0 = , (34)
H0 0 x + k x2 + m x3 + R x4
where t0 denotes the age of the universe, which its currently value is
approximately (13.7 0.2)109 years.

Constraining cosmological parameters

Software applied to constraint cosmological


parameters
CosmoBox
CosmoBox is a virtual environment that could be useful in order to compile
and run CAMB and CosmoMC. More practically, CosmoBox is like another

7
Figure 2: CosmoBox using VirtualBox and Vagrant

virtual computer that you can run and which has all the required packages
to use CAMB and CosmoMC.

To install CosmoBox, you need to go to http://cosmologist.info/CosmoBox/,


then download Vagrant, VirtualBox and install both programs like you do
normally.

Now, if you are in windows the next step is execute cmd.exe and then
change to the direction where you want to work with CAMB and CosmoMC,
then you have to write the following commands:
vagrant init cmbant/cosmobox
vagrant up

After this, VirtualBox must open and then you will have a virtual envi-
ronment where you can use CAMB and CosmoMC(see fig).

Finally, is important to mention that you could have difficulties in the


process, for example, I needed to enter to the BIOS of my computer to enable
the option virtualization but another people need to disable other options,

8
etc.

CAMB
Code for Anisotropies in the Microwave Background(CAMB) is a program
that works with data from the Cosmic Microwave Background(CMB) and
some input parameters in order to compute the spectra. For example, some
of the outputs that can be obtained by CAMB is the Power Spectrum of the
CMB(see fig.??).

Figure 3: Power Spectrum of the CMB

How to install CAMB


If you want to install CAMB, first you need to have the appropriate version
of Fortran(Fortran 90 or higher) but if you have installed CosmoBox you
would have the required version already.

The second step is download CAMB in http://camb.info/ and then


unzip the file in the terminal with the command tar xfv filename for tar.gz.

9
The next thing to do is modify your makefile,you have to open makefile and
then you have to type the appropriate compiler for fortran in the sentence
F90C = compiler (in my case, F90C = gfortran). Then, you need to type the
command make in the terminal, if there is no error, then for a test run you
can type command ./camb params.ini.

Input and output


The input parameters for CAMB are introduced in the file params.ini that
appears in the folder where you installed CAMB. In the params.ini file is
indicated which are the input parameters, it is important to note that we are
talking of parameters for background, this means that we do not use all the
cosmological parameters in the input, we just keep with a few like b , c ,
, and H0 , but also, the programs use a lot more.

Now, The way that we run the program is, first, we need to set our pa-
rameters in params.ini and then, in the same file, established the output
root that is where we indicated our output file. We can change this, in the
line output root = name of the output file(in my case, output root
= test) but is important to consider that every time we run the program,
CAMB will save the output file replacing the previous one if we do not change
the name in the output root.

One time we set our input, we can run CAMB writing in the termi-
nal the command ./camb params.ini and automatically the program must
compute several parameters(see fig.??). The output files will save in the
principal folder with extensions like lensedCls.dat, scalCls.dat, etc(in my
case, test scalCls.dat, for example).

Then, we have to plot the results, for CAMB, I use Gnuplot but this is
optional. With Gnuplot, you just have to type plot name of the out-
put file ...Cls.dat(in my case, plot test scalCls.dat, to obtain the power
spectrum), this command will just give you the plot, you can use more op-
tions to make a better plot(see fig5 and compare with figure ??).

The other output files can be plotting analogously.

10
Figure 4: run test with camb

CosmoMC
CosmoMC is Cosmological Monte Carlo, so like the name indicates, Cos-
moMC is a program that uses the Monte Carlo Method in order to compute
cosmological parameters with some uncertainty. Also, CosmoMC uses Cl
power spectrum calculations by CAMB.

How to install CosmoMC


If you want to install CosmoMC, you need at least Intel Fortran 14(ifort 14),
gfortran 6(GCC 6) or VirtualBox installed on your computer. Then, you
have to download CosmoMC in http://cosmologist.info/cosmomc/ and un-
zip the file tar xvf filename.tar.gz for tar.gz, later you have to run make
in the terminal.

Furthermore, in fig.6 you can see one part of the test.ini file that appears
in the principal folder of CosmoMC, here you can change the direction of
where you want to save the output file(in my case, chains) and the name
of the output file(in my case, prueba). Is important to consider that if you

11
(a) commands to plot (b) output plot

Figure 5: plot CAMB with Gnuplot

Figure 6: root dir and file root in test.ini file

want to make another run, you have to change the file root or the previous
output file will be replaced.

Finally, you make a test-run in CosmoMC typing ./cosmomc test.ini


in the terminal.

Input and output


In my experience it was three principal files that you need to modify in or-
der to set the input parameters including the data; test.ini, common.ini and
params CMB defaults.ini.

12
Let us take a look at the first one, test.ini, this file is the principal file
that you use to run CosmoMC, because you have to set the command ./cos-
momc test.ini. In this file, as we can see in fig.??, all the data is included
in DEFAULT() files where the terms between parentheses are just the di-
rections of the files, then, you can enable this data or disable depending of
what data do you want to use. Is important to note, that in the line DE-
FAULT(batch2/common.ini) is indicated that you have to go to batch2
folder and then open common.ini because this file also contains useful infor-
mation.

Figure 7: A view of the test.ini file

Another important thing is the parameterization = background com-


mand, this command is in order to include background cosmological param-
eters only. Also there is a line action = (see fig ??) where you can se 0, 1,
2 or 4, the program has action = 4 set for default, but if you want to run
chains in order to find the best fit you have to set action = 0.

Now, sometimes you have to modify several lines in common.ini but the
important thing is the line MPI Converge Stop = where you set a num-

13
ber for a convergence criteria, so this can be used to stop the CosmoMC
chains(see fig.??). Also, there is a line INCLUDE(params CMB defaults.ini)
that is the file that we use to set the cosmological parameters that we are
going to use and their values. The configuration to set values for the cosmo-
logical parameters in params CMB defaults.ini is shown in fig.??.

Figure 8: A view of the common.ini file

Figure 9: A view of the common.ini file

How to plot in CosmoMC


There are several forms to plot the results of CosmoMC, but the one I used
is GetDist and also GetDistGUI.
Let us see first GetDist, you need to see the distparams.ini file where you
can modify the line plot data dir = that is, where you will save your data.
Also, there are several types of plottings, the 1-D plot that is the parameter
versus its probability, the 2-D plot that is parameter vs parameter, the 3-D
plot that is parameter versus parameter, adding an extra parameter using a
set of points with different colours corresponding to different values of the

14
Figure 10: A view of the common.ini file

third parameter and the triangle plot, that is, a fancy form to show the re-
sults of several 2-D plots together. You can add all the above kind of plots
with their respective parameters in distparams.ini.

When you finished to properly modify distparams.ini you can run ./get-
dist distparams.ini in the terminal and then you need to install IDLE(using
python 2.7). When you have installed IDLE, then you can open the pro-
gram, then click in FILE, then click in OPEN, and then go to the direc-
tion that you typed in plot data dir = and selected a file that is .py, the
name of this file is the same that the name you used in file root = (see fig.
6). Then, a new open is going to open, in this new open you can press F5, if
there is no error the screen have to show you something like in fig.??.
Finally, you will have a pdf generated in your principal folder with the plots.

The other way to plot the results is GetDistGUI, easier and more inter-
active, in my particular case, the one I mostly prefer. To use GetDistGUI
you just have to type python/GetDistGUI.py in the terminal and then,

15
Figure 11: A view of GetDistGUI

a new window will be open(see fig.??). Is to easy to modify the options and
make a plot. Finally, you can save the plot in a .png file doing click on the
icon.

Planck likelihood and data

16

You might also like