Analytic Terms

This class outputs terms of the EFT power spectrum not directly emulated by the neural network.

class mentat_lss.models.analytic_terms.analytic_eft_model(num_tracers: int, redshift_list: list, ells: list, k: array, ndens: array)[source]

Class contatining calculations for the non-emulated terms of the EFT galaxy power spectrum

calculate_pk_lin(k: array, params: dict)[source]

Calculates the linear matter power spectrum.

This calculation is done by first calling symbolic_pofk, and then initializing a univariate spline object in log-k space.

Parameters:
  • k (np.array) – array of k-bins to calculate the power spectrum at

  • params (dict) – dictionary of parameters. Must include sigma8, Omega_m, Omega_b, h, and ns

get_analytic_terms(param_vector: array, emu_params_list: dict, analytic_params_list: dict)[source]

Calculates and returns the counterterm and stochastic contributions to the galaxy power spectrum.

Parameters:
  • param_vector (np.array) – 1D array of all parameters

  • emu_params_list (list) – list of parameters used by the emulator

  • analytic_params_list (list) – list of parameters used for the counterterms and shot-noise terms

Returns:

P_ctr + P_stoch multipoles. Has shape (nps, nz, nl, nk).

Return type:

pk_analtytic

get_ctr_terms(k: array, mu: array, b1_1: float, b1_2: float, ctr1: dict, ctr2: dict, f: float, D: float)[source]

Calculates the LO and NLO counterterms for the galaxy power spectrum for a specific tracer and redshift bin combination.

Parameters:
  • k (np.array) – k-array to calculate the matter power spectrum from. In units of h/Mpc

  • mu (np.array) – array of line-of-site cos(theta) values

  • b1_1 (float) – b1 for tracer 1

  • b1_2 (float) – b1 for tracer 2. If one tracer, or an auto-spectrum, this is equal to b1_1

  • ctr1 (dict) – dictionary of counterterm free parameters for tracer 1. Should contain (counterterm_0, counterterm_2, counterterm_4, and counterterm_fog)

  • ctr2 (dict) – dictionary of counterterm free parameters for tracer 2. Should contain (counterterm_0, counterterm_2, counterterm_4, and counterterm_fog). If one tracer, or an auto-spectrum, this is equal to ctr1

  • f (flaot) – Linear growth rate f(z)

  • D (float) – Linear growth factor D(z)

Returns:

counterterms with shape (k, mu)

Return type:

ctr_L0 + ctr_NL0 (np.array)

get_damping_factor(k: array, mu: array, f: float)[source]

Calculates the velocity damping factor

Parameters:
  • k (np.array) – k-array in units of h/Mpc

  • mu (np.array) – line-of-site direction cos(theta).

  • f (float) – linear growth rate f(z)

Returns:

damping factor with shape (k, mu)

Return type:

damp_fac (np.array)

get_k_nl(D: float, k0: float = 0.5)[source]

Calculates the k-mode where sigma_P(k) = 1

Parameters:
  • D (float) – linear growth rate D(a)

  • k0 (float) – Initial guess for k_nl. Default 0.5

Returns:

k-mode specifying the start of the nonlinear regiime.

Return type:

k_nl (float)

get_pk_lin(k: array, D: float, khigh=None)[source]

Retrieves the linear matter power spectrum from a univariate spline object

Parameters:
  • k (np.array) – k-array to calculate the matter power spectrum from. In units of h/Mpc

  • D (float) – Linear growth rate D(z). Used to transform to a specific redshift

Returns:

linear power spectrum in units of [h^{-3} Mpc^3] calculated at the given k array

Return type:

pk_lin (np.array)

get_pk_lin_irres_rsd(k: array, mu: array, f: float, D: float)[source]

Calculates the linear power spectrum including IR resummation, RSD, and velocity damping

Parameters:
  • k (np.array) – k-array to calculate the matter power spectrum from. In units of h/Mpc

  • mu (np.array) – array of line-of-site cos(theta) values

  • f (flaot) – Linear growth rate f(z)

  • D (float) – Linear growth factor D(z)

Returns:

Linear anisotropic power spectrum with shape (k, mu)

Return type:

pk (np.array)

get_stochastic_terms(k: array, mu: array, ps_idx: int, z_idx: int, stoch1: dict, k_nl: float, is_cross: bool = False)[source]

Calculates the stochastic comtribution to the galaxy power spectrum for a specific tracer and redshift bin combination.

Parameters:
  • k (np.array) – k-array to calculate the matter power spectrum from. In units of h/Mpc

  • mu (np.array) – array of line-of-site cos(theta) values

  • ps_idx (int) – index corresponding to the specifc tracer bin. Used to acces the correct number density.

  • z_idx (int) – index corresponding to the specifc redshift bin. Used to acces the correct number density.

  • stoch1 (dict) – dictionary of counterterm free parameters. Should include (P_shot, a0, a2)

  • k_nl (float) – non-linear k-mode.

  • is_cross (bool) – Whether the specific bin is an auto or cross spectrum. Default False.

  • NOTE – Currently set to ignore stochastic term for cross spectra.

Returns:

stochastic term in shape of (k, mu)

Return type:

pkmu (np.array)

get_tree_term(k: array, mu: array, bias1, bias2, f, D)[source]

Calculates the tree-level anisotropic galaxy power spectrum This term is also known as the Kaiser term.

NOTE: This function is not used by the current emulator version!

set_ir_resum_params(h: float, D: float)[source]

Initializes IR Resummation calculation object

Parameters:
  • h (float) – Hubble factor

  • D (float) – Linear growth rate D(a)

set_params(param_vector: array, emu_params_list: list, analytic_params_list: list)[source]

Sets cosmology, galaxy bias, counterterm, and shotnoise parameters

Parameters:
  • param_vector (np.array) – 1D array of all parameters

  • emu_params_list (list) – list of parameters used by the emulator

  • analytic_params_list (list) – list of parameters used for the counterterms and shot-noise terms