PyCosmo.BoltzmannSolver package

Submodules

PyCosmo.BoltzmannSolver.Fields module

class PyCosmo.BoltzmannSolver.Fields.Fields(cosmology)[source]

Bases: object

Class for linear perturbations field objects. Usage example: fields.delta(5) returns the dark matter density perturbation at the 5th time step

property a

a(a_index): scale factor [1]

property d_t

d_t: time step in ln(a) units (one fewer value than ln(a) [1]

set_results(lna, solver_result, keep_lna0)[source]
class PyCosmo.BoltzmannSolver.Fields.VectorWrapper(y, indices)[source]

Bases: object

PyCosmo.BoltzmannSolver.LinearPerturbationBoltzmann module

class PyCosmo.BoltzmannSolver.LinearPerturbationBoltzmann.LinearPerturbationBoltzmann(*a, **kw)[source]

Bases: PyCosmo.LinearPerturbationBase.LinearPerturbationBase

Class for computing linear perturbations by solving the Einstein-Boltzmann ODE system.

The Boltzmann solver is selected using the set function:

cosmo.set(pk_type = "boltz")
fields(k, grid, sec_factor=5, keep_lna0=False, initial_conditions=None, enable_fast_solver=True, enable_sparse_lu_solver=True)[source]

Solves the Einstein-Boltzmann ODE system for the evolution of the linear order perturbation of the fields.

Parameters
  • k – wavenumber \([h/Mpc]\)

  • grid – ln(a) values at which to output fields [1]

  • sec_factor – relaxes row permutation criterium in optimized LUP solver

  • keep_lna0 – if True includes the fields at initial time a_0

  • initial_conditions – can pass a_0, y_0 (vector of initial conditions)

  • enable_fast_solver – if set to False always use standard LUP solver for full matrix

  • enable_sparse_lu_solver – if set to True: avoid iterating over known zero-entries in fallback LUP solver

Returns

Linear order perturbations, accessed with fields.a, fields.Phi etc.

growth_a(a=1.0, k=None)[source]

Returns the linear growth factor computed from the Boltzmann solver at a given k value.

Parameters
  • a – scale factor [1]

  • k – wavenumber used to compute the growth factor (default:k=1 \(Mpc^{-1}\)) [\(Mpc^{-1}\)]

Returns

D(a): growth factor normalised to 1 at a=1 [1]

max_redshift(k)[source]

computes max redshift for which this model is applicable. uses the implemented initial conditions to determine this.

Parameters

k – wavenumber k [\(h Mpc^{-1}\)]

Returns

redshift

powerspec_a_k(a=1.0, k=0.1, diag_only=False, pool=None)[source]

Returns the linear total matter power spectrum computed from the Boltzmann solver, this includes cold dark matter, baryons and massive neutrinos for an array of a and k values.

Parameters
  • a – scale factor [1] (default:a=1)

  • k – wavenumber used to compute the power spectrum (default:k=1 Mpc^1) [Mpc^-1]

  • diag_only – if set to True: compute powerspectrum for pairs \(a_i, k_i\), else consider all combinations \(a_i, k_j\)

  • pool – instance of multiprocessing.pool.Pool for parallel computation

Warning

If pk_norm_type = ‘A_s’ this will compute the total matter power spectrum following the general relativistic treatment (using delta_m_tot). If pk_norm_type = ‘deltah’ the Poisson equation will be assumed and the evolution will be split in growth factor and transfer function. We recommend the use of A_s or sigma8 normalizations.

Returns

P(a,k): total matter power spectrum [\(Mpc^3\)]

powerspec_cb_a_k(a=1.0, k=0.1, diag_only=False, pool=None)[source]

Returns the linear matter power spectrum of cold dark matter and baryons computed from the Boltzmann solver for an array of a and k values.

Parameters
  • a – scale factor [1] (default:a=1)

  • k – wavenumber used to compute the power spectrum (default:k=1 \(Mpc^{-1}\)) [\(Mpc^{-1}\)]

  • diag_only – if set to True: compute powerspectrum for pairs \(a_i, k_i\), else consider all combinations \(a_i, k_j\)

  • pool – instance of multiprocessing.pool.Pool for parallel computation

Returns

P_cb(a,k): power spectrum of CDM+baryons [\(Mpc^3\)]

transfer_k(k, pool=None)[source]

Computes the linear matter transfer function using the Boltzmann solver assuming the Poisson equation.

Parameters

k – wavenumber \([ Mpc^{-1} ]\)

Returns

Transfer function \([ Mpc^{3/2} ]\)

PyCosmo.BoltzmannSolver.LinearPerturbationBoltzmann.print_new_traces(cache_file)[source]

PyCosmo.BoltzmannSolver.LsodaSolver module

class PyCosmo.BoltzmannSolver.LsodaSolver.LsodaSolver(verbose, rtol, atol, max_bdf_order, max_iter, cosmology, fast_solver, **extra_args_for_solver)[source]

Bases: object

SOLVER_ID = 'linear_perturbation'
initial_conditions(k)[source]
solve(k, grid, sec_factor=3, initial_conditions=None, enable_fast_solver=True, enable_sparse_lu_solver=True)[source]

Module contents