File_ID = 10
Field_ID = 0
LineWidth = 2
FontSize = 18
UseLog = False
Plot_EDGES = True

from src.src import *
File_List=[
  'LC_Fiducial.h5', #0
  'LC_ACG.h5', #1
  'LC_MCG.h5', #2
  'LC_MCG_Lite.h5', #3
  'LC_PBH.h5', #4
  'LC_best_fit.h5', #5
  'LC_best_fit_penalised.h5', #6
  'LC_best_fit_penalised_v2.h5', #7
  'LC_best_guess.h5', #8
  'LC_best_guess_150.h5', #9
  'MCG/MCG_Template.h5', #10
  'LC.h5', #11
]

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 = '/Users/cangtao/Desktop/cache21/'+File_List[File_ID]
Field = 'global_quantities/'+Field_List[Field_ID]
F = h5py.File(File,'r')
z = F['node_redshifts'][:]
T = F[Field][:]
F.close()

plt.rcParams.update({'font.family':'Times'})
plt.rcParams['text.usetex'] = True
plt.plot(z,T,color = 'k',linestyle='-',linewidth=LineWidth)
if Plot_EDGES and Field_ID == 0:
  z0, T0 = EDGES_T21_v2()
  plt.plot(z0,T0,color = 'r',linestyle='--',linewidth=LineWidth)

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.savefig('/Users/cangtao/Desktop/tmp.eps',bbox_inches='tight')

print(File)

plt.show()

