from numpy import *
from matplotlib.pyplot import *

import matplotlib as mpl
mpl.rcParams['xtick.major.size'] = 8
mpl.rcParams['xtick.minor.size'] = 4
mpl.rcParams['xtick.major.width'] = 1.5
mpl.rcParams['xtick.minor.width'] = 1.5
mpl.rcParams['ytick.major.size'] = 8
mpl.rcParams['ytick.minor.size'] = 4
mpl.rcParams['ytick.major.width'] = 1.5
mpl.rcParams['ytick.minor.width'] = 1.5
import matplotlib.pylab as plt
plt.rc('pdf', fonttype=42)
plt.rc('ps',  fonttype=42)



h  =loadtxt('mason_H.dat')
he =loadtxt('mason_He.dat')
cno=loadtxt('mason_CNO.dat')
fe =loadtxt('mason_Fe.dat')

markers=10
labels=16
figure()
errorbar(h[::2,0],h[::2,1],xerr=h[1::2,0]-h[::2,0],fmt='ro-',markersize=markers,capsize=4, elinewidth=2)
errorbar(he[::2,0],he[::2,1],xerr=he[1::2,0]-he[::2,0],fmt='bs-',markersize=markers,capsize=4, elinewidth=2)
errorbar(cno[::2,0],cno[::2,1],xerr=cno[1::2,0]-cno[::2,0],fmt='kD-',markersize=markers,capsize=4, elinewidth=2)
errorbar(fe[::2,0],fe[::2,1],xerr=fe[1::2,0]-fe[::2,0],fmt='g>-',markersize=markers,capsize=4, elinewidth=2)
xscale('log')
yscale('log')
xlabel('MeV/nucleon',fontsize=labels)
ylabel('Flux (particles/s cm$^2$ sr MeV/nuc)',fontsize=labels)
xticks([1e-2,1e-1,1,10],['0.01','0.1','1','10'],fontsize=labels)
#ylim(1e-8,1e5)
yticks([1e-7,1e-5,1e-3,1e-1,1e1,1e3],fontsize=labels)

annotate("H", xy=(2.2,40), xytext=(5, 20), fontsize=22,
    arrowprops=dict(arrowstyle="->", lw=2),)

annotate("He", xy=(1.5,0.7), xytext=(5.8, 0.2), fontsize=22,
    arrowprops=dict(arrowstyle="->", lw=2),)

annotate("CNO", xy=(0.22,1.2), xytext=(0.05, 0.01), fontsize=22,
    arrowprops=dict(arrowstyle="->", lw=2),)


annotate("Fe", xy=(0.35,0.01), xytext=(0.1,0.0001), fontsize=22,
    arrowprops=dict(arrowstyle="->", lw=2),)





show()
