In [ ]:
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
In [2]:
from classy import Class
# Define your cosmology (what is not specified will be set to CLASS default parameters)
params = {
'output': 'tCl lCl',
'l_max_scalars': 2000,
'lensing': 'yes',
'A_s': 2.3e-9,
'n_s': 0.9624,
'h': 0.6711,
'omega_b': 0.022068,
'omega_cdm': 0.12029}
# Create an instance of the CLASS wrapper
cosmo = Class()
# Set the parameters to the cosmological code
cosmo.set(params)
# Run the whole code. Depending on your output, it will call the
# CLASS modules more or less fast. For instance, without any
# output asked, CLASS will only compute background quantities,
# thus running almost instantaneously.
# This is equivalent to the beginning of the `main` routine of CLASS,
# with all the struct_init() methods called.
cosmo.compute()
In [ ]: