BaseGrowthFactor

class hmf.cosmology.growth_factor.BaseGrowthFactor(cosmo: FLRW, **model_parameters)[source]

General class for a growth factor calculation.

Sub-classes must implement :method:`_d_plus_unnormalized`, which should take a single argument – the redshift, z – and return an array or float (depending on the input type) of the un-normalized growth factor, \(D^+(a)\). Most typically, the normalization of this function is such that \(D^+(a) \approx a\) at early times, but this is not enforced, and does not affect the user-facing methods of the class.

Sub-classes may also implement :method:`growth_rate`, which takes the same argument and returns the growth rate:

\[f(a) = d\ln D^+ / d\ln a.\]

If this is not implemented, then the growth rate will be calculated by taking the derivative of a spline fitted to the growth factor numerically, and in which the growth factor is evaluated on a logarithmic grid of the scale factor from amin to 1 in steps of dlna.

Attributes

Methods

__init__(cosmo: FLRW, **model_parameters)[source]
dlne_dlna(z)[source]

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.

classmethod get_models() dict[str, type]

Get a dictionary of all implemented models for this component.

growth_factor(z)[source]

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[source]

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)[source]

The fractional radiation density as a function of redshift.