cosmicfishpie.LSSsurvey package

Submodules

cosmicfishpie.LSSsurvey.photo_cov module

LSS MAIN

This is the main engine for LSS Fisher Matrix.

class cosmicfishpie.LSSsurvey.photo_cov.PhotoCov(cosmopars, photopars, IApars, biaspars, fiducial_Cls=None, enable_cache=True, cache_size=32)[source]

Bases: object

compute_covmat()[source]

Computes the fiducial covariance matrix for the Fisher matrix.

Returns:

  • dict – a dictionary with all the auto and cross correlation fiducial angular power spectra with noise added to it

  • list – A list of pandas.DataFrame objects that store the covariance matrix for each multipole

compute_derivs(print_info_specs=False)[source]

computes the derivatives of the angular power spectrum needed to compute the Fisher matrix

Returns:

a dictionary containing the derivatives of the angular power spectrum at the fiducial for all free parameters

Return type:

dict

get_covmat(noisy_cls)[source]

Computes the covariance matrix from the noisy angular power spectrum

Parameters:

noisy_cls (dict) – a dictionary with all the auto and cross correlation angular power spectra with noise added to it

Returns:

A list of pandas.DataFrame objects that store the covariance matrix for each multipole

Return type:

list

getcls(allpars)[source]

Function to calculate the angular power spectrum

Parameters:

allpars (dict) – a dictionary with all parameters needed to compute the angular power spectrum

Returns:

a dictionary with all the auto and cross correlation angular power spectra

Return type:

dict

getclsnoise(cls)[source]

Obtain the angular power spectrum with noise

Parameters:

cls (dict) – a dictionary with all the auto and cross correlation angular power spectra

Returns:

a dictionary with all the auto and cross correlation angular power spectra with noise added to it

Return type:

dict

Note

Implements the following equation:

\[ \begin{align}\begin{aligned}N_{ij}^{YX}(\ell) = \frac{\sigma_X^2}{\bar{n}_i}\,\delta_{XY}\,\delta_{ij}\\\sigma_L = \sigma_\epsilon \quad , \quad \sigma_G = 1\end{aligned}\end{align} \]

cosmicfishpie.LSSsurvey.photo_obs module

CLS

This module contains cls calculations (only LSS atm).

class cosmicfishpie.LSSsurvey.photo_obs.ComputeCls(cosmopars, photopars, IApars, biaspars, print_info_specs=False, fiducial_cosmo=None)[source]

Bases: object

P_limber()[source]

Calculates the Limber-approximated power spectrum. This is done for a range of redshift values and multipoles. Will add MG effects to WL and(!) GCph if asked for.

Note

This does not return the power spectra. The results are stored in the attribute Pell

clsintegral(obs1, obs2, bin1, bin2, hub)[source]

function to obtain the angular power spectrum as an function of the multipole.

Parameters:
  • obs1 (str) – name of the observable of the redshift bin bin1 (GC or WL)

  • obs2 (str) – name of the observable of the redshift bin bin2 (GC or WL)

  • bin1 (int) – index of the redshift bin at which the observable obs1 is measured

  • bin2 (int) – index of the redshift bin at which the observable obs2 is measured

  • hub (callable) – function that should be passed a numpy.ndarray of redshifts returns the hubble expansion rate at these redshifts.

Returns:

Function that receives an array multipole and returns the angular power spectrum for these multipoles.

Return type:

callable

compute_all()[source]

Main function to compute the angular power spectrum. Will first compute the limber approximated angular power spectrum and the window functions for both probes. From that it will obtain the angular power spectrum.

Note

This function does not return the calculated quantities. Rather they are found in new attributes of the object.

The result of the Limber approximated power spectra are found in the new attributes Pell and sqrtPell

The window functions are found in the new attributes GC if galaxy clustering is asked for, and WL if cosmic sheer is asked for

The angular power spectrum is found in the new attribute result

compute_kernels()[source]

function to compute all the needed window functions.

Note

This does not return the window functions. They are found in the new attributes GC if galaxy clustering is asked for, and WL if cosmic sheer is asked for

computecls()[source]

Function to compute the angular power spectrum for all observables, redshift bins and multipoles.

Returns:

a dictionary containing all auto and cross correlation angular power spectra. Its keys are formatted to have an array of the power spectra in ‘X ixY j’. Also the multipoles for which the angular power spectra were computed for are found in ‘ells’.

