pyccl.background module

Smooth background quantities

CCL defines seven species types:

  • ‘matter’: cold dark matter and baryons

  • ‘dark_energy’: cosmological constant or otherwise

  • ‘radiation’: relativistic species besides massless neutrinos (i.e., only photons)

  • ‘curvature’: curvature density

  • ‘neutrinos_rel’: relativistic neutrinos

  • ‘neutrinos_massive’: massive neutrinos

These strings define the species inputs to the functions below.

class pyccl.background.Species(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

CRITICAL = 'critical'
MATTER = 'matter'
DARK_ENERGY = 'dark_energy'
RADIATION = 'radiation'
CURVATURE = 'curvature'
NEUTRINOS_REL = 'neutrinos_rel'
NEUTRINOS_MASSIVE = 'neutrinos_massive'
pyccl.background.compute_distances(cosmo)[source]

Compute the distance splines.

pyccl.background.h_over_h0(cosmo, a)[source]

Ratio of Hubble constant at a over Hubble constant today.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

H(a)/H0.

Return type:

(float or array)

pyccl.background.comoving_radial_distance(cosmo, a)[source]

Comoving radial distance.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

Comoving radial distance; Mpc.

Return type:

(float or array)

pyccl.background.scale_factor_of_chi(cosmo, chi)[source]

Scale factor, a, at a comoving radial distance chi.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • chi (float or array) – Comoving radial distance(s); Mpc.

Returns:

Scale factor(s), normalized to 1 today.

Return type:

(float or array)

pyccl.background.comoving_angular_distance(cosmo, a)[source]

Comoving angular distance.

Note

This quantity is otherwise known as the transverse comoving distance, and is NOT angular diameter distance or angular separation. The comoving angular distance is defined such that the comoving distance between two objects at a fixed scale factor separated by an angle \(\theta\) is \(\theta r_{A}(a)\) where \(r_{A}(a)\) is the comoving angular distance.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

Comoving angular distance; Mpc.

Return type:

(float or array)

pyccl.background.angular_diameter_distance(cosmo, a1, a2=None)[source]

Angular diameter distance.

The angular diameter distance in Mpc from scale factor a1 to scale factor a2. If a2 is not provided, it is assumed that the distance will be calculated between 1 and a1.

Note

a2 has to be smaller than a1 (i.e. a source at a2 is behind one at a1). You can compute the distance between a single lens at a1 and multiple sources at a2 by passing a scalar a1.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a1 (float or array) – Scale factor(s), normalized to 1 today.

  • a2 (float or array) – Scale factor(s), normalized to 1 today, optional.

Returns:

angular diameter distance; Mpc.

Return type:

(float or array)

pyccl.background.luminosity_distance(cosmo, a)[source]

Luminosity distance.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

Luminosity distance; Mpc.

Return type:

(float or array)

pyccl.background.distance_modulus(cosmo, a)[source]

Distance Modulus, defined as

\[\mu = 5\,\log_{10}(d_L/10\,{\rm pc})\]

where \(d_L\) is the luminosity distance.

Note

The distance modulus can be used to convert between apparent and absolute magnitudes via \(m = M + \mu\), where \(m\) is the apparent magnitude and \(M\) is the absolute magnitude.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

Distance modulus at a.

Return type:

(float or array)

pyccl.background.hubble_distance(cosmo, a)[source]

Hubble distance in \(\rm Mpc\).

\[D_{\rm H} = \frac{cz}{H_0}\]
Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or (na,) array_like) – Scale factor(s) normalized to 1 today.

Returns:

D_H – Hubble distance.

Return type:

float or (na,) numpy.ndarray

pyccl.background.comoving_volume_element(cosmo, a)[source]

Comoving volume element in \(\rm Mpc^3 \, sr^{-1}\).

\[\frac{\mathrm{d}V}{\mathrm{d}a \, \mathrm{d} \Omega}\]
Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or (na,) array_like) – Scale factor(s) normalized to 1 today.

Returns:

dV – Comoving volume per unit scale factor per unit solid angle.

Return type:

float or (na,) numpy.ndarray

See also

comoving_volume

integral of the comoving volume element

pyccl.background.comoving_volume(cosmo, a, *, solid_angle=12.566370614359172)[source]

Comoving volume, in \(\rm Mpc^3\).

\[V_{\rm C} = \int_{\Omega} \mathrm{{d}}\Omega \int_z \mathrm{d}z D_{\rm H} \frac{(1+z)^2 D_{\mathrm{A}}^2}{E(z)}\]

See Eq. 29 in Hogg 2000.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or (na,) array_like) – Scale factor(s) normalized to 1 today.

  • solid_angle (float) – Solid angle subtended in the sky for which the comoving volume is calculated.

Returns:

V_C – Comoving volume at a.

Return type:

float or (na,) ndarray

See also

comoving_volume_element

comoving volume element

pyccl.background.lookback_time(cosmo, a)[source]

Difference of the age of the Universe between some scale factor and today, in \(\rm Gyr\).

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or (na,) array_like) – Scale factor(s) normalized to 1 today.

Returns:

t_L – Lookback time at a. nan if a is out of bounds of the spline parametets stored in cosmo.

Return type:

float or (na,) ndarray

pyccl.background.age_of_universe(cosmo, a)[source]

Age of the Universe at some scale factor, in \(\rm Gyr\).

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or (na,) array_like) – Scale factor(s) normalized to 1 today.

Returns:

t_age – Age of the Universe at a. nan if a is out of bounds of the spline parametets stored in cosmo.

Return type:

float or (na,) ndarray

pyccl.background.sigma_critical(cosmo, *, a_lens, a_source)[source]

Returns the critical surface mass density.

\[\Sigma_{\mathrm{crit}} = \frac{c^2}{4\pi G} \frac{D_{\rm{s}}}{D_{\rm{l}}D_{\rm{ls}}},\]

where \(c\) is the speed of light, \(G\) is the gravitational constant, and \(D_i\) is the angular diameter distance. The labels \(i = \{s,\,l,\,ls\}\) denote the distances to the source, lens, and between source and lens, respectively.

Parameters:
  • cosmo (Cosmology) – A Cosmology object.

  • a_lens (float) – lens’ scale factor.

  • a_source (float or array) – source’s scale factor.

Returns:

\(\Sigma_{\mathrm{crit}}\) in units of \(M_{\odot}/{\rm Mpc}^2\)

Return type:

(float or array)

pyccl.background.omega_x(cosmo, a, species)[source]

Density fraction of a given species at a redshift different than z=0.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

  • species (str) –

    species type. Should be one of

    • ’matter’: cold dark matter, massive neutrinos, and baryons

    • ’dark_energy’: cosmological constant or otherwise

    • ’radiation’: relativistic species besides massless neutrinos

    • ’curvature’: curvature density

    • ’neutrinos_rel’: relativistic neutrinos

    • ’neutrinos_massive’: massive neutrinos

    • ’critical’

Returns:

Density fraction of a given species at a scale factor.

Return type:

(float or array)

pyccl.background.rho_x(cosmo, a, species, *, is_comoving=False)[source]

Physical or comoving density as a function of scale factor.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

  • species (str) –

    species type. Should be one of

    • ’matter’: cold dark matter, massive neutrinos, and baryons

    • ’dark_energy’: cosmological constant or otherwise

    • ’radiation’: relativistic species besides massless neutrinos

    • ’curvature’: curvature density

    • ’neutrinos_rel’: relativistic neutrinos

    • ’neutrinos_massive’: massive neutrinos

    • ’critical’

  • is_comoving (bool) – either physical (False, default) or comoving (True)

Returns:

Physical density of a given species at a scale factor, in units of \(M_\odot / {\rm Mpc}^3\).

Return type:

(float or array)

pyccl.background.growth_factor(cosmo, a)[source]

Growth factor.

Warning

CCL is not able to compute the scale-dependent growth factor for cosmologies with massive neutrinos.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

Growth factor, normalized to unity today.

Return type:

(float or array)

pyccl.background.growth_factor_unnorm(cosmo, a)[source]

Unnormalized growth factor.

Warning

CCL is not able to compute the scale-dependent growth factor for cosmologies with massive neutrinos.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

Unnormalized growth factor, normalized to the scale factor at early times.

Return type:

(float or array)

pyccl.background.growth_rate(cosmo, a)[source]

Growth rate defined as the logarithmic derivative of the growth factor, \(f\equiv d\log D/d\log a\).

Warning

CCL is not able to compute the scale-dependent growth rate for cosmologies with massive neutrinos.

Parameters:
  • cosmo (Cosmology) – Cosmological parameters.

  • a (float or array) – Scale factor(s), normalized to 1 today.

Returns:

Growth rate.

Return type:

(float or array)