transfer

This module contains a single class, Transfer, which provides methods to calculate the transfer function, matter power spectrum and several other related quantities.

class hmf.transfer.Transfer(z=0.0, lnk_min=-18.420680743952367, lnk_max=9.9034875525361272, dlnk=0.05, transfer_fit=<class 'hmf.transfer.CAMB'>, transfer_options={}, takahashi=True, **kwargs)

Neatly deals with different transfer functions and their routines.

The purpose of this class is to calculate transfer functions, power spectra and several tightly associated quantities using many of the available fits from the literature.

Importantly, it contains the means to calculate the transfer function using the popular CAMB code, the Eisenstein-Hu fit (1998), the BBKS fit or the Bond and Efstathiou fit (1984). Furthermore, it can calculate non-linear corrections using the halofit model (with updated parameters from Takahashi2012).

The primary feature of this class is to wrap all the methods into a unified interface. On top of this, the class implements optimized updates of parameters which is useful in, for example, MCMC code which covers a large parameter-space. Calling the nonlinear_power does not re-evaluate the entire transfer function, rather it just calculates the corrections, improving performance.

To update parameters optimally, use the update() method. All output quantities are calculated only when needed (but stored after first calculation for quick access).

Parameters:

lnk_min : float

Defines min log wavenumber, k [units \(h Mpc^{-1}\)].

lnk_max : float

Defines max log wavenumber, k [units \(h Mpc^{-1}\)].

dlnk : float

Defines log interval between wavenumbers

z : float, optional, default 0.0

The redshift of the analysis.

wdm_mass : float, optional, default None

The warm dark matter particle size in keV, or None for CDM.

transfer_fit : str, { "CAMB", "EH", "bbks", "bond_efs"}

Defines which transfer function fit to use. If not defined from the listed options, it will be treated as a filename to be read in. In this case the file must contain a transfer function in CAMB output format.

Scalar_initial_condition : int, {1,2,3,4,5}

(CAMB-only) Initial scalar perturbation mode (adiabatic=1, CDM iso=2, Baryon iso=3,neutrino density iso =4, neutrino velocity iso = 5)

lAccuracyBoost : float, optional, default 1.0

(CAMB-only) Larger to keep more terms in the hierarchy evolution

AccuracyBoost : float, optional, default 1.0

(CAMB-only) Increase accuracy_boost to decrease time steps, use more k values, etc.Decrease to speed up at cost of worse accuracy. Suggest 0.8 to 3.

w_perturb : bool, optional, default False

(CAMB-only)

transfer__k_per_logint : int, optional, default 11

(CAMB-only) Number of wavenumbers estimated per log interval by CAMB Default of 11 gets best performance for requisite accuracy of mass function.

transfer__kmax : float, optional, default 0.25

(CAMB-only) Maximum value of the wavenumber. Default of 0.25 is high enough for requisite accuracy of mass function.

ThreadNum : int, optional, default 0

(CAMB-only) Number of threads to use for calculation of transfer function by CAMB. Default 0 automatically determines the number.

takahashi : bool, default True

Whether to use updated HALOFIT coefficients from Takahashi+12

wdm_model : WDM subclass or string

The WDM transfer function model to use

kwargs : keywords

The **kwargs take any cosmological parameters desired, which are input to the hmf.cosmo.Cosmology class. hmf.Perturbations uses a default parameter set from the first-year PLANCK mission, with optional modifications by the user. Here is a list of parameters currently available (and their defaults in Transfer):

sigma_8:[0.8344] The normalisation. Mass variance in top-hat spheres with \(R=8Mpc h^{-1}\)
n:[0.9624] The spectral index
w:[-1] The dark-energy equation of state
cs2_lam:[1] The constant comoving sound speed of dark energy
t_cmb:[2.725] Temperature of the CMB
y_he:[0.24] Helium fraction
N_nu:[3.04] Number of massless neutrino species
N_nu_massive:[0] Number of massive neutrino species
delta_c:[1.686] The critical overdensity for collapse
H0:[67.11] The hubble constant
h:[H0/100.0] The hubble parameter
omegan:[0] The normalised density of neutrinos
omegab_h2:[0.022068] The normalised baryon density by h**2
omegac_h2:[0.12029] The normalised CDM density by h**2
omegav:[0.6825] The normalised density of dark energy
omegab:[omegab_h2/h**2] The normalised baryon density
omegac:[omegac_h2/h**2] The normalised CDM density
force_flat:[False] Whether to force the cosmology to be flat (affects only omegav)
default:["planck1_base"] A default set of cosmological parameters

Attributes

H0
N_nu
N_nu_massive
cosmolopy_dict Collect parameters into a dictionary suitable for cosmolopy.
cs2_lam
delta_k Dimensionless power spectrum, \(\Delta_k = \frac{k^3 P(k)}{2\pi^2}\)
dlnk
force_flat
growth The growth factor \(d(z)\)
h
lnk
lnk_max
lnk_min
mean_dens
n
nonlinear_delta_k Dimensionless nonlinear power spectrum, \(\Delta_k = \frac{k^3 P_{\rm nl}(k)}{2\pi^2}\)
nonlinear_power Non-linear log power [units \(Mpc^3/h^3\)]
omegab
omegab_h2
omegac
omegac_h2
omegak
omegam
omegan
omegav
power Normalised log power spectrum [units \(Mpc^3/h^3\)]
pycamb_dict Collect parameters into a dictionary suitable for pycamb.
sigma_8
t_cmb
takahashi
tau
transfer_fit
transfer_options
w
y_he
z
z_reion

Methods

cosmo_update(**kwargs)
update(**kwargs) Update the class optimally with given arguments.
delta_k

Dimensionless power spectrum, \(\Delta_k = \frac{k^3 P(k)}{2\pi^2}\)

growth

The growth factor \(d(z)\)

This is calculated (see Lukic 2007) as

\[d(z) = \frac{D^+(z)}{D^+(z=0)}\]

where

\[D^+(z) = \frac{5\Omega_m}{2}\frac{H(z)}{H_0}\int_z^{\infty}{\frac{(1+z')dz'}{[H(z')/H_0]^3}}\]

and

\[H(z) = H_0\sqrt{\Omega_m (1+z)^3 + (1-\Omega_m)}\]
nonlinear_delta_k

Dimensionless nonlinear power spectrum, \(\Delta_k = \frac{k^3 P_{\rm nl}(k)}{2\pi^2}\)

nonlinear_power

Non-linear log power [units \(Mpc^3/h^3\)]

Non-linear corrections come from HALOFIT (Smith2003) with updated parameters from Takahashi2012.

This code was heavily influenced by the HaloFit class from the chomp python package by Christopher Morrison, Ryan Scranton and Michael Schneider (https://code.google.com/p/chomp/). It has been modified to improve its integration with this package.

power

Normalised log power spectrum [units \(Mpc^3/h^3\)]

update(**kwargs)

Update the class optimally with given arguments.

Accepts any argument that the constructor takes

hmf.transfer.get_transfer(name, t)

A function that chooses the correct Profile class and returns it