boltzmann_code#
- class cosmicjellyfish.cosmology.cosmology.boltzmann_code(cosmopars, code='camb', *, configuration=None)[source]#
Bases:
object- set_cosmicfish_defaults()[source]#
Fill up default values in the cosmopars dictionary if the values are not found.
This method sets default values for various cosmological parameters if they are not already present in the cosmopars dictionary.
- static print_cosmo_params(cosmopars, feedback=1, text='---Cosmo pars---')[source]#
Print cosmological parameters.
- static f_deriv(D_growth_zk, z_array, k_array, k_fix=False, fixed_k=0.001)[source]#
Calculate the growth rate f(z,k).
- Parameters:
D_growth_zk (
callable) – Function that returns the growth factor D(z,k).z_array (
array_like) – Array of redshift values.k_array (
array_like) – Array of wavenumbers.k_fix (
bool, optional) – If True, use a fixed k value (default is False).fixed_k (
float, optional) – Fixed k value to use if k_fix is True (default is 1e-3).
- Returns:
Growth rate f(z,k) and the corresponding z array.
- Return type:
- static compute_sigma8(z_range, pk_interpolator, h_value, k_range)[source]#
Calculate sigma8 over a range of redshifts using a given power spectrum interpolator.
This function computes sigma8, which is the RMS matter fluctuation in spheres of 8 h^-1 Mpc radius, for a range of redshifts. It uses a provided power spectrum interpolator to perform the calculation.
- Parameters:
z_range (
numpy.ndarray) – Array of redshift values at which to calculate sigma8.pk_interpolator (
callable) – A function that takes (z, k) as arguments and returns the power spectrum P(k,z). It should be able to handle array inputs for both z and k.
- Returns:
A 1-D interpolation function sigma8(z) that can be used to obtain sigma8 values for any redshift within the input range.
- Return type:
- camb_setparams(cosmopars, camb)[source]#
Set the parameters for CAMB computation.
- Parameters:
cosmopars (
dict) – Dictionary containing the cosmological parameters.camb (
module) – The CAMB module.
Notes
This method sets up CAMB parameters and prepares for power spectrum computation.
- camb_results(camb)[source]#
Compute and store CAMB results.
- Parameters:
camb (
module) – The CAMB module.
Notes
This method computes various cosmological quantities using CAMB and stores them in the results attribute.
- class_setparams(cosmopars)[source]#
Set the parameters for CLASS computation.
- Parameters:
cosmopars (
dict) – Dictionary containing the cosmological parameters.
Notes
This method sets up CLASS parameters and prepares for power spectrum computation.
- class_results(Class)[source]#
Compute and store CLASS results.
- Parameters:
Class (
class) – The CLASS class.
Notes
This method computes various cosmological quantities using CLASS and stores them in the results attribute.
- changebasis_symb(cosmopars)[source]#
Convert and adjust cosmological parameters for symbolic computation.
This method takes the input cosmological parameters and converts them to the format required for symbolic computation. It handles unit conversions, derives some parameters, and ensures consistency between different parameterizations (e.g., sigma8 and As).
- Parameters:
cosmopars (
dict) – Dictionary containing the input cosmological parameters.- Returns:
A new dictionary with the converted and adjusted parameters suitable for symbolic computation.
- Return type:
- Raises:
ValueError – If there’s an issue with the sigma8 to As conversion or vice versa.
KeyError – If required parameters are missing from the input.
Notes
The method performs conversions between h and H0, ombh2 and Omegab, and handles various representations of the primordial power spectrum amplitude (As, sigma8).
Debug information is printed if the upr.debug flag is set.
- symbolic_setparams()[source]#
Set up parameters for symbolic computation.
Notes
This method prepares the cosmological parameters and numerical settings for symbolic power spectrum computation.
- Raises:
ValueError – If the cosmological model is not supported by the symbolic code.