Correlation function of DR12Q SDSS Catalog

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]:
with open('DR12QDDbin1.pkl') as f:
    dd2d=pickle.load(f)

In [3]:
with open('randDR12QRRbin1.pkl') as f:
    rr2d=pickle.load(f)

In [4]:
with open('DR12QDRbin1.pkl') as f:
    dr2d=pickle.load(f)

In [5]:
corrells=(dd2d+rr2d-2.0*dr2d)/rr2d

In [6]:
dzbin=zdthbin=np.arange(0.001,0.021,0.001)

In [7]:
plt.contour(dzbin,zdthbin,corrells)


Out[7]:
<matplotlib.contour.QuadContourSet at 0x11c3c2f50>

In [8]:
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/DR12Qani2pcfdzzdth.pdf")
plt.show()



In [9]:
def shrink(data, rows, cols):
    return data.reshape(rows, data.shape[0]/rows, cols, data.shape[1]/cols).sum(axis=1).sum(axis=2)

In [10]:
correlshr=shrink(corrells,10,10)
print correlshr


[[ 10.02347196   3.32067183  -3.22262367  -2.31308841  -4.44069541
   -4.20584056  -5.71358163  -5.26341886  -5.39979613  -4.78435036]
 [  5.22713033  -0.37827745  -2.02615199  -3.76987818  -3.90671551
   -4.70695834  -5.18072066  -5.90572943  -4.29112429  -4.50283222]
 [  2.79166667  -3.37207977  -2.76137513  -3.67098211  -4.52724139
   -5.9845085   -4.75848747  -5.32230799  -5.19921405  -4.9481964 ]
 [ -3.15714286  -2.89002507  -4.58620882  -3.52080508  -6.34138977
   -5.02916579  -5.86612933  -4.74459238  -4.42337185  -5.01272481]
 [ -3.51055807  -3.31332885  -4.74558775  -5.22084831  -3.99417954
   -4.27806461  -4.53470445  -5.11134684  -6.50795669  -6.06745186]
 [ -1.94202899  -3.85257335  -4.67072671  -5.0488554   -6.23673957
   -5.19525993  -5.03692029  -5.27032963  -4.99990126  -5.19229471]
 [ -4.90559441  -2.42851923  -4.2536028   -4.37203874  -5.11215163
   -5.380812    -5.49287764  -5.34610256  -6.15901787  -4.7406049 ]
 [ -7.65555556  -3.76083767  -3.94482759  -5.7801186   -5.71898412
   -4.23134925  -4.82201756  -5.87218748  -5.54249372  -4.24356749]
 [ -6.8884058   -3.8795964   -5.7896491   -5.36529153  -5.83657821
   -5.16428602  -6.0328148   -5.23681838  -5.8243077   -5.58567798]
 [-11.6         -5.77163399  -4.1730464   -4.53856093  -6.8094747
   -5.08124519  -6.32178521  -6.61662922  -5.97367096  -5.52052094]]

In [11]:
plt.contour(correlshr)


Out[11]:
<matplotlib.contour.QuadContourSet at 0x11c832e50>

In [12]:
dzbin=zdthbin=np.arange(0.002,0.022,0.002)
ztotal = np.concatenate([np.fliplr(correlshr),correlshr],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/DR12Qani2pcf10bin.pdf")
plt.show()



In [13]:
with open('DR12QDDbin2.pkl') as f:
    dd2d=pickle.load(f)

In [14]:
with open('randDR12QRRbin2.pkl') as f:
    rr2d=pickle.load(f)

In [18]:
RR_zero = (rr2d == 0)
rr2d[RR_zero] = 1

In [15]:
with open('DR12QDRbin2.pkl') as f:
    dr2d=pickle.load(f)

In [19]:
corrells=(dd2d+rr2d-2.0*dr2d)/rr2d

In [20]:
dzbin=zdthbin=np.arange(0.001,0.021,0.001)

In [21]:
plt.contour(dzbin,zdthbin,corrells)


Out[21]:
<matplotlib.contour.QuadContourSet at 0x11c9eac90>

In [22]:
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/DR12Qani2pcfbin2.pdf")
plt.show()



In [23]:
def shrink(data, rows, cols):
    return data.reshape(rows, data.shape[0]/rows, cols, data.shape[1]/cols).sum(axis=1).sum(axis=2)

In [24]:
correlshr=shrink(corrells,10,10)

In [25]:
plt.contour(correlshr)


Out[25]:
<matplotlib.contour.QuadContourSet at 0x11cd91090>

In [26]:
dzbin=zdthbin=np.arange(0.002,0.022,0.002)
ztotal = np.concatenate([np.fliplr(correlshr),correlshr],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/DR12Qani2bin2.pdf")
plt.show()



In [ ]: