ComputeGalSpectro#

class cosmicjellyfish.LSSsurvey.spectro_obs.ComputeGalSpectro(cosmopars, fiducial_cosmopars=None, spectrobiaspars=None, IMbiaspars=None, spectrononlinearpars=None, PShotpars=None, fiducial_cosmo=None, bias_samples=None, use_bias_funcs=False, configuration=None)[source]#

Bases: object

set_internal_kgrid()[source]#

Updates the internal grid of wavenumbers used in the computation

activate_terms()[source]#

Update which modelling effects should be taken into consideration

set_spectro_dz_specs()[source]#

Updates the spectroscopic redshift error

set_spectro_bias_specs()[source]#

Updates the spectroscopic bias choices

qparallel(z)[source]#

Function implementing q parallel of the Alcock-Paczynski effect

Parameters:

z (numpy.ndarray) – list of redshifts for which the q parallel should be computed

Returns:

redshift dependant value of q parallel

Return type:

numpy.ndarray

qperpendicular(z)[source]#

Function implementing q perpendicular of the Alcock-Paczynski effect

Parameters:

z (numpy.ndarray) – list of redshifts for which the q perpendicular should be computed

Returns:

redshift dependant value of q perpendicular

Return type:

numpy.ndarray

kpar(z, k, mu)[source]#

Computes the parallel projection of a wavevector. Takes into acount AP-effect

Parameters:
Returns:

Observed parallel projection of wavevector onto the line of sight with AP-effect corrected for

kper(z, k, mu)[source]#

Computes the perpendicular projection of a wavevector. Takes into acount AP-effect

Parameters:
Returns:

Observed perpendicular projection of wavevector onto the line of sight with AP-effect corrected for

k_units_change(k)[source]#

Function that rescales the k-array, when asked for. The code is defined everywhere in 0/Mpc so a rescaling would be wrong.

Parameters:

k (float, numpy.ndarray) – wavenumbers in units of h sample/Mpc to be rescaled

Returns:

wavenumbers in un units of h ref/Mpc

Return type:

float, numpy.ndarray

kmu_alc_pac(z, k, mu)[source]#

Function rescaling k and mu with the Alcock-Paczynski effect

Parameters:
Return type:

numpy.ndarray, float

Note

Implements the following equation:

\[ \begin{align}\begin{aligned}k^{obs} = k\, \sqrt{\left(q_\| \mu \right)^2 + \left(1-\mu^2\right)q_\perp^2}\\\mu^{obs} = \mu\,q_\|\, \sqrt{\left(q_\| \mu \right)^2 + \left(1-\mu^2\right)q_\perp^2}^{-1}\end{aligned}\end{align} \]
spec_err_z(z, k, mu)[source]#

Function to compute the scale dependant suppression of the observed power spectrum due to the spectroscopic redshift error

Parameters:
Returns:

Suppression of the observed power spectrum due to the error on spectroscopic redshift determination.

Return type:

float, numpy.ndarray

Note

Implements the following equation:

\[\mathrm{Err} = \exp\left[-\sigma^2_\|\, k^2\, \mu^2 -\sigma_\perp^2 \,k^2\,\left(1- \mu^2\right)\right].\]
BAO_term(z)[source]#

Calculates the BAO term. This is the rescaling of the Fourier volume by the AP-effect

Parameters:

z (float, numpy.ndarray) – The redshifts of interest

Returns:

Value of BAO term at redshifts z

Return type:

float, numpy.ndarray

Note

Implements the following equation:

\[\mathrm{BAO} = q_\perp^2\,q_\|\]
bterm_fid(z, k=None, bias_sample='g')[source]#

Calculate the fiducial bias term for galaxies or intensity mapping.

Parameters:
  • z (float or numpy.ndarray) – Redshift value(s) at which to evaluate the bias term.

  • k (float or numpy.ndarray, optional) – Wavenumber(s) at which to evaluate the bias term.

  • bias_sample (str, optional) – Type of bias to compute. Must be either: - ‘g’ for galaxy clustering bias (default) - ‘I’ for intensity mapping bias

Returns:

The computed bias term at the specified z and k values.

Return type:

float or numpy.ndarray

Note

The total bias is computed as the product of a redshift-dependent term and a scale-dependent term: b_total = b(z) * b(k)

kaiserTerm(z, k, mu, b_i=None, just_rsd=False, bias_sample='g')[source]#

Computes the Kaiser redshift-space distortion term.

Parameters:
  • z (float, numpy.ndarray) – Redshifts of interest

  • k (float, numpy.ndarray) – Wave numbers at which to calculate the linear RSD

  • mu (float, numpy.ndarray) – cosine of angles between line of sight and the wavevector.

  • b_i (float, numpy.ndarray, optional) – galaxy bias at Redshifts z

  • just_rsd (bool, optional) – If True, returns only the RSD term. Otherwise, computes the full Kaiser term. Defaults to False.

  • bias_sample (str, optional) – Bias term to use from self.bterm_fid(). Possible values: ‘g’: galaxies, ‘I’: intensity mapping. Defaults to ‘g’.

Returns:

The computed Kaiser term for redshift space distortions.

Note

Implements the following equation:

\[\mathrm{RSD} = \left(b_i+f\,\mu^2\right)\]
FingersOfGod(z, k, mu, mode='Lorentz')[source]#

