In [33]:
import numpy as np
import scipy as sp
from scipy import integrate
from math import *
import matplotlib.pyplot as plt
from astropy.io import ascii
import healpix_util as hu

Define angular diameter distances for Flat LambdaCDM cosmology with $\Omega_M=0.3$ and $\Omega_{\Lambda}=0.7$ starting with definition of $E(z)=\sqrt{0.3(1+z)^3+0.7}$. As we know Angular diameter distance ($D_A$) is comoving distance ($D_C$) divided by $1+z$. We write $D_A=\frac{D_C}{1+z}=\frac{1}{1+z}\int_0^z\frac{dz}{E(z)}$


In [52]:
Ez = lambda x: 1/sqrt(0.3*(1+x)**3+0.7)

np.vectorize(Ez)
#Calculate comoving distance of a data point using the Redshift - This definition is based on the cosmology model we take. Here the distance for E-dS universe is considered. Also note that c/H0 ratio is cancelled in the equations and hence not taken.

def DC_LCDM(z):
  return integrate.quad(Ez, 0, z)

In [53]:
Ezo = lambda x: 1/sqrt(0.2*(1+x)**3+0.8*(1+x)**2)

np.vectorize(Ezo)
#Calculate comoving distance of a data point using the Redshift - This definition is based on the cosmology model we take. Here the distance for E-dS universe is considered. Also note that c/H0 ratio is cancelled in the equations and hence not taken.

def DC_OU(z):
  return np.sinh(integrate.quad(Ezo, 0, z))

In [54]:
z=2.34
DMLCDM=DC_LCDM(z)
DMLC=DC_OU(z)
print DMLCDM[0]
print DMLC[0]


1.31579183875
1.06081745967

In [55]:
print DMLCDM[0]*4285.714/(1+z)
print DMLC[0]*4285.714/(1+z)


1688.35554025
1361.18570011