
LineWidth = 2
FontSize = 18

import numpy as np
import h5py
import matplotlib.pyplot as plt

Field='global_quantities/brightness_temp'
F1 = '/Users/cangtao/Desktop/cache21/ACG.h5'
F2 = '/Users/cangtao/Desktop/cache21/Zcut.h5'

F1 = h5py.File(F1,'r')
F2 = h5py.File(F2,'r')
z = F1['node_redshifts'][:]
T1 = F1[Field][:]
T2 = F2[Field][:]

datafile='/Users/cangtao/IHEPBox/Projects/GitHub/Radio_Excess_EDGES/data/Data_EDGES.txt'
data=np.genfromtxt(datafile)
f=data[:,0]
T_model=data[:,5]*1000
T21=data[:,6]*1000
ze=1420/f-1

plt.rcParams.update({'font.family':'Times'})
plt.rcParams['text.usetex'] = True
plt.plot(z,T1,color = 'k',linestyle='-',linewidth=LineWidth,label = '$Z_{\mathrm{cut}}=0$')
plt.plot(z,T2,color = 'b',linestyle='-',linewidth=LineWidth,label = '$Z_{\mathrm{cut}}=18.9$')

plt.plot(ze,T_model,color = 'r',linestyle='-',linewidth=LineWidth,label = 'EDGES: $T_{\mathrm{model}}$')
plt.plot(ze,T21,color = 'g',linestyle='-',linewidth=LineWidth,label = 'EDGES: $T_{21}$')

plt.legend(fontsize=FontSize,loc = 'lower right')
plt.xlabel('$z$',fontsize=FontSize,fontname='Times New Roman')
plt.ylabel('$T_{21}$ (mK)',fontsize=FontSize,fontname='Times New Roman')
plt.xticks(size=FontSize)
plt.yticks(size=FontSize)
plt.savefig('/Users/cangtao/Desktop/tmp.png',bbox_inches='tight',dpi=1000)

plt.show()

