cosmo

class hmf.cosmo.Cosmology(default='planck1_base', force_flat=False, **kwargs)

A class that nicely deals with cosmological parameters.

Most cosmological parameters are merely input and exposed as attributes in the class. However, more complicated relations such as the interrelation of omegab, omegac, omegam, omegav for example are dealt with in a more robust manner.

The secondary purpose of this class is to provide simple mappings of the parameters to common python cosmology libraries (for now just cosmolopy and pycamb). It has been found by the authors that using more than one library becomes confusing in terms of naming all the parameters, so this class helps deal with that.

Note

There are an incredible number of possible combinations of input parameters, many of which could easily be inconsistent. To this end, this class raises an exception if an inconsistent parameter combination is input, eg. h = 1.0, omegab = 0.05, omegab_h2 = 0.06.

Note

force_flat is provided for convenience to ensure a flat cosmology. In nearly all cases (except where it would be quite perverse to do so) this will modify omegav if it is otherwise inconsistent. Eg. if omegam = 0.3, omegav = 0.8, force_flat = True is passed, the omegav will modified to 0.7.

Parameters:

default : str, {"planck1_base"}

Defines a set of default parameters, based on a published set from WMAP or Planck. These defaults are applied in a smart way, so as not to override any user-set parameters.

Current options are

  1. "planck1_base": The cosmology of first-year PLANCK mission (with no lensing or WP)

force_flat : bool, default False

If True, enforces a flat cosmology \((\Omega_m+\Omega_\lambda=1)\). This will modify omegav only, never omegam.

**kwargs :

The list of available keyword arguments is as follows:

  1. sigma_8: The normalisation. Mass variance in top-hat spheres with \(R=8Mpc h^{-1}\)
  2. n: The spectral index
  3. w: The dark-energy equation of state
  4. cs2_lam: The constant comoving sound speed of dark energy
  5. t_cmb: Temperature of the CMB
  6. y_he: Helium fraction
  7. N_nu: Number of massless neutrino species
  8. N_nu_massive:Number of massive neutrino species
  9. z_reion: Redshift of reionization
  10. tau: Optical depth at reionization
  11. delta_c: The critical overdensity for collapse
  12. h: The hubble parameter
  13. H0: The hubble constant
  14. omegan: The normalised density of neutrinos
  15. omegam: The normalised density of matter
  16. omegav: The normalised density of dark energy
  17. omegab: The normalised baryon density
  18. omegac: The normalised CDM density
  19. omegab_h2: The normalised baryon density by h**2
  20. omegac_h2: The normalised CDM density by h**2

Note

The reason these are implemented as kwargs rather than the usual arguments, is because the code can’t tell a priori which combination of density parameters the user will input.

Attributes

H0
N_nu
N_nu_massive
cosmolopy_dict Collect parameters into a dictionary suitable for cosmolopy.
cs2_lam
force_flat
h
mean_dens
n
omegab
omegab_h2
omegac
omegac_h2
omegak
omegam
omegan
omegav
pycamb_dict Collect parameters into a dictionary suitable for pycamb.
sigma_8
t_cmb
tau
w
y_he
z_reion

Methods

cosmo_update(**kwargs)
cosmolopy_dict

Collect parameters into a dictionary suitable for cosmolopy.

Returns:

dict

Dictionary of values appropriate for cosmolopy

pycamb_dict

Collect parameters into a dictionary suitable for pycamb.

Returns:

dict

Dictionary of values appropriate for pycamb