First import all the modules such as healpy and astropy needed for analyzing the structure
In [1]:
import healpix_util as hu
import astropy as ap
import numpy as np
from astropy.io import fits
from astropy.table import Table
import astropy.io.ascii as ascii
from astropy.io import fits
from astropy.constants import c
import matplotlib.pyplot as plt
import math as m
from math import pi
#from scipy.constants import c
import scipy.special as sp
from astroML.decorators import pickle_results
from scipy import integrate
import warnings
from sklearn.neighbors import BallTree
import pickle
import multiprocessing as mp
import time
#from lccmetric import *
from progressbar import *
from tqdm import *
from functools import partial
import pymangle
from scipy.optimize import curve_fit
#from astroML.datasets import fetch_sdss_specgals
#from astroML.correlation import bootstrap_two_point_angular
%matplotlib inline
In [2]:
Ez = lambda x: 1/m.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)[0]
DC_LCDM=np.vectorize(DC_LCDM)
In [3]:
def DC_LC(z):
return np.log(1.0+z)
In [4]:
DC_LCDM(np.arange(0,1.0,0.1))
Out[4]:
In [5]:
DC_LC(np.arange(0,1.0,0.1))
Out[5]:
In [ ]:
def flatdistLCDM (z1, z2, theta):
s1=DC_LCDM(z1)
s2=DC_LCDM(z2)
return np.sqrt(s1**2+s2**2-2.0*s1*s2*np.cos(theta/180.0*pi))
In [ ]:
flatdistLCDM(0,np.arange(0,1.0,0.1),0)
In [ ]:
def flatdistLC (z1, z2, theta):
s1=DC_LC(z1)
s2=DC_LC(z2)
return np.sqrt(s1**2+s2**2-2.0*s1*s2*np.cos(theta*pi/180.0))
In [ ]:
flatdistLC(0,np.arange(0,1.0,0.1),0)
In [6]:
def flatdist(z1,z2,theta,func):
s1=func(z1)
s2=func(z2)
return np.sqrt(s1**2+s2**2-2.0*s1*s2*np.cos(theta*pi/180.0))
In [10]:
def flatdist1(z1,z2,func):
s1=func(z1)
s2=func(z2)
return np.sqrt(s1**2+s2**2-2.0*s1*s2*0.0)
In [7]:
def flatdist2(z1,z2,func):
s1=func(z1)
s2=func(z2)
return np.sqrt(s1**2+s2**2-2.0*s1*s2*0.5)
In [8]:
zt=np.arange(0,1.0,0.1)
In [12]:
flatdist1(0,zt,DC_LCDM)
Out[12]:
In [13]:
flatdist2(0,zt,DC_LCDM)
Out[13]:
In [14]:
flatdist1(0.5,zt,DC_LCDM)
Out[14]:
In [15]:
flatdist2(0.5,zt,DC_LCDM)
Out[15]:
In [ ]:
In [27]:
def closeddist(z1,z2,theta,func):
s1=np.sin(func(z1)*0.007)
s2=np.sin(func(z2)*0.007)
c1=np.cos(func(z1)*0.007)
c2=np.cos(func(z2)*0.007)
res= np.sqrt(s1*s1+s2*s2-2.0*s1*s2*c1*c2*np.cos(theta*pi/180.0)-s1*s1*s2*s2*np.sqrt(1.0+(np.cos(theta*pi/180.0))**2))
return res/0.007
In [28]:
closeddist(0,zt,0,DC_LC)
Out[28]:
In [29]:
def opendist(z1,z2,theta,func):
s1=np.sinh(func(z1)*0.007)
s2=np.sinh(func(z2)*0.007)
c1=np.cosh(func(z1)*0.007)
c2=np.cosh(func(z2)*0.007)
res= np.sqrt(s1*s1+s2*s2-2.0*s1*s2*c1*c2*np.cos(theta*pi/180.0)-s1*s1*s2*s2*np.sqrt(1.0+(np.cos(theta*pi/180.0))**2))
return res/0.007
In [ ]:
flatdist(z1,zt,theta[0],DC_LCDM)
In [ ]:
np.cos
In [ ]:
flatdist(z1,zt,theta[6],DC_LCDM)
In [ ]:
flatdist(z1,zt,theta[6],DC_LC)
In [ ]:
In [ ]:
In [ ]:
In [16]:
z1=0.0
zt=np.arange(0,1.0,0.01)
theta=np.arange(0,190.0,10.0)
In [17]:
plt.plot(zt,flatdist(z1,zt,theta[0],DC_LCDM))
plt.plot(zt,flatdist(z1,zt,theta[6],DC_LCDM))
plt.plot(zt,flatdist(z1,zt,theta[12],DC_LCDM))
plt.plot(zt,flatdist(z1,zt,theta[18],DC_LCDM))
plt.show()
In [18]:
plt.plot(zt,flatdist(z1,zt,theta[0],DC_LC))
plt.plot(zt,flatdist(z1,zt,theta[6],DC_LC))
plt.plot(zt,flatdist(z1,zt,theta[12],DC_LC))
plt.plot(zt,flatdist(z1,zt,theta[18],DC_LC))
plt.show()
In [31]:
plt.plot(zt,flatdist(z1,zt,theta[0],DC_LCDM),'r')
plt.plot(zt,flatdist(z1,zt,theta[0],DC_LC),'g')
plt.plot(zt,closeddist(z1,zt,theta[0],DC_LC),'b')
plt.plot(zt,opendist(z1,zt,theta[0],DC_LC),'y')
plt.show()
In [20]:
plt.plot(zt,flatdist(0.5,zt,theta[0],DC_LCDM))
plt.plot(zt,flatdist(0.5,zt,theta[6],DC_LCDM))
plt.plot(zt,flatdist(0.5,zt,theta[12],DC_LCDM))
plt.plot(zt,flatdist(0.5,zt,theta[18],DC_LCDM))
plt.show()
In [21]:
plt.plot(zt,flatdist(0.5,zt,theta[0],DC_LC))
plt.plot(zt,flatdist(0.5,zt,theta[6],DC_LC))
plt.plot(zt,flatdist(0.5,zt,theta[12],DC_LC))
plt.plot(zt,flatdist(0.5,zt,theta[18],DC_LC))
plt.show()
In [36]:
plt.plot(zt,flatdist(0.5,zt,theta[6],DC_LCDM),'r')
plt.plot(zt,flatdist(0.5,zt,theta[6],DC_LC),'g')
plt.plot(zt,closeddist(0.5,zt,theta[6],DC_LC),'b')
plt.plot(zt,opendist(0.5,zt,theta[6],DC_LC),'y')
plt.show()
In [24]:
plt.plot(zt,flatdist(1.0,zt,theta[0],DC_LC))
plt.plot(zt,flatdist(1.0,zt,theta[6],DC_LC))
plt.plot(zt,flatdist(1.0,zt,theta[12],DC_LC))
plt.plot(zt,flatdist(1.0,zt,theta[18],DC_LC))
plt.show()
In [25]:
plt.plot(zt,flatdist(1.0,zt,theta[0],DC_LCDM))
plt.plot(zt,flatdist(1.0,zt,theta[6],DC_LCDM))
plt.plot(zt,flatdist(1.0,zt,theta[12],DC_LCDM))
plt.plot(zt,flatdist(1.0,zt,theta[18],DC_LCDM))
plt.show()
In [39]:
plt.plot(zt,flatdist(1.0,zt,theta[6],DC_LCDM),'r')
plt.plot(zt,flatdist(1.0,zt,theta[6],DC_LC),'g')
plt.plot(zt,closeddist(1.0,zt,theta[6],DC_LC),'b')
plt.plot(zt,opendist(1.0,zt,theta[6],DC_LC),'y')
plt.show()
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
flatdist(z1,zt,30.0,DC_LC)
In [ ]:
flatdist(z1,zt,0.0,DC_LC)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
bins=np.arange(0.,0.08,0.005)
In [ ]:
print bins
In [ ]:
binMpc=c*1e-5*bins[1:len(bins)]
In [ ]:
print binMpc
In [ ]:
DDf=np.array([ 376599, 1245978, 2826185, 5151737, 8156128, 11846922,
16171658, 20996832, 26338279, 32090647, 38244493, 44703147,
51450171, 58468581, 65667922])
In [ ]:
RRf=np.array([ 643435, 4041756, 10512085, 19769200, 31628364, 45946557,
62534839, 81156182, 101645162, 123804352, 147416610, 172291247,
198247385, 225034691, 252578087])
In [ ]:
DRf=np.array([ 295060, 1994482, 5218449, 9842717, 15798756, 23014872,
31354659, 40802390, 51199047, 62501581, 74502664, 87208020,
100471995, 114144670, 128180280])
In [ ]:
correlf=(4.0 * DDf - 4.0 * DRf + RRf) / RRf
In [ ]:
correlf
In [ ]:
DDc=np.array([ 430556, 1114599, 2525859, 4682258, 7580242, 11210594,
15494184, 20333206, 25595524, 31256250, 37268677, 43632001,
50352286, 57359810, 64622022])
In [ ]:
RRc=np.array([ 740302, 3503169, 9364047, 18228452, 29683412, 43369250,
59250681, 77493322, 98000981, 120263531, 143859910, 167930727,
192506956, 218264153, 245484297])
In [ ]:
DRc=np.array([ 254634, 1719873, 4644253, 9066109, 14768425, 21645680,
29640929, 38908451, 49347999, 60683031, 72811227, 85150370,
97809112, 111106279, 125306147])
In [ ]:
correlc=(4.0 * DDc - 4.0 * DRc + RRc) / RRc
In [ ]:
correlc
In [ ]:
DDo=np.array([ 331281, 1116305, 2527931, 4684655, 7583290, 11213608,
15496093, 20336243, 25596801, 31258220, 37270412, 43632843,
50353792, 57360863, 64623361])
In [ ]:
RRo=np.array([ 547656, 3511813, 9374865, 18238861, 29691691, 43377917,
59259542, 77500037, 98013097, 120268860, 143866480, 167933473,
192509954, 218269183, 245488607])
In [ ]:
DRo=np.array([ 259445, 1724093, 4650120, 9071135, 14773645, 21649996,
29645220, 38913722, 49352896, 60686351, 72814042, 85152932,
97810839, 111107554, 125309680])
In [ ]:
correlo=(4.0 * DDo - 4.0 * DRo + RRo) / RRo
In [ ]:
correlo
In [ ]:
DDs=np.array([ 328694, 1029545, 2291282, 4147862, 6554042, 9497129,
12989300, 16908377, 21224962, 25940421, 30956138, 36318577,
41861964, 47699516, 53698417])
In [ ]:
RRs=np.array([ 524864, 3256023, 8479597, 15957280, 25557294, 37154783,
50626355, 65797017, 82516733, 100664495, 120087370, 140636145,
162143809, 184495136, 207523156])
In [ ]:
DRs=np.array([ 236152, 1599524, 4188580, 7905907, 12705700, 18520232,
25272714, 32915799, 41374438, 50587003, 60461246, 70878589,
81876261, 93286095, 105014199])
In [ ]:
correls=(4.0 * DDs - 4.0 * DRs + RRs) / RRs
In [ ]:
correls
In [ ]:
corthl=(binMpc/10.0)**(-1.8)
print corthl
In [ ]:
def powlaw(x, a, b):
return (x/a)**b
In [ ]:
popt, pcov = curve_fit(powlaw, binMpc[0:5], correls[0:5])
In [ ]:
popt
In [ ]:
pcov
In [ ]:
In [ ]:
In [ ]:
plt.figure()
plt.xlabel('Comoving Distance ($s$) in $h^{-1}$ Mpc')
plt.ylabel('$\\xi (s)$')
plt.title('Comparison of Correlation functions ($\\xi (s)$)')
#plt.plot(binMpc,corthl,'m.--',label='Linear')
plt.plot(binMpc, powlaw(binMpc,*popt),'m.--',label='Linear')
plt.plot(binMpc,correls,'ko-',label='$\Lambda$ CDM')
plt.plot(binMpc,correlo,'r^-',label='Milne LC')
plt.plot(binMpc,correlc,'gs-',label='Closed LC')
plt.plot(binMpc,correlf,'bd-',label='Flat LC')
plt.legend()
plt.savefig("correlcomp.pdf")
plt.show()
In [ ]:
plt.figure()
plt.xlabel('Comoving Distance ($s$) in $h^{-1}$ Mpc')
plt.ylabel('$\\xi (s)$')
plt.title('Comparison of Correlation functions ($\\xi (s)$)')
plt.yscale('log')
#plt.plot(binMpc,corthl,'m.--',label='Linear')
#plt.plot(binMpc, powlaw(binMpc,*popt),'m.--',label='Linear')
plt.plot(binMpc,correls,'ko-',label='$\Lambda$ CDM')
#plt.plot(binMpc,correlo,'r^-',label='Milne LC')
plt.plot(binMpc,correlc,'gs-',label='Closed LC')
plt.plot(binMpc,correlf,'bd-',label='Flat LC')
plt.legend()
#plt.savefig("correlcompylog.pdf")
plt.show()
In [ ]:
plt.figure()
plt.xlabel('Comoving Distance ($s$) in $h^{-1}$ Mpc')
plt.ylabel('$\\xi (s)$')
plt.title('Comparison of Correlation functions ($\\xi (s)$)')
plt.yscale('log')
plt.xscale('log')
#plt.plot(binMpc,corthl,'m.--',label='Linear')
plt.plot(binMpc, powlaw(binMpc,*popt),'m.--',label='Linear')
plt.plot(binMpc,correls,'ko-',label='$\Lambda$ CDM')
plt.plot(binMpc,correlo,'r^-',label='Milne LC')
plt.plot(binMpc,correlc,'gs-',label='Closed LC')
plt.plot(binMpc,correlf,'bd-',label='Flat LC')
plt.legend()
plt.savefig("correlcompxylog.pdf")
plt.show()
In [ ]: