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]:
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
In [11]:
plt.contour(correlshr)
Out[11]:
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]:
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]:
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 [ ]: