ClassGrowth

class hmf.cosmology.growth_factor.ClassGrowth(*args, **kwargs)[source]

Growth factor computed using CLASS at \(k = 0.01\,{\rm Mpc}^{-1}\).

This needs the optional classy package (the Python wrapper of CLASS), which you can install with pip install hmf[class]. It is the CLASS counterpart of CambGrowth, and like it is evaluated at the reference wavenumber k_ref (BOLTZMANN_GROWTH_K_REF). This is on large enough scales that baryon and dark-energy perturbations have a negligible effect, and small enough that the growth of the (synchronous-gauge) density contrast is that of the sub-horizon growth equation to better than \(10^{-3}\) for \(z \lesssim 20\).

The growth factor is \(D(z) = \sqrt{P(k_{\rm ref}, z) / P(k_{\rm ref}, 0)}\), with \(P\) CLASS’s linear power spectrum, which is how CLASS defines its own scale-dependent growth factor (classy.Class.scale_dependent_growth_factor_D). The growth rate, \(f = d\ln D / d\ln a\), is the derivative of a spline of \(\ln D\) in \(\ln a\) through the redshifts at which CLASS tabulates \(P(k, z)\), which is also how CLASS computes it (classy.Class.scale_dependent_growth_factor_f). CLASS’s scale-independent growth rate is not used, since it ignores massive neutrinos, so it would not be consistent with \(D\) for matter_species="tot".

With massive neutrinos the growth is scale-dependent; see CambGrowth.

A single CLASS run gives the growth factor at all redshifts up to z_max. It is made the first time the growth factor or rate is needed and kept with the component (including when it is pickled). It is not shared with the CLASS transfer model, which needs CLASS’s output at \(z=0\) only.

Parameters:
  • cosmo (astropy.cosmology.FLRW instance) – The cosmology used in the calculation. Must be a LambdaCDM, wCDM or w0waCDM (or one of their flat versions), with the baryon density and CMB temperature set. It is converted to CLASS input as for the CLASS transfer model (see class_cosmology()).

  • **model_parameters (unpack-dict) –

    Parameters specific to this model.

    matter_species: Which matter density field’s growth is computed:

    "cb", using CLASS’s CDM+baryon power spectrum, or "tot", using its total matter power spectrum (including massive neutrinos). The two are identical for massless neutrinos. Use the same value as the transfer model’s matter_species. The default, None, means "cb", with a warning if the cosmology has massive neutrinos. See CambGrowth and Massive neutrinos: which matter field to use.

    z_max: The maximum redshift at which the growth factor can be computed

    (CLASS’s z_max_pk). Default 20. Larger values make CLASS slightly slower.

Attributes

Or0

The fractional radiation density at redshift zero.

k_ref: ClassVar[float] = 0.01

The reference wavenumber [1/Mpc] at which the growth is evaluated.

references: ClassVar[tuple[str, ...]] = ('Lesgourgues, J., 2011. arXiv:1104.2932', 'Blas, D., Lesgourgues, J., Tram, T., 2011. JCAP 07, 034. arXiv:1104.2933')

References to cite when this model is used, each a formatted citation string. Subclasses inherit their parent’s references unless they set their own.

Methods

dlne_dlna(z)

Compute the derivative of ln(E(a)) with respect to ln(a).

This is useful for the growth factor, which has terms \(E'(a)/E(a) \equiv (1/a)*dlnE/dlna\) in its definition.

This implementation simply uses the exact definition from astropy of E(a) and writes down the derivative analytically. The dark-energy density scales as \(\rho_{\rm DE}(a) \propto \exp(-3\int (1+w)\, d\ln a)\), so its logarithmic derivative is \(-3(1+w(a))\), which vanishes only for a cosmological constant. With massive neutrinos, the radiation term is \(\Omega_\gamma (1 + N(z)) a^{-4}\), where \(N(z)\) is astropy’s nu_relative_density. \(N\) varies with time as the neutrinos become non-relativistic, so its derivative is included, computed by central finite difference in \(\ln(1+z)\).

classmethod get_models() → Mapping[str, type]

Get a read-only mapping of all implemented models for this component.

The mapping is a live view of the registry, so it shows models registered later, but it can not be used to add or remove models.

growth_factor(z)

Compute the normalized growth factor, \(D(a) = D^+(a)/D^+(a=1)\).

Parameters:

z (array_like) – Redshift.

Returns:

gf – The growth factor at z.

Return type:

array_like

growth_rate(z) → float | ndarray

Compute the growth rate, \(f(a) = d\ln D^+ / d\ln a\).

Parameters:

z (array_like) – Redshift.

Returns:

gr – The growth rate at z.

Return type:

array_like

radiation_density(z)

The fractional radiation density as a function of redshift.