First import all the modules such as healpy and astropy needed for analyzing the structure
In [80]:
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
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 pymangle
import cython_metric
import lcdmmetric
import pyfits
#from astroML.datasets import fetch_sdss_specgals
#from astroML.correlation import bootstrap_two_point_angular
%matplotlib inline
In [81]:
fdat=ascii.read("./output/DR12Qbin1.dat")
In [82]:
fdat
Out[82]:
In [83]:
z=fdat['z']
ra=fdat['rar']
dec=fdat['decr']
In [84]:
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 [85]:
dr12qbin1 = open("./output/dr12qbin1srarf.dat",'w')
dr12qbin1.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin1.write("%f\t " %z[i])
dr12qbin1.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin1.write("%f\n " %DC_LCDM(z[i]))
dr12qbin1.close()
In [86]:
dr12qbin1dat=ascii.read("./output/dr12qbin1srarf.dat")
In [87]:
NSIDE=512
dr12qbin1pix=hu.HealPix("ring",NSIDE)
In [88]:
pixdata = open("./output/pixdatadr12qbin1.dat",'w')
pixdata.write("z\t pix \n")
for i in range(0,len(dr12qbin1dat)):
pixdata.write("%f\t" %dr12qbin1dat['z'][i])
pixdata.write("%d\n" %dr12qbin1pix.eq2pix(dr12qbin1dat['rar'][i]*180.0/pi,dr12qbin1dat['decr'][i]*180.0/pi))
pixdata.close()
In [89]:
pixdata = ascii.read("./output/pixdatadr12qbin1.dat")
hpixdata=np.array(np.zeros(hu.nside2npix(NSIDE)))
for j in range(len(pixdata)):
hpixdata[pixdata[j]['pix']]+=1
In [90]:
hpixdata
Out[90]:
In [91]:
hu.mollview(hpixdata,rot=180)
plt.savefig("./plots/dr12qbin1moll.pdf")
In [92]:
hu.orthview(hpixdata)
plt.savefig("./plots/dr12qbin1orth.pdf")
In [93]:
fdat=ascii.read("./output/DR12Qbin2.dat")
In [94]:
fdat
Out[94]:
In [95]:
z=fdat['z']
ra=fdat['rar']
dec=fdat['decr']
In [96]:
dr12qbin2 = open("./output/dr12qbin2srarf.dat",'w')
dr12qbin2.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin2.write("%f\t " %z[i])
dr12qbin2.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin2.write("%f\n " %DC_LCDM(z[i]))
dr12qbin2.close()
In [97]:
dr12qbin2dat=ascii.read("./output/dr12qbin2srarf.dat")
In [98]:
NSIDE=512
dr12qbin2pix=hu.HealPix("ring",NSIDE)
In [99]:
pixdata = open("./output/pixdatadr12qbin2.dat",'w')
pixdata.write("z\t pix \n")
for i in range(0,len(dr12qbin2dat)):
pixdata.write("%f\t" %dr12qbin2dat['z'][i])
pixdata.write("%d\n" %dr12qbin2pix.eq2pix(dr12qbin2dat['rar'][i]*180.0/pi,dr12qbin2dat['decr'][i]*180.0/pi))
pixdata.close()
In [100]:
pixdata = ascii.read("./output/pixdatadr12qbin2.dat")
hpixdata=np.array(np.zeros(hu.nside2npix(NSIDE)))
for j in range(len(pixdata)):
hpixdata[pixdata[j]['pix']]+=1
In [101]:
hpixdata
Out[101]:
In [102]:
hu.mollview(hpixdata,rot=180)
plt.savefig("./plots/dr12qbin2moll.pdf")
In [103]:
hu.orthview(hpixdata)
plt.savefig("./plots/dr12qbin2orth.pdf")
In [ ]:
In [104]:
fdat=ascii.read("./output/DR12Qbin3.dat")
In [105]:
fdat
Out[105]:
In [106]:
z=fdat['z']
ra=fdat['rar']
dec=fdat['decr']
In [107]:
dr12qbin3 = open("./output/dr12qbin3srarf.dat",'w')
dr12qbin3.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin3.write("%f\t " %z[i])
dr12qbin3.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin3.write("%f\n " %DC_LCDM(z[i]))
dr12qbin3.close()
In [108]:
dr12qbin3dat=ascii.read("./output/dr12qbin3srarf.dat")
In [109]:
NSIDE=512
dr12qbin3pix=hu.HealPix("ring",NSIDE)
In [110]:
pixdata = open("./output/pixdatadr12qbin3.dat",'w')
pixdata.write("z\t pix \n")
for i in range(0,len(dr12qbin3dat)):
pixdata.write("%f\t" %dr12qbin3dat['z'][i])
pixdata.write("%d\n" %dr12qbin3pix.eq2pix(dr12qbin3dat['rar'][i]*180.0/pi,dr12qbin3dat['decr'][i]*180.0/pi))
pixdata.close()
In [111]:
pixdata = ascii.read("./output/pixdatadr12qbin3.dat")
hpixdata=np.array(np.zeros(hu.nside2npix(NSIDE)))
for j in range(len(pixdata)):
hpixdata[pixdata[j]['pix']]+=1
In [112]:
hpixdata
Out[112]:
In [113]:
hu.mollview(hpixdata,rot=180)
plt.savefig("./plots/dr12qbin3moll.pdf")
In [114]:
hu.orthview(hpixdata)
plt.savefig("./plots/dr12qbin3orth.pdf")
In [115]:
fdat=ascii.read("./output/DR12Qbin4.dat")
In [116]:
fdat
Out[116]:
In [117]:
z=fdat['z']
ra=fdat['rar']
dec=fdat['decr']
In [118]:
dr12qbin4 = open("./output/dr12qbin4srarf.dat",'w')
dr12qbin4.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin4.write("%f\t " %z[i])
dr12qbin4.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin4.write("%f\n " %DC_LCDM(z[i]))
dr12qbin4.close()
In [119]:
dr12qbin4dat=ascii.read("./output/dr12qbin4srarf.dat")
In [120]:
NSIDE=512
dr12qbin4pix=hu.HealPix("ring",NSIDE)
In [121]:
pixdata = open("./output/pixdatadr12qbin4.dat",'w')
pixdata.write("z\t pix \n")
for i in range(0,len(dr12qbin4dat)):
pixdata.write("%f\t" %dr12qbin4dat['z'][i])
pixdata.write("%d\n" %dr12qbin4pix.eq2pix(dr12qbin4dat['rar'][i]*180.0/pi,dr12qbin4dat['decr'][i]*180.0/pi))
pixdata.close()
In [122]:
pixdata = ascii.read("./output/pixdatadr12qbin4.dat")
hpixdata=np.array(np.zeros(hu.nside2npix(NSIDE)))
for j in range(len(pixdata)):
hpixdata[pixdata[j]['pix']]+=1
In [123]:
hpixdata
Out[123]:
In [124]:
hu.mollview(hpixdata,rot=180)
plt.savefig("./plots/dr12qbin4moll.pdf")
In [125]:
hu.orthview(hpixdata)
plt.savefig("./plots/dr12qbin4orth.pdf")
In [126]:
def DC_LC(z):
return np.log(1+z)
In [127]:
dr12qbin1=ascii.read("./output/dr12qbin1srarf.dat")
In [128]:
z=dr12qbin1['z']
ra=dr12qbin1['rar']
dec=dr12qbin1['decr']
In [129]:
dr12qbin1 = open("./output/dr12qbin1srarfLC.dat",'w')
dr12qbin1.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin1.write("%f\t " %z[i])
dr12qbin1.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin1.write("%f\n " %DC_LC(z[i]))
dr12qbin1.close()
In [130]:
dr12qbin2=ascii.read("./output/dr12qbin2srarf.dat")
In [131]:
z=dr12qbin2['z']
ra=dr12qbin2['rar']
dec=dr12qbin2['decr']
In [132]:
dr12qbin2 = open("./output/dr12qbin2srarfLC.dat",'w')
dr12qbin2.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin2.write("%f\t " %z[i])
dr12qbin2.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin2.write("%f\n " %DC_LC(z[i]))
dr12qbin2.close()
In [133]:
dr12qbin3=ascii.read("./output/dr12qbin3srarf.dat")
In [134]:
z=dr12qbin3['z']
ra=dr12qbin3['rar']
dec=dr12qbin3['decr']
In [135]:
dr12qbin3 = open("./output/dr12qbin3srarfLC.dat",'w')
dr12qbin3.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin3.write("%f\t " %z[i])
dr12qbin3.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin3.write("%f\n " %DC_LC(z[i]))
dr12qbin3.close()
In [136]:
dr12qbin4=ascii.read("./output/dr12qbin4srarf.dat")
In [137]:
z=dr12qbin4['z']
ra=dr12qbin4['rar']
dec=dr12qbin4['decr']
In [138]:
dr12qbin4 = open("./output/dr12qbin4srarfLC.dat",'w')
dr12qbin4.write("z\t rar\t decr\t s\n")
for i in range(0,len(z)):
dr12qbin4.write("%f\t " %z[i])
dr12qbin4.write("%f\t %f\t " %(ra[i],dec[i]))
dr12qbin4.write("%f\n " %DC_LC(z[i]))
dr12qbin4.close()
In [ ]: