matryoshka.halo_model_funcs

Module containing functions for combining the predictions from the halo model component emulators to calculate the galaxy power spectrum.

matryoshka.halo_model_funcs.DgN(Om, z)

LCDM growth rate auxiliary function (from pybird)

matryoshka.halo_model_funcs.Duffy08cmz(m, redshift)

Replacement Class for halomod.concentration.Duffy08 (hacked halomod)

Assumes a spherical overdensity mass defention.

Parameters
  • m (array) – Array containing masses at whcih to calculate the concentration.

  • redshift (float) – Redshift at which to calculate the concentration.

Returns

An array containing the halo concentrations.

matryoshka.halo_model_funcs.Gcov(P_k, k, dk, n, V)

Calculate a Gaussian diagonal covariance.

Parameters
  • P_k (array) – Array containing the power spectrum of shape (n,).

  • k (array) – k-bins corresponding to the power spectrum of shape (n,).

  • dk (float) – Width of the k-bins.

  • n (float) – Number density.

  • V (float) – Volume.

Returns

Array containing Gaussian covariance of shape (n,).

matryoshka.halo_model_funcs.TinkerBias(sigma, delta_halo=200.0, delta_c=1.686)

(halomod hack)

Parameters
  • sigma (array) – Array containing the mass varaince.

  • delta_halo (float) – The delta used in the halo mass defenition (default is 200.0).

  • delta_c (float) – Critical density for collapse (default is 1.686)

Returns

Halo bias as a function of mass.

matryoshka.halo_model_funcs.Tinkerfsigma(sigma, redshift)

Tinker10 fitting function used to calculate the halo mass function from the mass variance (halomod hack).

Parameters
  • sigma (array) – Array containing the mass variance of shape (n,).

  • redshift (float) – Value of the redshift.

Returns

Array containing fsigma of shape (n,).

class matryoshka.halo_model_funcs.TopHatrep(k, power)

Replacement Class for hmf.density_field.filters.TopHat (hacked halomod)

Parameters
  • k (array) – Array containing wave-numbers associated to power.

  • power (array) – Un-normalised power spectrum at redshift 0.

k_space(kr)

Top-hat window function in Fourier space.

sigma(r, order=0, rk=None)

Mass variance.

matryoshka.halo_model_funcs.beff(m, dndm, b_h, N)

Function for calculating the galaxy bias.

Parameters
  • m (array) – Array containing masses.

  • dndm (array) – Array containing the halo mass function.

  • b_h (array) – Array containing the halo bias.

  • N (array) – Array containing the mean halo occupation.

Returns

The galaxy bias.

matryoshka.halo_model_funcs.cH(Om, a)

LCDM growth rate auxiliary function (from pybird)

matryoshka.halo_model_funcs.cen_Z09(M, logM_cut, sigma)
Parameters
  • M (array) – Array of masses.

  • logM_cut (float) – Minimum mass for halo to host a central galaxy.

  • sigma (float) – Smoothing factor for central step function.

Returns

The expected central occupation corresponding to the input masses.

matryoshka.halo_model_funcs.delta_k(k, power)

From halomod.

Parameters
  • k (array) – Array of k-bins of shape (n,).

  • power (array) – Array containing the power spectrum corresponding to k of shape (n,).

Returns

Array containing the dimensionless power spectrum of shape (n,).

matryoshka.halo_model_funcs.fN(Om, z)

LCDM growth rate (from pybird)

matryoshka.halo_model_funcs.halomodel_power(k, m, transfer, sigma, dlns, cosmo, sigma8, ns, HOD, conc, growth, redshift, nonlinear=False, split_1h_2h=False)

Covience function for calculating the galaxy power spectrum.

Parameters
  • k (array) – Array of k-bins of shape (nk,).

  • m (array) – Array of masses of shape (nm,).

  • transfer (array) – Array containing the transfer function corresponding to k of shape (nk,).

  • sigma (array) – Array containing the mass varaince corresponding to m of shape (nm,)

  • dlns (array) – Array containing the logarithmic derivative of the mass variance of shape (nm,).

  • cosmo (astropy FlatwCDM) – Astropy FlatwCDM cosmology object.

  • sigma8 (float) – Value of sigma_8.

  • ns (float) – Value of the spectral index.

  • HOD (array) – Array containing the HOD parameters of shape (5,)

  • conc (array) – Array containing the halo concentration corresponding to m of shape (nm,).

  • growth (float) – Value of the growth function corresponding to the redshift.

  • redshift (float) – redshift.

  • nonlinear (bool) – If True nonlinearities included via HALOFIT.

  • split_1h_2h (bool) – If True contributions from the 1-halo and 2-halo terms are returned seperately.

Returns

The galaxy power spectrum of shape (nk,).

matryoshka.halo_model_funcs.hmf(sigma, dlnsdlnm, mean_dens, m, growth, redshift)

Tinker08 halo mass function (halomod hack).

Parameters
  • sigma (array) – Array containing the mass variance of shape (n,).

  • dlnsdlnm (array) – Array containing the logarithmic derivative of the mass varaince of shape (n,).

  • m (array) – Array containing the masses of shape (n,).

  • growth (float) – Value of the growth function.

  • redshift (float) – Value of the redshift.

Returns

Array containing the halo mass function of shape (n,).

matryoshka.halo_model_funcs.mass_int(m, I, mass_axis=1)

Approximates the mass integral for various quanties used in the halomodel.