Return type:

dict

Note

Implements the following equation:

\[C_{i,j}^{X,Y}(\ell) = c \int \mathrm{d}z \frac{W_i^X (z)W_j^Y (z)}{ H(z) r^2(z)} P_{\delta \delta} \big[\frac{\ell + 1/2}{r(z)} , z \big]\]
computecls_vectorized()[source]

Vectorized function to compute the angular power spectrum for all observables, redshift bins and multipoles.

Returns:

a dictionary containing all auto and cross correlation angular power spectra. Its keys are formatted to have an array of the power spectra in ‘X ixY j’. Also the multipoles for which the angular power spectra were computed for are found in ‘ells’.

Return type:

dict

Note

Implements the following equation:

\[C_{i,j}^{X,Y}(\ell) = c \int \mathrm{d}z \frac{W_i^X (z)W_j^Y (z)}{ H(z) r^2(z)} P_{\delta \delta} \big[\frac{\ell + 1/2}{r(z)} , z \big]\]
galaxy_kernel(z, i)[source]

Calculates the GCph kernel function

Parameters:
  • z (numpy.ndarray) – array containing the redshifts for which the kernel should be computed for

  • i (int) – index of the redshift bin

Returns:

Value of the galaxy clustering kernel at redshift z for bin i

Return type:

numpy.ndarray

Note

Implements the following equation:

\[W_i^{GCph} = b(z) \frac{n_i(z)}{\bar{n}(z)} H(z)\]
genwindow(z, obs, i)[source]

generic function to obtain the window functions for the different observables.

Parameters:
  • z (numpy.ndarray) – array of redshifts for which the window function should be computed

  • obs (str) – name of the observable (GC or WL)

  • i (int) – integer of the redshift bin the window should be computed for

Returns:

Values of the window function for the observable obs, for redshift bin i, and at redshifts z.

Return type:

numpy.ndarray

integral_efficiency(i)[source]

computes the integral that enters the lensing kernel for a given redshift bin

Parameters:

i (int) – index of the redshift bin for which the lensing efficiency should be calculated

Returns:

callable function that receives a numpy.ndarray of requested redshifts and returns the lensing efficiency for the i-th bin as a numpy.ndarray

Return type:

callable

lensing_efficiency()[source]

computes the integral that enters the lensing kernel for all redshift bins

Returns:

list of callable functions that give the lensing efficiency for each bin

Return type:

list

lensing_kernel(z, i)[source]

Computes the photometric cosmic shear kernel function

Parameters:
  • z (numpy.ndarray) – array containing the redshifts for which the kernel should be computed for

  • i (int) – index of the redshift bin

Returns:

Value of the cosmic shearing kernel at redshift z for bin i

Return type:

numpy.ndarray

Note

Implements the following equation:

