firecrown.connector.mapping.Mapping#

class firecrown.connector.mapping.Mapping(*, require_nonlinear_pk=False)[source]#

Bases: ABC

Abstract base class defining the interface for each supported code.

The interface describes a mapping of cosmological constants from some concrete Boltzmann calculator to the form those constants take in CCL. Each supported Boltzmann calculator must have its own concrete subclass.

The class attributes are all firecrown.connector.descriptors. This is to control the allowed types for the instance attributes. A descriptor of name ‘x’ will provide an apparent attribue with name x in each object, as well as an entry _x in the object’s __dict__.

Parameters:

require_nonlinear_pk (bool) –

Public Methods:

__init__(*[, require_nonlinear_pk])

param require_nonlinear_pk:

get_params_names()

Return the names of the expected cosmological parameters for this mapping.

transform_k_h_to_k(k_h)

Transform the given k_h (k over h) to k.

transform_p_k_h3_to_p_k(p_k_h3)

Transform the given \(p_k h^3 \to p_k\).

transform_h_to_h_over_h0(h)

Transform distances h to \(h/h_0\).

set_params(*, Omega_c, Omega_b, h[, A_s, sigma8])

Sets the cosmological constants suitable a pyccl.core.CosmologyCalculator.

redshift_to_scale_factor(z)

Converts redshift to scale factor.

redshift_to_scale_factor_p_k(p_k)

Converts power spectrum from redshift to scale factor.

asdict()

Return a dictionary containing the cosmological constants.

get_H0()

Return the value of H0.


asdict()[source]#

Return a dictionary containing the cosmological constants.

Return type:

dict[str, None | float | list[float] | str]

get_H0()[source]#

Return the value of H0.

Return type:

float

get_params_names()[source]#

Return the names of the expected cosmological parameters for this mapping.

Return type:

list[str]

static redshift_to_scale_factor(z)[source]#

Converts redshift to scale factor.

Given arrays of redshift returns an array of scale factor with the inverse order.

static redshift_to_scale_factor_p_k(p_k)[source]#

Converts power spectrum from redshift to scale factor.

Given an 2d arrays power spectrum ordered by (redshift, mode) return a 2d array with the rows flipped to match the reorderning from redshift to scale factor.

final set_params(*, Omega_c, Omega_b, h, A_s=None, sigma8=None, n_s, Omega_k, Neff, m_nu, m_nu_type, w0, wa, T_CMB)[source]#

Sets the cosmological constants suitable a pyccl.core.CosmologyCalculator.

See the documentation of that class for an explanation of the choices and meanings of default values of None.

Parameters:
  • Omega_c (float) –

  • Omega_b (float) –

  • h (float) –

  • A_s (None | float) –

  • sigma8 (None | float) –

  • n_s (float) –

  • Omega_k (float) –

  • Neff (float) –

  • m_nu (float | list[float]) –

  • m_nu_type (str) –

  • w0 (float) –

  • wa (float) –

  • T_CMB (float) –

transform_h_to_h_over_h0(h)[source]#

Transform distances h to \(h/h_0\).

transform_k_h_to_k(k_h)[source]#

Transform the given k_h (k over h) to k.

transform_p_k_h3_to_p_k(p_k_h3)[source]#

Transform the given \(p_k h^3 \to p_k\).