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
"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 modifyomegav
only, neveromegam
.**kwargs :
The list of available keyword arguments is as follows:
sigma_8
: The normalisation. Mass variance in top-hat spheres with \(R=8Mpc h^{-1}\)n
: The spectral indexw
: The dark-energy equation of statecs2_lam
: The constant comoving sound speed of dark energyt_cmb
: Temperature of the CMBy_he
: Helium fractionN_nu
: Number of massless neutrino speciesN_nu_massive
:Number of massive neutrino speciesz_reion
: Redshift of reionizationtau
: Optical depth at reionizationdelta_c
: The critical overdensity for collapseh
: The hubble parameterH0
: The hubble constantomegan
: The normalised density of neutrinosomegam
: The normalised density of matteromegav
: The normalised density of dark energyomegab
: The normalised baryon densityomegac
: The normalised CDM densityomegab_h2
: The normalised baryon density byh**2
omegac_h2
: The normalised CDM density byh**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