Open MickaelRigault opened 6 days ago
See also:
import jax.numpy as jnp
import numpy as np
import jax_cosmo as jcosmo
import matplotlib.pyplot as plt
from astropy.cosmology import Planck15 as astropy_planck15
jc_planck15 = jcosmo.Planck15()
z = jnp.linspace(0.001, 1.5, 100).astype("float32")
fig, ax = plt.subplots()
dist_mpch = jcosmo.background.radial_comoving_distance(jc_planck15, a=jcosmo.utils.z2a(z)) # in Mpc/h (??) or Mpc*h (!!)
ax.plot(z, dist_mpch / jc_planck15.h, label="dist_mpch / jref_cosmo.h", ls=":", lw=5)
ax.plot(z, dist_mpch * jc_planck15.h, label="dist_mpch * jref_cosmo.h", ls="--", )
ax.plot(z, astropy_planck15.comoving_distance(np.asarray(z)).value, label="astropy comoving_distance", ls="-")
ax.legend()
ax.set_ylabel("dist [Mpc]")
ax.set_xlabel("redshift")
Hello guys,
I'm sorry but I have a stupid question. I have the feeling that there is an issue of
h
in the functionbackground.radial_comoving_distance
: The doc says it is returning distances inMpc/h
while I think it returns it inMpc * h
.Here is an example comparing to
astropy.cosmology