skypy.halos.mass.press_schechter

skypy.halos.mass.press_schechter(m_min, m_max, resolution, wavenumber, power_spectrum, growth_function, cosmology, *, collapse_function=<function ellipsoidal_collapse_function>, params=(0.5, 1, 0, 1.69), size=None)

Halo mass sampler. This function samples haloes from their mass function, see equation 7.46 in [1].

Parameters:
m_min, m_maxarray_like

Lower and upper bounds for the random variable m.

resolution: int

Resolution of the inverse transform sampling spline.

wavenumber(nk,) array_like

Array of wavenumbers at which the power spectrum is evaluated, in units of Mpc-1.

power_spectrum: (nk,) array_like

Linear power spectrum at redshift 0 in Mpc3.

growth_functionfloat

The growth function evaluated at a given redshift for the given cosmology.

cosmologyastropy.cosmology.Cosmology

Cosmology object providing methods for the evolution history of omega_matter and omega_lambda with redshift.

collapse_function: function

Collapse function to choose from a variety of models: sheth_tormen_collapse_function, press_schechter_collapse_function.

params: tuple

List of parameters that determines the model used for the collapse function.

size: int, optional

Output shape of samples. Default is None.

Returns:
sample: (size,) array_like

Samples drawn from the mass function, in units of solar masses.

References

[1]

Mo, H. and van den Bosch, F. and White, S. (2010), Cambridge University Press, ISBN: 9780521857932.

Examples

>>> import numpy as np
>>> from skypy.halos import mass
>>> from skypy.power_spectrum import eisenstein_hu

This example will sample from the halo mass function for a Planck15 cosmology at redshift 0. The power spectrum is given by the Eisenstein and Hu fitting formula:

>>> from astropy.cosmology import Planck15
>>> cosmo = Planck15
>>> D0 = 1.0
>>> k = np.logspace(-3, 1, num=100, base=10.0)
>>> A_s, n_s = 2.1982e-09, 0.969453
>>> Pk = eisenstein_hu(k, A_s, n_s, cosmo, kwmap=0.02, wiggle=True)

Sampling from the Sheth and Tormen mass function:

>>> halo_mass = mass.sheth_tormen(1e9, 1e12, 100, k, Pk, D0, cosmo)

And from the Press-Schechter mass function:

>>> halo_mass = mass.press_schechter(1e9, 1e12, 100, k, Pk, D0, cosmo)

For any other collapse models:

>>> params_model = (0.3, 0.7, 0.3, 1.686)
>>> halo_mass = mass.halo_mass_sampler(1e9, 1e12, 100, k, Pk, D0, cosmo,
...     mass.ellipsoidal_collapse_function, params=params_model)