Test Cosmology object


In [1]:
%pylab inline
import numpy as np
import cosmoCAMB as cCAMB


Populating the interactive namespace from numpy and matplotlib

Setup cosmological model


In [2]:
zref=2.25
cosmo = cCAMB.Cosmology(zref)

In [3]:
# compute linear power at zref
kmin=1.e-4
kmax=1.e1
linPk = cosmo.LinPk_hMpc(kmin,kmax,1000)

Plot matter power spectrum


In [4]:
from matplotlib import pyplot as plt

In [11]:
k = np.logspace(np.log10(kmin),np.log10(0.99*kmax),1000)
plt.loglog(k, linPk(k))
plt.xlim(1.e-4,1.0)
plt.ylim(ymin=10.0)
plt.xlabel('k [h/Mpc]')
plt.ylabel('P(k) [Mpc/h]')
plt.title('Linear density power at z ='+str(zref))


Out[11]:
<matplotlib.text.Text at 0x11e0301d0>