Skip to content

Commit

Permalink
Adding test of Hubble parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
EiffL committed Jan 20, 2022
1 parent 5e0e437 commit d465d6c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@
import jax_cosmo.background as bkgrd
from jax_cosmo import Cosmology

def test_H():
# We first define equivalent CCL and jax_cosmo cosmologies
cosmo_ccl = ccl.Cosmology(
Omega_c=0.3,
Omega_b=0.05,
h=0.7,
sigma8=0.8,
n_s=0.96,
Neff=0,
transfer_function="eisenstein_hu",
matter_power_spectrum="linear",
wa=2. # non-zero wa
)

cosmo_jax = Cosmology(
Omega_c=0.3,
Omega_b=0.05,
h=0.7,
sigma8=0.8,
n_s=0.96,
Omega_k=0.0,
w0=-1.0,
wa=2.0, # non-zero wa
)

# Test array of scale factors
a = np.linspace(0.01, 1.0)

H_ccl = ccl.h_over_h0(cosmo_ccl, a)
H_jax = bkgrd.H(cosmo_jax, a) / 100.
assert_allclose(H_ccl, H_jax, rtol=1.e-3)

def test_distances_flat():
# We first define equivalent CCL and jax_cosmo cosmologies
Expand Down

0 comments on commit d465d6c

Please sign in to comment.