Calculates the Fingers of God effect in redshift-space power spectra.

Parameters:
  • z (float, numpy.ndarray) – The redshifts values of interest.

  • k (float) – The wavenumber for which the suppression should be computed

  • mu (float, numpy.ndarray) – The cosine of angle between the wavevector and the line-of-sight direction.

  • mode (str, optional) – A string parameter indicating the model to use. Defaults to ‘Lorentz’.

Returns:

The calculated FoG term, which is 1 if either FoG_switch is False or linear_switch is True. Otherwise, it depends on the specified mode.

Return type:

float, numpy.ndarray

Note

If mode is “Lorentz” this implements following equation

..math:

\mathrm{FoG} = \frac{1}{1+\left[f\,\sigma_p\,\mu^2\right]^2}
sigmapNL(zz)[source]#

Function to calculate the variance of the velocity dispersion

Parameters:

zz (float) – The redshift value at which to calculate the variance.

Returns:

Calculates the variance of the pairwise velocity dispersion. Enters into the FOG effect.

Return type:

float

sigmavNL(zz, mu)[source]#

Function to calculate the variance of the displacement field

Parameters:

zz (float) – The redshift value at which to calculate the variance.

Returns:

Calculates the variance of the displacement field. Enters into the dewiggling weight to obtain the mildly nonlinear power spectrum

Return type:

float

P_ThetaTheta_Moments(zz, moment=0)[source]#

Calculates the angular power spectrum moments of the velocity divergence field, also known as the Theta field.

Parameters:
  • zz (float) – The redshift value at which to calculate the power spectrum.

  • moment (int) – An integer indicating the order of the moment to calculate. Default is 0.

Returns:

The power spectrum moment of the velocity divergence field.

Return type:

float

normalized_pdd(z, k)[source]#

This function normalizes the power spectrum to have a variance smoothed over 8 Mpc/h of 1. This is to cancel out possible terms with \(\sigma_8\) in the RSD. :type z: :param z: The redshift at which to compute the normalized power spectrum :type z: float, numpy.ndarray :type k: :param k: Wavenumber at which to compute the normalized power spectrum :type k: float, numpy.ndarray

Returns:

The Normalized power spectrum

Return type:

float, numpy.ndarray

Note

This is not really a normalisation if there is no \(\sigma_8\) terms inside of the RSD (Kaiserterm). It is then canceled out automatically

normalized_pnw(z, k)[source]#

This function normalizes the power spectrum with the BAO wiggles subtracted from to have a variance smoothed over 8 Mpc/h of roughly 1. This is to cancel out possible terms with \(\sigma_8\) in the RSD. :type z: :param z: The redshift at which to compute the normalized ‘no-wiggle’ power spectrum :type z: float, numpy.ndarray :type k: :param k: Wavenumber at which to compute the normalized ‘no-wiggle’ power spectrum :type k: float, numpy.ndarray

Returns:

The Normalized ‘no-wiggle’ power spectrum

Return type:

float, numpy.ndarray

Note

This is not really a normalisation if there is no \(\sigma_8\) terms inside of the RSD (Kaiserterm). It is then canceled out automatically

dewiggled_pdd(z, k, mu)[source]#

This function calculates the normalized dewiggled power spectrum.

Parameters:
  • z (float, numpy.ndarray) – The redshifts values of interest.

  • k (float) – The wavenumber for which the power spectrum should be computed

  • mu (float, numpy.ndarray) – The cosine of angle between the wavevector and the line-of-sight direction.

Returns:

The the mildly non-linear (dewiggled) power spectrum.

Return type:

float, numpy.ndarray

Note

If the config asks for only linear spectrum this just returns the power spectrum normalized with either 1 or 1/sigma8^2

observed_Pgg(z, k, mu, b_i=None)[source]#

This function calculates the observed galaxy power spectrum.

Parameters:
  • z (float, numpy.ndarray) – The redshifts values of interest.

  • k (float) – The wavenumber for which the power spectrum should be computed

  • mu (float, numpy.ndarray) – The cosine of angle between the wavevector and the line-of-sight direction.

  • b_i (float, numpy.ndarray, optional) – Redshift dependant values of the galaxy bias

Returns:

The observed galaxy power spectrum

Return type:

float, numpy.ndarray

Note

In presence of all modeling terms, this function implements the following equation:

\[P^{obs}_{gg} = q_\perp^2 \, q_\| \, \mathrm{RSD}^2 \, \mathrm{FoG}\, \frac{P_{dw}^{obs}}{\sigma_8^2} \, \mathrm{Err} + P_{shot}\]
lnpobs_gg(z, k, mu, b_i=None)[source]#

This function calculates the natural logarithm of the observed galaxy power spectrum.

Parameters:
  • z (float, numpy.ndarray) – The redshifts values of interest.

  • k (float) – The wavenumber for which the power spectrum should be computed

  • mu (float, numpy.ndarray) – The cosine of angle between the wavevector and the line-of-sight direction.

  • b_i (float, numpy.ndarray, optional) – Redshift dependant values of the galaxy bias

Returns:

The observed galaxy power spectrums natural logarithm

Return type:

float, numpy.ndarray

set_IM_bias_specs()[source]#

Updates the IM bias choices

Temperature(z, fixed_cosmo=True)[source]#

obtaining the temperature (T^2(z)) for the Power Spectrum (PHI(z))