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 aptestmetricdt import *
from aptestmetricdz import *
from scipy.spatial import distance as d
from apcat 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
Co-moving distance between any two sources at redshift $z$ separated by $\Delta z$ and $\Delta\theta$ in the redshift space is
$s(\Delta z, z\Delta\theta)\approxeq \frac{c}{H_0}x(z)\sqrt{(\Delta z)^2+y^2(z)(z\Delta\theta)^2}$
Here $x(z)$ and $y(z)$ are model independent parameters. $y(z)$ characterizes Alcock-Paczynski ratio.
$x(z)$ and $y(z)$ functions for $\Lambda CDM$ and Linear coasting models are
For $\Lambda CDM$
$x(z)=\frac{1}{\sqrt{\Omega_m(1+z)^3+\Omega_m}}$
$y(z)=\frac{1}{z}\int_0^z dx\sqrt{\frac{\Omega_m(1+z)^3+\Omega_\Lambda}{\Omega_m(1+x)^3+\Omega_\Lambda}}$
For Linear coasting in a flat universe
$x(z)=\frac{1}{E(z)}=\frac{1}{1+z}$
$y(z)=\frac{1+z}{z}\ln(1+z)$
For Milne Universe (open empty Universe that is also linearly coasting)
$x(z)=\frac{1}{E(z)}=\frac{1}{1+z}$
$y(z)=1+\frac{z}{2}$
$s_{\perp}=\frac{c}{H_0}x(z)y(z)z\Delta \theta$ $s_{\parallel}=\frac{c}{H_0}x(z)\Delta z$
Read the data file (taken from http://cosmo.nyu.edu/~eak306/SDSS-LRG.html ) converted to ascii with comoving distance etc. in V01 reading from pkl files for faster read
In [2]:
with open('dd2ddr72v06cdist.pkl') as f:
dd2d=pickle.load(f)
In [3]:
with open('rr2ddr72v06cdist.pkl') as f:
rr2d=pickle.load(f)
In [4]:
with open('dr2ddr72v06cdist.pkl') as f:
dr2d=pickle.load(f)
In [5]:
corrells=(dd2d+rr2d-2.0*dr2d)/rr2d
In [6]:
corrells
Out[6]:
In [7]:
plt.contour(corrells)
Out[7]:
In [8]:
dzbin=zdthbin=np.arange(0.002,0.022,0.002)
In [9]:
plt.contour(dzbin,zdthbin,corrells)
Out[9]:
In [10]:
ztotal = np.concatenate([np.fliplr(corrells),corrells],axis=1)
ztotal = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal = np.concatenate([-dzbin[::-1],zdthbin],axis=0)
ytotal = np.concatenate([-zdthbin[::-1],zdthbin],axis=0)
plt.figure()
plt.contour(xtotal,ytotal,ztotal)
plt.savefig("../plots/anisotropic2pcfdzzdth.pdf")
plt.show()
In [11]:
dr72dat=ascii.read("../output/DR72LCsrarf.dat")
In [12]:
dr72dat
Out[12]:
In [13]:
z=np.mean(dr72dat['z'])
In [14]:
z
Out[14]:
In [18]:
om=0.3
ol=0.7
xLCDM=1.0/np.sqrt(om*(1.0+z)**3+ol)
print xLCDM
In [19]:
yLCDM0=np.sqrt(om*(1.0+z)**3+ol)/z
print yLCDM0
In [20]:
LCDMf = lambda x: 1.0/math.sqrt(om*(1+x)**3+ol)
np.vectorize(LCDMf)
def LCDMfint(z):
return integrate.quad(LCDMf, 0, z)
LCDMfint=np.vectorize(LCDMfint)
yLCDM=yLCDM0*LCDMfint(z)[0]
print yLCDM
In [21]:
xlc=1.0/(1.0+z)
ylc=(1.0+z)/z*np.log(1.0+z)
def ymilne(z):
return 1.0+z/2.0
In [22]:
print xlc
print ylc
print ymilne(z)
In [23]:
sparLCDM=xLCDM*dzbin
sperLCDM=xLCDM*yLCDM*zdthbin
print sparLCDM
print sperLCDM
In [24]:
ztotal = np.concatenate([np.fliplr(corrells),corrells],axis=1)
ztotal = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal = np.concatenate([-sparLCDM[::-1],sparLCDM],axis=0)
ytotal = np.concatenate([-sperLCDM[::-1],sperLCDM],axis=0)
plt.figure()
plt.contour(xtotal,ytotal,ztotal)
plt.savefig("../plots/ani2pcfLCDM.pdf")
plt.show()
In [ ]:
In [26]:
sparLC=xlc*dzbin
sperLC=xlc*ylc*zdthbin
print sparLC
print sperLC
In [27]:
ztotal = np.concatenate([np.fliplr(corrells),corrells],axis=1)
ztotal = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal = np.concatenate([-sparLC[::-1],sparLC],axis=0)
ytotal = np.concatenate([-sperLC[::-1],sperLC],axis=0)
plt.figure()
plt.contour(xtotal,ytotal,ztotal)
plt.savefig("../plots/ani2pcfLC.pdf")
plt.show()
In [ ]:
In [28]:
sparMilne=xlc*dzbin
sperMilne=xlc*ymilne(z)*zdthbin
print sparMilne
print sperMilne
In [29]:
ztotal = np.concatenate([np.fliplr(corrells),corrells],axis=1)
ztotal = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal = np.concatenate([-sparMilne[::-1],sparMilne],axis=0)
ytotal = np.concatenate([-sperMilne[::-1],sperMilne],axis=0)
plt.figure()
plt.contour(xtotal,ytotal,ztotal)
plt.savefig("../plots/ani2pcfMilne.pdf")
plt.show()
In [31]:
#ztotal1 = np.concatenate([np.fliplr(corrells),corrells],axis=1)
#ztotal1 = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal1 = np.concatenate([-sparMilne[::-1],sparMilne],axis=0)
ytotal1 = np.concatenate([-sperMilne[::-1],sperMilne],axis=0)
#ztotal2 = np.concatenate([np.fliplr(corrells),corrells],axis=1)
#ztotal2 = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal2 = np.concatenate([-sparLC[::-1],sparLC],axis=0)
ytotal2 = np.concatenate([-sperLC[::-1],sperLC],axis=0)
#ztotal3 = np.concatenate([np.fliplr(corrells),corrells],axis=1)
#ztotal3 = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal3 = np.concatenate([-sparLCDM[::-1],sparLCDM],axis=0)
ytotal3 = np.concatenate([-sperLCDM[::-1],sperLCDM],axis=0)
plt.figure()
plt.contour(xtotal1,ytotal1,ztotal)
plt.contour(xtotal2,ytotal2,ztotal)
plt.contour(xtotal3,ytotal3,ztotal)
plt.savefig("../plots/ani2pcfcompare.pdf")
plt.show()
In [ ]:
In [ ]:
In [ ]:
In [8]:
#z=np.arange(0.01,5,0.01)
#om=0.3
#ol=0.7
#yLCDM0=np.sqrt(om*(1+z)**3+ol)/z
#
#LCDMf = lambda x: 1.0/math.sqrt(om*(1+x)**3+ol)
#np.vectorize(LCDMf)
#
#def LCDMfint(zt):
# return integrate.quad(LCDMf, 0, zt)
#
#LCDMfint=np.vectorize(LCDMfint)
#
#yLCDM=yLCDM0*LCDMfint(z)[0]
#Ez = lambda z: 1/np.sqrt(0.3*(1+z)**3+0.7)
#np.vectorize(Ez)
#def ylcdm(z):
# for i in range(len(z)):
# return 1/z[i]*np.sqrt(0.3*(1+z[i])**3+0.7)/integrate.quad(Ez,0,z[i])
#print ylcdm(z)
#ylcdm=1/z*np.
plt.figure()
plt.xlabel('redshift(z)')
plt.ylabel('y(z)')
plt.plot(z,yLCDM,'red',label='yLCDM')
plt.plot(z,ylc,'green',label='yLC')
#plt.plot(z,ylcdm)
plt.plot(z,ymilne(z),'blue',label='yMilne')
plt.legend()
plt.savefig("yz_plots.pdf")
#plt.axes()
#plt.plot(z,ylcdm(z))
plt.show()
200k plots
In [78]:
dd2d=np.array([[ 131072., 37018., 39251., 43003., 46928., 52380.,
56755., 63357., 70037., 76252.],
[ 13635., 25181., 33553., 39651., 45318., 50737.,
57137., 63280., 69718., 76424.],
[ 7808., 18437., 28142., 35773., 43037., 49519.,
55848., 62215., 69007., 76304.],
[ 5782., 15833., 24651., 33141., 40864., 47585.,
55253., 61882., 68718., 75510.],
[ 5041., 13955., 23161., 31557., 38796., 46402.,
53552., 60708., 67437., 74405.],
[ 4584., 13421., 21805., 30038., 37630., 45206.,
52575., 60110., 66250., 73244.],
[ 4433., 13015., 21007., 29050., 36717., 44679.,
51354., 58511., 65240., 72592.],
[ 4287., 12526., 20387., 28567., 36093., 43421.,
50931., 57911., 64958., 71831.],
[ 4093., 12155., 20054., 28384., 35523., 43465.,
50161., 56795., 64062., 70675.],
[ 4170., 11915., 19636., 27596., 35199., 42741.,
49570., 56936., 63389., 70143.]])
rr2d=np.array([[ 219389., 52749., 86685., 118306., 150065., 178945.,
209520., 239222., 267225., 297534.],
[ 17753., 52569., 86627., 117295., 148557., 178415.,
208245., 238385., 267604., 294867.],
[ 17566., 51819., 85165., 116994., 147427., 177454.,
207106., 236741., 264963., 293735.],
[ 17780., 52130., 84770., 115177., 146679., 176461.,
205271., 233772., 263140., 291924.],
[ 17734., 51545., 83932., 114524., 145841., 175503.,
204296., 232320., 260856., 289001.],
[ 17313., 51400., 83842., 114798., 145069., 173206.,
203071., 231689., 259312., 287118.],
[ 17095., 50846., 82932., 113880., 143613., 173206.,
201398., 228866., 258066., 286164.],
[ 16866., 50369., 82171., 112970., 142838., 171366.,
199218., 227239., 254381., 283645.],
[ 16956., 49662., 81561., 112150., 141164., 170538.,
198573., 226388., 253592., 280492.],
[ 16865., 49297., 81354., 111885., 140364., 168967.,
196672., 223977., 251690., 278476.]])
dr2d=np.array([[ 17225., 51016., 83901., 115532., 145602., 174413.,
205404., 235251., 261629., 291459.],
[ 17130., 50742., 83297., 114374., 145734., 174830.,
204178., 232755., 260633., 289584.],
[ 16806., 50308., 82561., 114032., 144563., 173730.,
203012., 231303., 260188., 288244.],
[ 16964., 50424., 82672., 113163., 143783., 173336.,
202119., 231121., 258214., 285733.],
[ 16846., 49890., 81972., 113003., 143170., 172195.,
201662., 229361., 256191., 284896.],
[ 16966., 49739., 81756., 112037., 141410., 170703.,
199887., 227671., 256364., 283776.],
[ 16578., 49172., 80573., 111373., 141073., 170247.,
198875., 225671., 254128., 281677.],
[ 16713., 48801., 80484., 110405., 139692., 169457.,
197079., 225067., 252907., 280422.],
[ 16613., 49008., 80096., 109819., 139137., 167602.,
194844., 223229., 251104., 278213.],
[ 16212., 47944., 79251., 109194., 138363., 165319.,
194678., 222679., 248924., 276076.]])
In [79]:
correl200k=(dd2d-4.0*dr2d+4.0*rr2d)/rr2d
In [80]:
dzbin
Out[80]:
In [82]:
ztotal = np.concatenate([np.fliplr(correl200k),correl200k],axis=1)
ztotal = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal = np.concatenate([-dzbin[::-1],zdthbin],axis=0)
ytotal = np.concatenate([-zdthbin[::-1],zdthbin],axis=0)
plt.figure()
plt.contour(xtotal,ytotal,ztotal)
plt.savefig("../plots/anisotropic2pcf200k.pdf")
plt.show()
In [83]:
correl200k
Out[83]:
In [85]:
ztotal = np.concatenate([np.fliplr(correl200k),correl200k],axis=1)
ztotal = np.concatenate([np.flipud(ztotal),ztotal],axis=0)
xtotal = np.concatenate([-dzbin[::-1],zdthbin],axis=0)
ytotal = np.concatenate([-zdthbin[::-1],zdthbin],axis=0)
plt.figure()
plt.contour(xtotal,ytotal,ztotal,levels=(0.2,0.3,0.4,0.5,0.6,0.7,0.8))
plt.savefig("../plots/anisotropic2pcf200kl.pdf")
plt.show()
In [ ]:
In [64]:
dzmu1
Out[64]:
In [65]:
correlmu1
Out[65]:
In [100]:
sLCDM=pairdats['xLCDM']*np.sqrt((pairdats['deltaZ'])**2+(pairdats['yLCDM']*pairdats['Zdeltatheta'])**2)