Distance module

Looks up redshift corresponds to comoving distance d. A spline interpolation is setup up to redshift $z_\mathrm{max}$.

distance = Distance(z_max)

Operation Result
distance.z_max z_max given in the initialisation
distance.d_max maximum d usable for distance.redshift(d)
distance.redshift(d) redshift coresponds to comoving distance $d$

In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import mockgallib as mock

mock.cosmology.set(0.31) # set omega_m

z_max = 1.5
mock.distance.init(z_max)

In [3]:
d_max = mock.cosmology.compute_comoving_distance(1/(1 + z_max))
d = np.arange(0, d_max, 10)
z = [mock.distance.redshift(dd) for dd in d]

plt.xlabel('$d$')
plt.ylabel('$z$')

plt.plot(d, z, 'r-')

z = np.arange(0, z_max, 0.1)
a = 1/(1 + z)

d = [ mock.cosmology.compute_comoving_distance(aa) for aa in a ]

plt.plot(d, z, 'x')

plt.show();



In [ ]:


In [1]:
%%html
<style>table {float:left}</style>