cosmo_functions#
- class cosmicjellyfish.cosmology.cosmology.cosmo_functions(cosmopars, input=None, *, configuration=None)[source]#
Bases:
object- matpow(z, k, nonlinear=False, tracer='matter')[source]#
Calculates the power spectrum of a given tracer quantity at a specific redshift and wavenumber.
- Parameters:
z (
float) – The redshift of interest.k (
array_like) – An array of wavenumbers at which to compute the power spectrum. These must be in units of 1/Mpc and should be sorted in increasing order.nonlinear (
bool, optional) – A boolean indicating whether or not to include nonlinear corrections to the matter power spectrum. The default value is False.tracer (
str, optional) – A string indicating which trace quantity to use for computing the power spectrum. If this argument is “matter” or anything other than “clustering”, the power spectrum functions Pmm will be used to compute the power spectrum. If the argument is “clustering”, the power spectrum function Pcb will be used instead. The default value is “matter”.
- Returns:
Array containing the calculated power spectrum values.
- Return type:
np.ndarray
Warning
If tracer is not “matter” or “clustering”, a warning message is printed to the console saying the provided tracer was not recognized and the function defaults to using Pmm to calculate the power spectrum of matter.
- Pmm(z, k, nonlinear=False)[source]#
Compute the power spectrum of the total matter species (MM) at a given redshift and wavenumber.
- Parameters:
self – An instance of the current class.
z – The redshift at which to compute the MM power spectrum.
k – The wavenumber at which to compute the MM power spectrum in 1/Mpc.
nonlinear (
bool, optional) – If True, include nonlinear effects in the computation. Default is False.
- Returns:
The value of the MM power spectrum at the given redshift and wavenumber.
- Return type:
- Pcb(z, k, nonlinear=False)[source]#
Compute the power spectrum of the clustering matter species (CB) at a given redshift and wavenumber.
- Parameters:
self – An instance of the current class.
z – The redshift at which to compute the CB power spectrum.
k – The wavenumber at which to compute the CB power spectrum in 1/Mpc.
nonlinear (
bool, optional) – If True, include nonlinear effects in the computation. Default is False.
- Returns:
The value of the CB power spectrum at the given redshift and wavenumber.
- nonwiggle_pow(z, k, nonlinear=False, tracer='matter')[source]#
Calculate the power spectrum at a specific redshift and wavenumber, after smoothing to remove baryonic acoustic oscillations (BAO).
- Parameters:
z – The redshift of interest.
k – An array of wavenumbers at which to compute the power spectrum. Must be in units of Mpc^-1/h. Should be sorted in increasing order.
nonlinear (default:
False) – Whether to include nonlinear corrections to the matter power spectrum. Default is False.tracer (default:
'matter') – Which perturbations to use for computing the power spectrum. Options are ‘matter’ or ‘clustering’. Default is ‘matter’.
- Returns:
An array of power spectrum values corresponding to the input wavenumbers. Units are (Mpc/h)^3.
Note
This function computes the power spectrum of a given tracer quantity at a specific redshift, using the matter power spectrum function matpow. It then applies a Savitzky-Golay filter to smooth out the BAO features in the power spectrum. This is done by first taking the natural logarithm of the power spectrum values at a set of logarithmic wavenumbers spanning from kmin_loc to kmax_loc. The smoothed power spectrum is then returned on a linear (not logarithmic) grid of wavenumbers given by the input array k.
- sigma8_of_z(z, tracer='matter')[source]#
sigma_8
- Parameters:
z (
float) – redshifttracer (
String) – either ‘matter’ if you want sigma_8 calculated from the total matter power spectrum or ‘clustering’ if you want it from the Powerspectrum with massive neutrinos substracted
- Returns:
The Variance of the matter perturbation smoothed over a scale of 8 Mpc/h
- Return type:
- Omegam_of_z(z)[source]#
Omega matter fraction as a function of redshift
- Parameters:
z (
float) – redshift- Returns:
Omega matter (total) at the redshifts of the input redshift z
- Return type:
Note
Assumes standard matter evolution Implements the following equation:
\[Omega_m(z) = Omega_{m,0}*(1+z)^3 / E^2(z)\]
- f_growthrate(z, k=None, gamma=False, tracer='matter')[source]#
Growth rate in LCDM gamma approximation
- Parameters:
z (
float) – redshift- Returns:
Growth rate values at the redshifts of the input redshift, using self.gamma as gamma value.
- Return type:
Note
Implements the following equation:
\[f(z) = Omega_m(z)^{\gamma}\]
- fsigma8_of_z(z, k=None, gamma=False, tracer='matter')[source]#
Growth rate in LCDM gamma approximation
- Parameters:
z (
float) – redshift- Returns:
Growth rate values at the redshifts of the input redshift, using self.gamma as gamma value.
- Return type:
Note
Implements the following equation:
\[f(z) = Omega_m(z)^{\gamma}\]