hmf.density_field.filters.Filter

class hmf.density_field.filters.Filter(k, power, **model_parameters)[source]

Base class for Filter components.

Filters handle the calculation of the mass variance from the power spectrum, via a window function. Subclasses of Filer implement specific window functions.

The general design is to specify all quantities in terms of length scales, rather than equivalent masses, but conversion methods are provided.

Any explicit subclass need only specify k_space, mass_to_radius, radius_to_mass and dw_dlnkr, with dlnr_dlnm optional if the mass assignment is unconventional.

Parameters
  • k (array_like) – Wavenumbers at which the power spectrum is defined.

  • power (array_like) – The power spectrum at k.

  • **model_parameters (unpacked-dict) – As for any hmf._framework.Component subclass, any particular parameters of the model may be passed to the constructor. Allowed parameters are found in the _defaults attribute.

Notes

Besides the raw filter function itself, two quantities are of primary interest: firstly the mass variance (see sigma()), which appears in many cosmological applications, and secondly its logarithmic derivative with mass, which appears in the Press-Schechter formalism for the halo mass function.

To remain extensible and general, the methodology in this class is to calculate the latter quantity as

\[\frac{d\ln\sigma}{d\ln m} = \frac{1}{2} \frac{d \ln \sigma^2}{d\ln R}\frac{d\ln R}{d\ln m}.\]

Each of the quantities on the right can be separately calculated, improving extensibility.

The factor \(\frac{d\ln R}{d\ln m}\) is typically 1/3, but this is not necessarily the case for window functions of arbitrary shape.

Methods

__init__(k, power, **model_parameters)

Initialize self.

dlnr_dlnm(r)

The derivative of log radius with log mass.

dlnss_dlnm(r)

The logarithmic slope of mass variance with mass.

dlnss_dlnr(r)

The derivative of the mass variance with radius.

dw_dlnkr(kr)

The derivative of the (fourier-transformed) filter with \(\ln(kr)\).

get_models()

Get a dictionary of all implemented models for this component.

k_space(kr)

Fourier-transform of the real-space filter.

mass_to_radius(m, rho_mean)

Return radius of a region of space given its mass.

nu(r[, delta_c])

Peak height, \(\frac{\delta_c^2}{\sigma^2(r)}\).

radius_to_mass(r, rho_mean)

Return mass of a region of space given its radius

real_space(R, r)

Filter definition in real space.

sigma(r[, order, rk])

Calculate the nth-moment of the smoothed density field, \(\sigma_n(r)\).