Parameters
  • m (array) – Array containing the masses over which to do the integral.

  • I (array) – The integrand.

  • mass_axis (int) – Index of the integrad the corresponds to the mass axis.

Returns

The result of the mass integration.

matryoshka.halo_model_funcs.mean_density0_v2(h, Om0)

Calculate the mean density at redshift 0.

Parameters
  • h (array) – Value(s) of h, of shape (n,).

  • Om0 (array) – Value(s) of Om0, of shape (n,).

Returns

Array of mean densities of shape (n,).

matryoshka.halo_model_funcs.ngal(m, dndm, tot_occ)

Calculates the mean number density of galaxies.

Parameters
  • m (array) – Array containing the masses.

  • dndm (array) – Arracy containing the halo mass function corresponding to the masses.

  • tot_occ (array) – The expected halo occupation corresponding to the masses.

Returns

The mean galaxy occupation.

matryoshka.halo_model_funcs.nonlinear_power(k, power, sigma8, redshift, cosmo)
Parameters
  • k (array) – Array of k-bins of shape (n,).

  • power (array) – Array containing the power spectrum corresponding to k of shape (n,).

  • sigma8 (float) – Value of sigma_8.

  • redshift (float) – Value of redshift.

  • cosmo (astropy FlatwCDM) – Astropy FlatwCDM cosmology object.

Returns

Array containing the nonliear power spectrum of shape (n,).

matryoshka.halo_model_funcs.norm(k, unnormed_P, sigma8)

Calculates the normalisation for the primordial power spectrum based on a given value of sigma_8 (hacked halomod).

Parameters
  • k (array) – k-bins of the un-normalised power spectrum/spectra.

  • unnormed_P (array) – Un-normalised power spectrum/spectra.

  • sigma8 (array) – Value(s) of sigma_8

Returns

Array of the normalisation for the power spectra.

matryoshka.halo_model_funcs.power0_v2(k, T, sigma8, ns)

Calculate the normalised linear power spectrum at redshift 0. (hacked halomod)

Parameters
  • k (array) – k-bins of the transfer function(s).

  • T (array) – Transfer functions(s).

  • sigma8 (array) – Value(s) of sigma_8

  • ns (array) – Value(s) of the spectral index.

Returns

Array of the normalised power spectrum/spectra at redshift 0.

matryoshka.halo_model_funcs.power_1h_cs(ukm, dndm, m, cen_occ, sat_occ, mean_tracer_den)

Returns the cen-sat contribution to the 1halo term of the galaxy power spectrum. (hacked halomod). Imposes central condition

Parameters
  • ukm (array) – The halo profile in Fourier space.

  • dndm (array) – The halo mass function.

  • m (array) – Masses corresponding to the halo mass function and halo profile.

  • cen_occ (array) – The expected central occupation corresponding to m.

  • sat_occ (array) – The expected central occupation corresponding to m.

  • mean_tracer_den (float) – The mean galaxy number density.

Returns

Contribution to the 1h-term from cen-sat pairs.

matryoshka.halo_model_funcs.power_1h_ss(ukm, dndm, m, cen_occ, sat_occ, mean_tracer_den)

Returns the sat-sat contribution to the 1halo term of the galaxy power spectrum. (hacked halomod). Imposes central condition

Parameters
  • ukm (array) – The halo profile in Fourier space.

  • dndm (array) – The halo mass function.

  • m (array) – Masses corresponding to the halo mass function and halo profile.

  • cen_occ (array) – The expected central occupation corresponding to m.

  • sat_occ (array) – The expected central occupation corresponding to m.

  • mean_tracer_den (float) – The mean galaxy number density.

Returns

Contribution to the 1h-term from sat-sat pairs.

matryoshka.halo_model_funcs.power_2h(ukm, dndm, m, total_occ, mean_tracer_den, Plin, halo_bias)

Returns the 2halo term of the galaxy power spectrum

Parameters
  • ukm (array) – The halo profile in Fourier space.

  • dndm (array) – The halo mass function.

  • m (array) – Masses corresponding to the halo mass function and halo profile.

  • tot_occ (array) – The expected occupation corresponding to m.

  • mean_tracer_den (float) – The mean galaxy number density.

  • Plin (array) – The linear power spectrum.

  • halo_bias (array) – The halo bias corresponding to m.

Returns

2h-term.

matryoshka.halo_model_funcs.sat_Z09(M, logM1, alpha, kappa, logM_cut)
Parameters
  • M (array) – Array of masses.

  • logM1 (float) – Typical mass of halo to host a satellite.

  • alpha (float) – Exponent of power law that defines how the expected number of sattelites grows with mass.

  • kappa (float) – The product kappa*logM_cut defines the mimum mass for a halo to host a sattelite.

  • logM_cut (float) – Minimum mass for halo to host a central galaxy.

Returns

The expected sattelite occupation corresponding to the inputs masses.

matryoshka.halo_model_funcs.u(k, m, c, mean_dens, delta_halo=200.0)

NFW in fourier space (hacked halomod)

matryoshka.halo_model_funcs.unnormed_P(k, T, ns)

Function to calculate the un-normalised primordial power spectrum. (hacked halomod).

Parameters
  • k (array) – k-bins of the transfer function(s).

  • T (array) – Transfer functions(s).

  • ns (array) – Value(s) of the spectral index.

Returns

Array of the un-normalised power spectrum/spectra.