Initial power spectra

class camb.initialpower.InitialPower(*args, **kwargs)[source]

Abstract base class for initial power spectrum classes

class camb.initialpower.InitialPowerLaw(*args, **kwargs)[source]

Bases: InitialPower

Object to store parameters for the primordial power spectrum in the standard power law expansion.

Variables:
  • tensor_parameterization – (integer/string, one of: tensor_param_indeptilt, tensor_param_rpivot, tensor_param_AT)

  • ns – (float64)

  • nrun – (float64)

  • nrunrun – (float64)

  • nt – (float64)

  • ntrun – (float64)

  • r – (float64)

  • pivot_scalar – (float64)

  • pivot_tensor – (float64)

  • As – (float64)

  • At – (float64)

has_tensors()[source]

Do these settings have non-zero tensors?

Returns:

True if non-zero tensor amplitude

set_params(As=2e-09, ns=0.96, nrun=0, nrunrun=0.0, r=0.0, nt=None, ntrun=0.0, pivot_scalar=0.05, pivot_tensor=0.05, parameterization='tensor_param_rpivot')[source]

Set parameters using standard power law parameterization. If nt=None, uses inflation consistency relation.

Parameters:
  • As – comoving curvature power at k=pivot_scalar (\(A_s\))

  • ns – scalar spectral index \(n_s\)

  • nrun – running of scalar spectral index \(d n_s/d \log k\)

  • nrunrun – running of running of spectral index, \(d^2 n_s/d (\log k)^2\)

  • r – tensor to scalar ratio at pivot

  • nt – tensor spectral index \(n_t\). If None, set using inflation consistency

  • ntrun – running of tensor spectral index

  • pivot_scalar – pivot scale for scalar spectrum

  • pivot_tensor – pivot scale for tensor spectrum

  • parameterization – See CAMB notes. One of - tensor_param_indeptilt = 1 - tensor_param_rpivot = 2 - tensor_param_AT = 3

Returns:

self

class camb.initialpower.SplinedInitialPower(*args, **kwargs)[source]

Bases: InitialPower

Object to store a generic primordial spectrum set from a set of sampled k_i, P(k_i) values

Variables:

effective_ns_for_nonlinear – (float64) Effective n_s to use for approximate non-linear correction models

has_tensors()[source]

Is the tensor spectrum set?

Returns:

True if tensors

set_scalar_log_regular(kmin, kmax, PK)[source]

Set log-regular cublic spline interpolation for P(k)

Parameters:
  • kmin – minimum k value (not minimum log(k))

  • kmax – maximum k value (inclusive)

  • PK – array of scalar power spectrum values, with PK[0]=P(kmin) and PK[-1]=P(kmax)

set_scalar_table(k, PK)[source]

Set arrays of k and P(k) values for cublic spline interpolation. Note that using set_scalar_log_regular() may be better (faster, and easier to get fine enough spacing a low k)

Parameters:
  • k – array of k values (Mpc^{-1})

  • PK – array of scalar power spectrum values

set_tensor_log_regular(kmin, kmax, PK)[source]

Set log-regular cublic spline interpolation for tensor spectrum P_t(k)

Parameters:
  • kmin – minimum k value (not minimum log(k))

  • kmax – maximum k value (inclusive)

  • PK – array of scalar power spectrum values, with PK[0]=P_t(kmin) and PK[-1]=P_t(kmax)

set_tensor_table(k, PK)[source]

Set arrays of k and P_t(k) values for cublic spline interpolation

Parameters:
  • k – array of k values (Mpc^{-1})

  • PK – array of tensor power spectrum values