\[W_i^{WL} = W_i^{IA}+\frac{3}{2}\left(\frac{H_0}{c}\right)^2\Omega_{m,0}(1+z)r(z) \int_z^{z_{\rm max}}{dz' \frac{n_i(z')}{\bar{n}(z)}\left[1-\frac{r(z)}{r(z')}\right]}\]
print_numerical_specs()[source]

prints the numerical specifications of the internal computations

sqrtP_limber()[source]

Calculates the square root of the Limber-approximated power spectrum for weak lensing (WL) and galaxy clustering photometric (GCph) observables. This is done for a range of redshift values and multipoles. Depending on the tracer asked for in ‘GCph_Tracer’ will use ‘matter’ or ‘clustering’ observable GCph. Will add MG effects to WL if asked for.

Note

This does not return the power spectra. The results are stored in the attribute sqrtPell

cosmicfishpie.LSSsurvey.photo_obs.faster_integral_efficiency(i, ngal_func, comoving_func, zarr)[source]

function to do the integration over redshift that shows up in the lensing kernel

Parameters:
  • i (int) – index of the redshift bin for which the lensing kernel should be computed

  • ngal_func (callable) – callable function that returns the number density distribution of galaxies. Should be a function of the redshift bin index i as an int and the redshift z as a numpy.ndarray

  • comoving_func (callable) – callable function that returns the comoving distance. Should beb a function of the redshift z as a numpy.ndarray

  • zarr (numpy.ndarray) – 1d array of all redshifts z that should be used as integration points.

Returns:

callable function that receives a numpy.ndarray of requested redshifts and returns the lensing efficiency for the i-th bin as a numpy.ndarray

Return type:

callable

cosmicfishpie.LSSsurvey.photo_obs.memo_integral_efficiency(i, ngal_func, comoving_func, z, zint_mat, diffz)[source]

Legacy O(N^2) implementation of the efficiency integral.

Notes

  • Deprecated: prefer faster_integral_efficiency (vectorized) or much_faster_integral_efficiency (O(N)).

  • This version performs a per-row trapezoidal integration on the original redshift grid to ensure numerically correct spacing. The zint_mat and diffz arguments are ignored for correctness (they were prone to inconsistent spacing per row).

Parameters:
  • i (int) – Bin index.

  • ngal_func (callable) – Function returning n(z’) given (z’, i, kind).

  • comoving_func (callable) – Function returning r(z).

  • z (numpy.ndarray) – 1D redshift grid.

  • zint_mat (numpy.ndarray) – Ignored (kept for backward compatibility).

  • diffz (numpy.ndarray or float) – Ignored (kept for backward compatibility).

Returns:

Interpolating function over z for the efficiency.

Return type:

callable

cosmicfishpie.LSSsurvey.photo_obs.much_faster_integral_efficiency(i, ngal_func, comoving_func, zarr)[source]

O(N) algorithm for the lensing efficiency integral using backward cumulative trapezoid integrals.

Parameters:
  • i (int) – index of the redshift bin for which the lensing kernel should be computed

  • ngal_func (callable) – callable function that returns the number density distribution of galaxies. Should be a function of the redshift bin index i as an int and the redshift z as a numpy.ndarray

  • comoving_func (callable) – callable function that returns the comoving distance. Should be a function of the redshift z as a numpy.ndarray

  • zarr (numpy.ndarray) – 1d array of all redshifts z that should be used as integration points.

Returns:

callable function that receives a numpy.ndarray of requested redshifts and returns the lensing efficiency for the i-th bin as a numpy.ndarray

Return type:

callable

cosmicfishpie.LSSsurvey.photo_window module

LSS_window

This module returns the window functions for LSS surveys.

class cosmicfishpie.LSSsurvey.photo_window.GalaxyPhotoDist(photopars)[source]

Bases: object

dNdz(z)[source]

unnormalized dN/dz(z)

Parameters:

z (numpy.ndarray) – array of redshifts at which to compute the galaxy distribution

Returns:

unnormalized theoretical galaxy redshift distribution

Return type:

numpy.ndarray

Note

Implements the following parametrization:

\[\frac{{\rm d} N}{{\rm d} z} = \left(\frac{z}{z_b}\right)^2 \, \exp \left[-\left(\frac{z}{z_0}\right)^{n_\gamma} \right]\]
n_i(z, i, obs='GCph')[source]

Function to compute the unnormalized dN/dz(z) with a window picking function applied to it

Parameters:
  • z (float) – Redshift

  • i (int) – index of the redshift bin

Returns:

binned distribution without photometric redshift errors

Return type:

float

ngal_photoz(z, i, obs)[source]

Function to compute the binned galaxy redshift distribution convolved with photometric redshift errors n^{ph}_i(z)

Parameters:
  • z (float) – redshift at which to compute the distribution

  • i (int) – index of the redshift bin

Returns:

binned galaxy distribution convolved with photometric redshift errors

Return type:

float

Note

Implements the following equation:

\[p_{ph}(z_p|z) = \frac{1-f_{out}}{\sqrt{2\pi}\sigma_b(1+z)} \exp\left\{-\frac{1}{2}\left[\frac{z-c_bz_p-z_b}{\sigma_b(1+z)}\right]^2\right\} \ + \frac{f_{out}}{\sqrt{2\pi}\sigma_0(1+z)} \exp\left\{-\frac{1}{2}\left[\frac{z-c_0z_p-z_0}{\sigma_0(1+z)}\right]^2\right\}\]
norm(obs)[source]

n^{ph}_i(z)

Parameters:
  • z (float) – redshift at which to compute the function

  • i (integer) – redshift bin index

Returns:

normalized binned galaxy distribution convolved with photoz errors

Return type:

float

norm_ngal_photoz(z, i, obs)[source]

n^{ph}_i(z)

Parameters:
  • z (array) – redshift at which to compute the function

  • i (integer) – redshift bin index

Returns:

normalized binned galaxy distribution convolved with photoz errors

Return type:

float

cosmicfishpie.LSSsurvey.spectro_cov module

CLS

This module contains cls calculations (only LSS atm).

class cosmicfishpie.LSSsurvey.spectro_cov.SpectroCov(fiducialpars, fiducial_specobs=None, bias_samples=['g', 'g'], configuration=None)[source]

Bases: object

P_noise_21(z, k, mu, temp_dim=True, beam_term=False)[source]

Compute the shotnoise of the 21 centimeter intensity mapping probe

Parameters:
  • z (float, numpy.ndarray) – Redshift at which the noise is to be computed

  • k (float, numpy.ndarray) – Wavenumber

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

  • temp_dim (bool) – If true the Temperature terms is in units of Kelvin^2

  • beam_term (bool) – If true will add the beam term to the computation of the power spectrum

Returns:

Additional shotnoise of the 21 cm intensity mapping

Return type:

float, numpy.ndarray

Tsys_func(z)[source]

Calculates Tsys in mK

Parameters:

z (float, numpy.ndarray) – Redshift at which to compute Tsys

Returns:

Tsys at z in milli Kelvin

Return type:

float, numpy.ndarray

cov(ibin, k, mu)[source]

Function to calculate the covariance the galaxy clustering probe

Parameters:
  • ibin (int) – Index of the redshift bin for which the covariance is to be computed

  • k (float, numpy.ndarray) – Wavenumber

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

Returns:

Covariance of the Galaxy clustering probe

Return type:

float, numpy.ndarray

d_volume(ibin)[source]

Calculates the comoving volume of a redshift bin

Parameters:

i (int) – Index of the survey redshift bin

Returns:

Comoving volume of the redshift bin

Return type:

float

n_density(zi)[source]

calculate the comoving number density of the probe

Parameters:

i (int) – Index of the survey redshift bin

Returns:

comoving number density of the probe

Return type:

float

noisy_P_ij(z, k, mu, si='I', sj='g')[source]
veff(zi, k, mu)[source]

calculate the effective volume entering the covariance of the galaxy clustering probe

Parameters:
  • zi (float) – Redshift of the inner sphere

  • k (float, numpy.ndarray) – wave number at which the effective volume should be calculated

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

  • Returns

  • float – The effective volume for a given wavenumber, angle and redshift

  • numpy.ndarray – The effective volume for a given wavenumber, angle and redshift

veff_II(zi, k, mu)[source]

calculate the effective volume entering the covariance of the line intensity mapping probe

Parameters:
  • zi (float) – Redshift

  • zi – Redshift

  • k (float, numpy.ndarray) – wave number at which the effective volume should be calculated

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

  • Returns

  • float – The effective volume for a given wavenumber, angle and redshift

  • numpy.ndarray – The effective volume for a given wavenumber, angle and redshift

veff_Ig(zi, k, mu)[source]

calculate the effective volume entering the covariance of the cross correlation of galaxy clustering and intensity mapping

Parameters:
  • zi (float) – Redshift

  • zi – Redshift

  • k (float, numpy.ndarray) – wave number at which the effective volume should be calculated

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

  • Returns

  • float – The effective volume for a given wavenumber, angle and redshift

  • numpy.ndarray – The effective volume for a given wavenumber, angle and redshift

volume_bin(zi, zj)[source]

Calculates the comoving volume of a spherical shell

Parameters:
Returns:

Volume of the comoving spherical shell between zj and zi

Return type:

float, numpy.ndarray

volume_survey(ibin)[source]

Calculates the survey volume of a redshift bin

Parameters:

i (int) – Index of the survey redshift bin

Returns:

survey volume of the redshift bin

Return type:

float

class cosmicfishpie.LSSsurvey.spectro_cov.SpectroDerivs(z_array, pk_kmesh, pk_mumesh, fiducial_spectro_obj, bias_samples=['g', 'g'], configuration=None)[source]

Bases: object

compute_derivs(freeparams={})[source]

Calls the common derivative engine to compute the derivatives of the observed power spectrum

Parameters:

freeparams (dict, optional) – A dictionary containing the names and step sizes for all parameters you want to vary. Will default to the global free params if not passed.

Returns:

A dictionary containing lists of derivatives of the observed power spectrum for each redshift bin and parameter

Return type:

dict

dlnpobs_dcosmop(zi, k, mu, par)[source]

This is a deprecated function! It was used to compute the compute the derivatives of the power spectrum with respect to the cosmological parameters internally in the cosmicfishpie.LSSsurvey.spectro_cov.SpectroDerivs . Use now the common derivative engine at cosmicfishpie.fishermatrix.derivatives.derivatives

Parameters:
  • zi (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.

  • par (str) – Name of the parameter with regards to which the derivative should be computed for

Returns:

Derivative of the observed power spectrum with regard to the passed parameter

Return type:

float, numpy.ndarray

dlnpobs_dnuisp(zi, k, mu, par)[source]

This is a deprecated function! It was used to compute the compute the derivatives of the power spectrum with respect to nuisance parameters in the cosmicfishpie.LSSsurvey.spectro_cov.SpectroDerivs . Use now the common derivative engine at cosmicfishpie.fishermatrix.derivatives.derivatives

Parameters:
  • zi (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.

  • par (str) – Name of the parameter with regards to which the derivative should be computed for

Returns:

Derivative of the observed power spectrum with regard to the passed parameter

Return type:

float, numpy.ndarray

dlnpobs_dp(zi, k, mu, par)[source]

This is a deprecated function! It was used to compute the compute the derivatives of the power spectrum internally in the cosmicfishpie.LSSsurvey.spectro_cov.SpectroDerivs . Use now the common derivative engine at cosmicfishpie.fishermatrix.derivatives.derivatives

Parameters:
  • zi (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.

  • par (str) – Name of the parameter with regards to which the derivative should be computed for

Returns:

Derivative of the observed power spectrum with regard to the passed parameter

Return type:

float, numpy.ndarray

exact_derivs(par)[source]

Compute the exact log derivative of the Power spectrum with respect to the shotnoise using chain rule

Parameters:

par (str) – String name of the Shotnoise parameter for which the exact derivative should be computed from

Returns:

A dictionary containing the exact log derivative with respect to the shotnoise parameter

Return type:

dict

get_obs(allpars)[source]

function to obtain the power spectrum of the observable

Parameters:

allpars (dict) – A dictionary containing all relevant parameters to compute the observed power spectrum

Returns:

A dictionary containing the observed power spectrum on the k and mu grid for all redshift bins

Return type:

dict

initialize_obs(allpars)[source]
kronecker_bins(par, zmids, zi)[source]

function to figure out what bin a parameter corresponds and compares to the redshift passed

Parameters:
  • par (str) – String name of a parameter. The name should end with ‘_i’ where i marks the bin it corresponds to

  • zmid (numpy.ndarray) – List of the centers for the redshift bin

  • zi (float) – redshift for which we want to find the bin

Returns:

returns 1 if passed redshift is in the bin corresponding to the parameter. Returns 0 else wise

Return type:

int

cosmicfishpie.LSSsurvey.spectro_obs module

CLS

This module contains cls calculations (only LSS atm).

class cosmicfishpie.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

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_\|\]
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}
Omega_HI(z)[source]
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

Temperature(z, fixed_cosmo=True)[source]

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

activate_terms()[source]

Update which modelling effects should be taken into consideration

alpha_SD()[source]
beta_SD(z, k, mu)[source]
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)

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

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

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)\]
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} \]
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

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

lnpobs_ij(z, k, mu, bsi_z=None, bsj_z=None, si='I', sj='g')[source]
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

observed_P_ij(z, k, mu, bsi_z=None, bsj_z=None, si='I', sj='g')[source]
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}\]
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

set_IM_bias_specs()[source]

Updates the IM bias choices

set_IM_specs()[source]
set_fiducial_cosmology(fiducial_cosmopars=None, fiducial_cosmo=None)[source]
set_internal_kgrid()[source]

Updates the internal grid of wavenumbers used in the computation

set_spectro_bias_specs()[source]

Updates the spectroscopic bias choices

set_spectro_dz_specs()[source]

Updates the spectroscopic redshift error

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

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].\]
theta_b(zz)[source]