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
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]:
correl200k0=np.array([ 4.28338704, 0.83319115, 0.5812655 , 0.45728027, 0.43167961,
0.39402051, 0.34946067, 0.33124462, 0.34585462, 0.33795129])
In [3]:
bins=np.array([ 0.002, 0.004, 0.006, 0.008, 0.01 , 0.012, 0.014, 0.016,
0.018, 0.02 ])
In [5]:
plt.plot(bins,correl200k0,'bo-')
Out[5]:
In [22]:
from __future__ import division
def xi0(dz,gamma,beta,kz):
return kz*(dz)**(-gamma)*(1.0+2.0*(1.0-gamma)/(3.0-gamma)*beta+(3.0-6.0*gamma+gamma*(2.0+gamma))/((3.0-gamma)*(5.0-gamma))*beta**2)
In [ ]:
In [ ]:
In [ ]:
In [23]:
xi0v=xi0(bins,1.0,2.0,1.0)
In [24]:
print xi0v
In [16]:
bins
Out[16]:
In [17]:
xi0v=xi0(0.002,1.0,2.0,1.0)
In [18]:
print xi0v
In [25]:
ans=curve_fit(xi0,bins,correl200k0)
In [26]:
ans
Out[26]:
In [33]:
perr = np.sqrt(np.diag(ans[1]))
In [34]:
perr
Out[34]:
In [38]:
plt.plot(bins, xi0(bins,1.74549968, 0.73620809, 0.09657359),'bo-')
plt.plot(bins,correl200k0,'r*-')
Out[38]:
In [39]:
ans1=curve_fit(xi0,bins,correl200k0,method='lm')
In [40]:
ans1
Out[40]:
In [ ]:
In [ ]:
In [ ]:
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]:
def musq(y,dz,zdth):
return 1.0/(1.0+y**2*(dz/zdth[:,None])**2)
In [12]:
def f(y,dz,zdth,beta,gamma):
musqv=musq(y,dz,zdth)
return 1.0+2.0*(1.0-gamma*musqv)/(3-gamma)*beta+(3.0-6.0*gamma*musqv+gamma*(2.0+gamma)*musqv**2)*beta**2/((3.0-gamma)*(5.0-gamma))
In [13]:
def xi(dzzdth,Kz,y,beta,gamma):
dz=dzzdth
zdth=dzzdth
musqv=musq(y,dz,zdth)
fv=f(y,dz,zdth,beta,gamma)
ans=Kz*musqv**(gamma/2.0)*fv/(dz)**gamma
return ans.ravel()
In [14]:
def xibetaf(dzzdth,Kz,y,gamma):
beta=1.0
return xi(dzzdth,Kz,y,beta,gamma)
In [17]:
ans=curve_fit(xibetaf,dzbin,corrells.ravel())
In [18]:
ans
Out[18]:
In [19]:
sol=ans[0]
In [22]:
def xi2d(dzzdth,Kz,y,beta,gamma):
dz=dzzdth
zdth=dzzdth
musqv=musq(y,dz,zdth)
fv=f(y,dz,zdth,beta,gamma)
ans=Kz*musqv**(gamma/2.0)*fv/(dz)**gamma
return ans
def xibetaf2d(dzzdth,Kz,y,gamma):
beta=1.0
return xi2d(dzzdth,Kz,y,beta,gamma)
In [23]:
plt.contour(xibetaf2d(dzbin,*sol))
Out[23]:
In [24]:
plt.contour(corrells)
Out[24]:
In [38]:
correlshr4=correlshr[0:4,0:4]
In [44]:
ans=curve_fit(xibetaf,dzbin[0:4],correlshr4.ravel())
In [45]:
ans
Out[45]:
In [ ]:
In [ ]:
In [39]:
dzbin[0:4]
Out[39]: