# Setup matplotlib for plotting
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
mpl.rcParams['mathtext.fontset'] = 'stix'
mpl.rcParams['font.family'] = 'STIXGeneral'
mpl.rcParams['axes.unicode_minus'] = False
mpl.rcParams['text.usetex'] = False
from greapy import GREA
# Create an instance of the GREA model
cosmo = GREA()
cosmo
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:37: SyntaxWarning: invalid escape sequence '\,'
h: Dimensionless Hubble parameter $h = H_0 / (100\,\mathrm{km\,s^{-1}\,Mpc^{-1}})$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:76: SyntaxWarning: invalid escape sequence '\e'
Returns the dimensionless combination $D_H(a) = a H(a) \eta(a)$,
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:95: SyntaxWarning: invalid escape sequence '\m'
aeq: Scale factor at matter-radiation equality $a_\mathrm{eq}$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:227: SyntaxWarning: invalid escape sequence '\o'
$R = \omega_b / \omega_g$ and decreases as the universe expands
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:251: SyntaxWarning: invalid escape sequence '\i'
$$r_s(z) = \int_0^{a(z)} \\frac{c_s(a)}{a^2 H(a)} da$$
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:283: SyntaxWarning: invalid escape sequence '\m'
"""Compute the normalized dark energy density evolution $f_\mathrm{de}(a)$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:331: SyntaxWarning: invalid escape sequence '\o'
"""Physical baryon + cold dark matter density $\omega_{bc}$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:340: SyntaxWarning: invalid escape sequence '\O'
"""Fractional baryon + cold dark matter density $\Omega_{bc}$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:360: SyntaxWarning: invalid escape sequence '\O'
"""Fractional photon energy density $\Omega_g = \omega_g / h^2$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:421: SyntaxWarning: invalid escape sequence '\m'
Redshift $z_\mathrm{rec}$ of the last scattering surface, computed
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:431: SyntaxWarning: invalid escape sequence '\m'
Drag redshift $z_\mathrm{drag}$, slightly lower than $z_\mathrm{rec}$,
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:442: SyntaxWarning: invalid escape sequence '\m'
$r_\mathrm{drag} = r_s(z_\mathrm{drag})$ in Mpc — the standard
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:452: SyntaxWarning: invalid escape sequence '\m'
$r_s(z_\mathrm{rec})$ in Mpc, which sets the angular scale of
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/grea.py:462: SyntaxWarning: invalid escape sequence '\m'
$\\theta_* = r_s(z_\mathrm{rec}) / D_C(z_\mathrm{rec})$, a
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/approximations.py:5: SyntaxWarning: invalid escape sequence '\o'
omega_m: Physical matter density parameter $\omega_m = \Omega_m h^2$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/approximations.py:24: SyntaxWarning: invalid escape sequence '\o'
omega_m: Physical matter density parameter $\omega_m = \Omega_m h^2$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/common.py:13: SyntaxWarning: invalid escape sequence '\c'
"""Extract the best-fit $\chi^2$ value from a Cobaya `.minimum.txt` file.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/common.py:103: SyntaxWarning: invalid escape sequence '\l'
"""Extract the log-evidence $\ln Z$ from a PolyChord `.logZ` file.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/common.py:139: SyntaxWarning: invalid escape sequence '\m'
"""Load or compute posterior samples of $w(z)$ and $f_\mathrm{de}(z)$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/common.py:206: SyntaxWarning: invalid escape sequence '\,'
$D_V = (z \, D_H \, D_M^2)^{1/3}$ and $D_H = c/H(z)$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/common.py:222: SyntaxWarning: invalid escape sequence '\m'
"""Compute the Alcock-Paczynski parameter $F_\mathrm{AP}(z)$.
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/common.py:248: SyntaxWarning: invalid escape sequence '\m'
$$M_b = M_b^\mathrm{fid} + 5 \log_{10}(H_0 / H_0^\mathrm{fid})$$
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/stats.py:13: SyntaxWarning: invalid escape sequence '\s'
tension: Tension in units of $\sigma$:
/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/greapy/stats.py:41: SyntaxWarning: invalid escape sequence '\m'
mu1: Mean of the first constraint $\mu_1$.
GREA(h=0.6736, omega_cdm=0.12, omega_b=0.02237, kappa=3.55, omega_g=2.47739e-05, Neff=3.044, a_min=1e-11)
One important thing to note, is that the parameter $H_0\equiv H(z=0)\neq H^{\Lambda\rm CDM}_0=100h$. Indeed, depending on the value of the curvature scale $\sqrt{-k}\eta_0$ (or equivalently, $\alpha$), the predicted $H_0$ can be larger than the $\Lambda\rm CDM$
cosmo.H0, 100*cosmo.h
(np.float64(66.97578547836841), 67.36)
Thus, the (derived) fractional energy densities are defined as $\Omega_{i}(z)\equiv\frac{8\pi G}{3H(z)^2}\rho_i(z)$. In particular, the present day values are given by $\Omega_{i,0}=\frac{8\pi G}{3H(z=0)^2}\rho_{i,0}$
cosmo.Omega_m
np.float64(0.31738241015341295)
from greapy.plots import plot_distances
z=np.logspace(-2, 3, 100)
ax=plot_distances(z, cosmo)
ax.set_xlim(z.min(),z.max())
(np.float64(0.01), np.float64(1000.0))
GREApy can also compute the corresponding values of the sound horizon at recombination $r_s(z_{\rm rec})$ and drag epoch $r_d\equiv r_s(z_{\rm drag})$
cosmo.rs_rec,cosmo.rdrag
(144.5055213020333, 147.07705249598035)
100*cosmo.thetastar
np.float64(1.0279674033800372)
That's it! You've got everything you need to start sampling the posterior distribution of GREA and reproduce the results in our recent analysis!