File_ID = 9
Field_ID = 0
LineWidth = 2
FontSize = 18
UseLog = 0
Plot_EDGES = True

from src.src import *
File_List=[
  'MCG_Template.h5', # 0
  'ALPHA_STAR_1.h5', # 1
  'ALPHA_STAR_2.h5', # 2
  'ALPHA_STAR_MINI_1.h5', # 3
  'ALPHA_STAR_MINI_2.h5', # 4
  'A_LW_1.h5', # 5
  'A_LW_2.h5', # 6
  'A_VCB_1.h5', # 7
  'A_VCB_2.h5', # 8
  'BETA_LW_1.h5', # 9
  'BETA_LW_2.h5', # 10
  'BETA_VCB_1.h5', # 11
  'BETA_VCB_2.h5', # 12
  'F_ESC7_MINI_1.h5', # 13
  'F_ESC7_MINI_2.h5', # 14
  'F_STAR10_1.h5', # 15
  'F_STAR10_2.h5', # 16
  'F_STAR7_MINI_1.h5', # 17
  'F_STAR7_MINI_2.h5', # 18
  'L_X_1.h5', # 19
  'L_X_2.h5', # 20
  'L_X_MINI_1.h5', # 21
  'L_X_MINI_2.h5', # 22
  'NU_X_THRESH_1.h5', # 23
  'NU_X_THRESH_2.h5', # 24
]

Field_List=[
  'brightness_temp', #0
  'Ts_box', #1
  'Tk_box', #2
  'xH_box', #3
  'Trad_box', #4
  'density', #5
  'dNrec_box', #6
  'Gamma12_box', #7
  'J_21_LW_box', #8
  'z_re_box', #9
  'Fcoll', #10
]
Y_Labels=[
    '$T_{21}$ (mK)',
    '$T_{\mathrm{s}}$ (K)',
    '$T_{\mathrm{k}}$ (K)',
    '$x_{\mathrm{H}}$',
    '$T_{\mathrm{Radio}}$ (K)',
    Field_List[Field_ID],
    Field_List[Field_ID],
    Field_List[Field_ID],
    Field_List[Field_ID],
    '$z_{\mathrm{rei}}$',
    '$f_{\mathrm{coll}}$'
]

File_0 = '/Users/cangtao/Desktop/cache21/MCG/'+File_List[0]
File_1 = '/Users/cangtao/Desktop/cache21/MCG/'+File_List[File_ID]
File_2 = '/Users/cangtao/Desktop/cache21/MCG/'+File_List[File_ID+1]

Field = 'global_quantities/'+Field_List[Field_ID]
F0 = h5py.File(File_0,'r')
F1 = h5py.File(File_1,'r')
F2 = h5py.File(File_2,'r')
z = F0['node_redshifts'][:]
T0 = F0[Field][:]
T1 = F1[Field][:]
T2 = F2[Field][:]

F0.close()
F1.close()
F2.close()

plt.rcParams.update({'font.family':'Times'})
plt.rcParams['text.usetex'] = True
plt.plot(z,T0,color = 'k',linestyle='-',linewidth=LineWidth,label='Fiducial')
plt.plot(z,T1,color = 'b',linestyle='-',linewidth=LineWidth,label='-')
plt.plot(z,T2,color = 'r',linestyle='-',linewidth=LineWidth,label='+')

if Plot_EDGES and Field_ID == 0:
  zE, TE = EDGES_T21_v2()
  plt.plot(zE,TE,color = 'r',linestyle='--',linewidth=2*LineWidth,label='EDGES')

if UseLog:
  plt.yscale('log')
plt.xlabel('$z$',fontsize=FontSize,fontname='Times New Roman')
plt.ylabel(Y_Labels[Field_ID],fontsize=FontSize,fontname='Times New Roman')
plt.xticks(size=FontSize)
plt.yticks(size=FontSize)
plt.legend(fontsize=FontSize,loc = 'lower right')
plt.savefig('/Users/cangtao/Desktop/tmp.eps',bbox_inches='tight')
print(File_1)
plt.show()

