halomod.halo_exclusion.Exclusion

class halomod.halo_exclusion.Exclusion(m: ndarray, density: ndarray, power_integrand: ndarray, bias: ndarray, r: ndarray, halo_density: float)[source]

Bases: Component

Base class for exclusion models.

All models will need to perform single or double integrals over arrays that may have an extra two dimensions. The maximum possible size is k*r*m*m, which for normal values of the vectors equates to ~ 1000*50*500*500 = 12,500,000,000 values, which in 64-bit reals is 1e11 bytes = 100GB. We thus limit this to a maximum of either k*r*m or r*m*m, both of which should be less than a GB of memory.

It is possibly better to limit it to k*r or m*m, which should be quite memory efficient, but then without accelerators (ie. Numba), these will be very slow.

Parameters:
  • m (np.ndarray) – 1D vector of halo masses in Msun/h.

  • density (np.ndarray) – Either the number or mass density of the quantity under consideration (i.e. mass density for the matter field, number density for galaxy/halo fields). This quantity should be _normalized_ to integrate to unity over the full mass range in m. Thus, for matter, it should be n(m)*m / rhobar, and for galaxies, it should be n(m)*N(m) / nbar_g.

  • power_integrand – An array of shape (len(k), len(m)) defining the integrand of the power spectrum integral (see Eq. 13 of https://arxiv.org/pdf/2009.14066). For the matter field, this should be n(m) * u(k,m) * m / rhobar. At large k, it should integrate to unity over mass.

  • bias (np.ndarray) – Either a 1D vector (length m) or 2D array (shape (len(r), len(m))) defining the halo bias.

  • r (np.ndarray) – A vector of scales, r in Mpc/h.

  • halo_density (float) – The density of the halos whose masses are given by m. This is typically halo_overdensity * mean_density0.

density_mod

The modified integrated density with halo exclusion.

Calculated in the matter case by

\[\bar{n}^{-1} \sqrt{\int_0^{m'_1} \int_0^{m'_2} n(m_1) m_1 n(m_2) m_2 dm_1 dm_2},\]

and in the tracer case by replacing n(m).m with n(m) N(m).

See Eq. 47 of https://arxiv.org/pdf/2009.14066.

The array is a vector of length r.

classmethod get_models() Dict[str, Type]

Get a dictionary of all implemented models for this component.

integrate() ndarray[source]

Integrate the raw_integrand() over mass.

This should pass back whatever is multiplied by P_m(k) to get the two-halo term. Often this will be a square of an integral, sometimes a Double-integral.

The result should be a 2D array of shape (r, k).

property r_halo

The virial radius of the halo.

raw_integrand() ndarray[source]

Compute the full power spectrum integrand.

The output is always a 3D array, with shape (r, k, m).