hmfast.halos.HaloModel

class hmfast.halos.HaloModel(cosmology=<hmfast.cosmology.Cosmology object>, mass_def=<hmfast.halos.massdef.MassDefinition object>, halo_mass_function=<hmfast.halos.massfunc.T08HaloMassFunction object>, halo_bias=<hmfast.halos.bias.T10HaloBias object>, subhalo_mass_function=<hmfast.halos.massfunc.TW10SubHaloMassFunction object>, concentration=<hmfast.halos.concentration.D08Concentration object>, hm_consistency=True, convert_masses=False, m_grid=None)[source]

Bases: object

Differentiable halo model.

Provides halo-model predictions for arbitrary tracers using a configurable cosmology, halo mass function, halo bias model, concentration relation, and subhalo mass function.

Attributes:
cosmologyCosmology

Cosmology object supplying background, growth, and matter power spectra quantities.

mass_defMassDefinition

Native spherical-overdensity mass definition used throughout the halo model.

halo_mass_functionHaloMassFunction

Halo mass function model used to compute \(dn / d\ln M\).

halo_biasHaloBias

Halo bias model used for large-scale halo bias predictions.

subhalo_mass_functionSubHaloMassFunction

Subhalo mass function model used in observables with satellite or subhalo contributions.

concentrationConcentration

Halo concentration relation used to map halo mass and redshift to concentration.

hm_consistencybool

Flag controlling whether halo-model consistency counterterms are applied.

convert_massesbool

Flag controlling whether profile-specific native mass definitions are converted automatically.

m_gridarray

Log-spaced halo mass grid in \(M_\odot\) used for all mass integrals.

Methods

cl_1h(tracer1, tracer2, l, z[, k_damp])

Compute the 1-halo contribution to the angular power spectrum \(C_\ell^{1h}\).

cl_2h(tracer1, tracer2, l, z)

Compute the 2-halo contribution to the angular power spectrum \(C_\ell^{2h}\).

pk_1h(profile1, profile2, k, z[, k_damp])

Compute the 1-halo contribution to the 3D power spectrum.

pk_2h(profile1, profile2, k, z)

Compute the 2-halo contribution to the 3D power spectrum.

update([cosmology, halo_mass_function, ...])

Return a new HaloModel instance with updated components.

update(cosmology=None, halo_mass_function=None, halo_bias=None, subhalo_mass_function=None, concentration=None, mass_def=None, hm_consistency=None, convert_masses=None, m_grid=None)[source]

Return a new HaloModel instance with updated components.

Parameters:
cosmology, halo_mass_function, halo_bias, subhalo_mass_function, concentration, mass_def, hm_consistency, convert_masses, m_gridoptional

Replacement values for the corresponding class attributes. Any argument left as None keeps its current value.

Returns:
HaloModel

New halo-model instance with updated attributes.

pk_1h(profile1, profile2, k, z, k_damp=0.01)[source]

Compute the 1-halo contribution to the 3D power spectrum.

\[P_{1h}(k, z) = \int d\ln M \, \frac{dn}{d\ln M} \, u_1(k, M, z) u_2(k, M, z)\]

where \(dn/d\ln M\) is the halo mass function and \(u_i(k \mid M, z)\) is the Fourier-space tracer profile. The mass integral is performed over m_grid.

Parameters:
profile1HaloProfile

First halo profile object.

profile2HaloProfile or None

Second halo profile object (if None, uses profile1).

karray-like

Wavenumber grid in \(\mathrm{Mpc}^{-1}\).

zarray-like

Redshift grid.

k_dampfloat, default 0.01

Damping wavenumber in \(\mathrm{Mpc}^{-1}\) for the low-k suppression factor.

Returns:
pk_1harray

1-halo power spectrum in \(\mathrm{Mpc}^3\), with shape \((N_k, N_z)\), where singleton dimensions get squeezed before return.

cl_1h(tracer1, tracer2, l, z, k_damp=0.01)[source]

Compute the 1-halo contribution to the angular power spectrum \(C_\ell^{1h}\).

The Limber-projected spectrum is obtained by integrating the 1-halo 3D power spectrum against the tracer kernels and the comoving volume element. The mass integral is performed over m_grid.

Parameters:
tracer1Tracer

First tracer object.

tracer2Tracer or None

Second tracer object (if None, uses tracer1).

larray-like

Multipole grid.

zarray

Redshift array. This must be an array because it defines the integration grid over redshift.

k_dampfloat, default 0.01

Damping wavenumber in \(\mathrm{Mpc}^{-1}\) passed through to pk_1h().

Returns:
cl_1harray

Dimensionless 1-halo angular power spectrum with shape \((N_\ell,)\), where singleton dimensions get squeezed before return.

pk_2h(profile1, profile2, k, z)[source]

Compute the 2-halo contribution to the 3D power spectrum.

\[P_{2h}(k, z) = P_{\mathrm{lin}}(k, z) \, I_1(k, z) \, I_2(k, z)\]

with

\[I_i(k, z) = \int d\ln M \, \frac{dn}{d\ln M}(M, z) \, b(M, z) \, u_i(k \mid M, z),\]

where \(u_i(k \mid M, z)\) is the Fourier-space tracer profile, \(dn/d\ln M\) is the halo mass function, and \(b(M, z)\) is the linear halo bias. The mass integral is performed over m_grid.

Parameters:
profile1HaloProfile

First halo profile object.

profile2HaloProfile or None

Second halo profile object (if None, uses profile1).

karray-like

Wavenumber grid in \(\mathrm{Mpc}^{-1}\).

zarray-like

Redshift grid.

Returns:
pk_2harray

2-halo power spectrum in \(\mathrm{Mpc}^3\), with shape \((N_k, N_z)\), where singleton dimensions get squeezed before return.

cl_2h(tracer1, tracer2, l, z)[source]

Compute the 2-halo contribution to the angular power spectrum \(C_\ell^{2h}\).

The Limber-projected spectrum is obtained by integrating the 2-halo 3D power spectrum against the tracer kernels and the comoving volume element. The mass integral is performed over m_grid.

Parameters:
tracer1Tracer

First tracer object.

tracer2Tracer or None

Second tracer object (if None, uses tracer1).

larray-like

Multipole grid.

zarray

Redshift array. This must be an array because it defines the integration grid over redshift.

Returns:
cl_2harray

Dimensionless 2-halo angular power spectrum with shape \((N_\ell,)\), where singleton dimensions get squeezed before return.