from math import *
from numpy import *
from scipy import *
import cosmolopy.constants as cc
import cosmolopy.distance as cd
import cosmolopy.perturbation as cp
import matplotlib.pyplot as plt
import matplotlib.ticker as tic
import matplotlib.axis 
from scipy.integrate import quad
from scipy import special
from scipy import interpolate


#===================Read the file==================================

(kb_z1, pb_z1) = loadtxt('Pb_vs_k_testz=1.txt', unpack=True)
(kb_z0, pb_z0) = loadtxt('Pb_vs_k_testz=0.txt', unpack=True)
#====================== Labels ==========================
pb_z1 = pb_z1
fig2 = plt.figure()
ax2 = fig2.add_subplot(111)#, yscale='log')
ax2.set_xscale('log')
ax2.plot(kb_z1,pb_z1, color= 'red', linewidth=2.5, linestyle="-", label ='z= 1 ')
ax2.plot(kb_z0,pb_z0, color= 'green', linewidth=2.5, linestyle="-", label ='z= 0 ')
ax2.set_ylabel(r"$P_b(k) \ [{\rm Mpc}^{3} h^{-3} ]$", fontsize=15)
ax2.set_xlabel(r"$k \ [{\rm Mpc}^{-1} h ]$", fontsize=15)
ax2.legend(loc='upper right')
plt.savefig('Pb_k.eps')
plt.show()
print '============== The program executed successfully!=============================='




