Cosmopower (Boltzmann Emulator)

Cosmopower Emulators

class soliket.CosmoPower(info: Mapping[str, Any] = mappingproxy({}), name: str | None = None, timing: bool | None = None, packages_path: str | None = None, initialize=True, standalone=True)[source]

A CosmoPower Network wrapper for Cobaya.

calculate(state: dict, want_derived: bool = True, **params) bool[source]

Do the actual calculation and store results in state dict

Parameters:
  • state – dictionary to store results

  • want_derived – whether to set state[‘derived’] derived parameters

  • params_values_dict – parameter values

Returns:

None or True if success, False for fail

cmb_unit_factor(spectra: str, units: str = 'FIRASmuK2', Tcmb: float = 2.7255) float[source]

Calculate the CMB prefactor for going from dimensionless power spectra to CMB units.

Parameters:
  • spectra – a length 2 string specifying the spectrum for which to calculate the units.

  • units – a string specifying which units to use.

  • Tcmb – the used CMB temperature [units of K].

Returns:

The CMB unit conversion factor.

ell_factor(ls: ndarray, spectra: str) ndarray[source]

Calculate the ell factor for a specific spectrum. These prefactors are used to convert from Cell to Dell and vice-versa.

See also: cobaya.BoltzmannBase.get_Cl camb.CAMBresults.get_cmb_power_spectra

Examples:

ell_factor(l, “tt”) -> \(\ell ( \ell + 1 )/(2 \pi)\)

ell_factor(l, “pp”) -> \(\ell^2 ( \ell + 1 )^2/(2 \pi)\).

Parameters:
  • ls – the range of ells.

  • spectra – a two-character string with each character being one of [tebp].

Returns:

an array filled with ell factors for the given spectrum.

get_Cl(ell_factor: bool = False, units: str = 'FIRASmuK2') dict[source]

Returns a dictionary of lensed total CMB power spectra and the lensing potential pp power spectrum.

Set the units with the keyword units=number|'muK2'|'K2'|'FIRASmuK2'|'FIRASK2'. The default is FIRASmuK2, which returns CMB \(C_\ell\)’s in FIRAS-calibrated \(\mu K^2\), i.e. scaled by a fixed factor of \((2.7255\cdot 10^6)^2\) (except for the lensing potential power spectrum, which is always unitless). The muK2 and K2 options use the model’s CMB temperature.

If ell_factor=True (default: False), multiplies the spectra by \(\ell(\ell+1)/(2\pi)\) (or by \([\ell(\ell+1)]^2/(2\pi)\) in the case of the lensing potential pp spectrum, and \([\ell(\ell+1)]^{3/2}/(2\pi)\) for the cross spectra tp and ep).

get_requirements() Iterable[tuple[str, str]][source]

Get a dictionary of requirements (or a list of requirement name, option tuples) that are always needed (e.g. must be calculated by another component or provided as input parameters).

Returns:

dictionary or list of tuples of requirement names and options (or iterable of requirement names if no optional parameters are needed)

Derived Parameters Emulators

class soliket.CosmoPowerDerived(info: Mapping[str, Any] = mappingproxy({}), name: str | None = None, timing: bool | None = None, packages_path: str | None = None, initialize=True, standalone=True)[source]

A theory class that can calculate derived parameters from CosmoPower networks.

calculate(state: dict, want_derived: bool = True, **params) bool[source]

Do the actual calculation and store results in state dict

Parameters:
  • state – dictionary to store results

  • want_derived – whether to set state[‘derived’] derived parameters

  • params_values_dict – parameter values

Returns:

None or True if success, False for fail

get_can_provide() Iterable[str][source]

Get a list of names of quantities that can be retrieved using the general get_result(X) method.

Returns:

iterable of quantity names

get_param(p) float[source]

Interface function for likelihoods and other theory components to get derived parameters.

get_requirements() Iterable[tuple[str, str]][source]

Get a dictionary of requirements (or a list of requirement name, option tuples) that are always needed (e.g. must be calculated by another component or provided as input parameters).

Returns:

dictionary or list of tuples of requirement names and options (or iterable of requirement names if no optional parameters are needed)