firecrown.connector.numcosmo.helpers

Helper functions and classes for the NumCosmo connector.

Classes

PowerSpec

Represents a power spectrum with linear and optional nonlinear components.

Functions

get_hiprim(hi_cosmo)

Return the HIPrim object from a NumCosmo HICosmo object.

get_amplitude_parameters(amplitude_parameter, p_ml, ...)

Calculate the amplitude parameters for CCL.

Module Contents

firecrown.connector.numcosmo.helpers.get_hiprim(hi_cosmo)[source]

Return the HIPrim object from a NumCosmo HICosmo object.

If hi_cosmo does not have a HIPrim object, a ValueError is raised. If the HIPrim object is not of type HIPrimPowerLaw, a ValueError is raised.

Parameters:

hi_cosmo (numcosmo_py.Nc.HICosmo) – NumCosmo HICosmo object

Returns:

the HIPrim object contained in hi_cosmo

Return type:

numcosmo_py.Nc.HIPrimPowerLaw

firecrown.connector.numcosmo.helpers.get_amplitude_parameters(amplitude_parameter, p_ml, hi_cosmo)[source]

Calculate the amplitude parameters for CCL.

Parameters:
  • ccl_factory – the CCL factory object

  • p_ml (None | numcosmo_py.Nc.PowspecML) – the NumCosmo PowspecML object, or None

  • hi_cosmo (numcosmo_py.Nc.HICosmo) – the NumCosmo cosmology object

  • amplitude_parameter (firecrown.ccl_factory.PoweSpecAmplitudeParameter)

Returns:

a tuple of the amplitude parameters, (A_s, sigma8), with only one set.

Return type:

tuple[float | None, float | None]

class firecrown.connector.numcosmo.helpers.PowerSpec(linear=Nc.PowspecML, nonlinear=None | Nc.PowspecMNL)[source]

Represents a power spectrum with linear and optional nonlinear components.

linear
nonlinear
prepare_if_needed(hi_cosmo)[source]

Prepare the power spectrum objects if needed.

Parameters:

hi_cosmo (numcosmo_py.Nc.HICosmo) – the NumCosmo HICosmo object