Overview¶
Users can specify cosmological parameters by creating a new
Cosmology
object or by using one of the builtin
cosmologies (see Available Cosmologies).
When constructing a new Cosmology object, parameter values should be specified as keyword parameters. The parameters that can be specified are:
Parameter | Description |
---|---|
H0 | The Hubble constant at z=0, in km/s/Mpc |
Om0 | The matter density/critical density at z=0 |
Ob0 | The baryon density/critical density at z=0 |
Ode0 | The dark energy density/critical density at z=0 |
w0 | The dark energy equation of state |
Tcmb0 | The temperature of the CMB in K at z=0 |
Neff | The the effective number of neutrino species |
m_nu | The mass of neutrino species in eV |
sigma8 | The the mass variance on the scale of R=8 Mpc/h at z=0, which sets the normalization of the linear power spectrum |
n_s | The the spectral index of the primoridal power spectrum |
flat | if True, automatically set Ode0 such that Ok0 is zero |
Note
The pyRSD.rsd.cosmology.Cosmology
class is nearly identical to the
astropy.cosmology.FLRW
object, with the addition of the n_s
and sigma8
attributes
Examples¶
In [1]: from pyRSD.rsd import cosmology
# initialize a new Cosmology
In [2]: cosmo = cosmology.Cosmology(H0=70, sigma8=0.80, n_s=0.96)
# access parameters as attribute or key entry
In [3]: print(cosmo['sigma8'], cosmo.sigma8)
0.8 0.8
# compute the comoving distance to z = 0.4
In [4]: Dz = cosmo.comoving_distance(0.4)
In [5]: print(Dz)
1547.1248846885328 Mpc
The Cosmology class is read-only; changes to the parameters should be
performed with the clone()
function,
which creates a copy of the class, with any specified changes.
In [6]: new_cosmo = cosmo.clone(sigma8=0.85, Om0=0.27)
# compare sigma8
In [7]: print(cosmo.sigma8, new_cosmo.sigma8)
0.8 0.85
# compare Om0
In [8]: print(cosmo.Om0, new_cosmo.Om0)