from numpy import *
import numpy as np
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

ticksize=20
labelsize=22

data=loadtxt('1998_DOY_120-126_HSTOF_data.dat')
m_q=data[:,0]
mass=data[:,1]

H, xedges, yedges = np.histogram2d(m_q,mass,bins=np.logspace(-1,2,300))
H = np.rot90(H)
H = np.flipud(H)
Hmasked = np.ma.masked_where(H==0,H)


figure(figsize=(14,10))
subplot(121)
pcolormesh(xedges,yedges,Hmasked)


ylim(0.1,100)
xlim(0.1,100)
yscale('log')
xscale('log')



xticks([1,10,100],fontsize=ticksize)
yticks([0.1,1,10,100],fontsize=ticksize)
#text(25,1e-4,'STOF Flux',fontsize=labelsize,color='b')
#text(25,13e-6,'One Count Level\n      of STOF',fontsize=labelsize,color='g')
#title('1999-139 02:11:02~139 07:12:00',fontsize=labelsize)
xlabel('Mass/Charge [amu/e]',fontsize=labelsize)
ylabel('Mass [amu]',fontsize=labelsize)
#text(13,0.05,'~4 to 10AU',fontsize=labelsize)
#text(300,0.05,'CIR-01',fontsize=labelsize)
#text(13,0.2,'The Connection Distance',fontsize=labelsize)
tick_params(right='off',top='off',which='both')
title('HSTOF',fontsize=labelsize)
show()





data=loadtxt('1998_DOY_120-126_STOF_data.dat')
m_q=data[:,0]
mass=data[:,1]

H, xedges, yedges = np.histogram2d(m_q,mass,bins=np.logspace(-1,2,300))
H = np.rot90(H)
H = np.flipud(H)
Hmasked = np.ma.masked_where(H==0,H)



subplot(122)
pcolormesh(xedges,yedges,Hmasked)


ylim(0.1,100)
xlim(0.1,100)
yscale('log')
xscale('log')



xticks([1,10,100],fontsize=ticksize)
yticks(())
#text(25,1e-4,'STOF Flux',fontsize=labelsize,color='b')
#text(25,13e-6,'One Count Level\n      of STOF',fontsize=labelsize,color='g')
#title('1999-139 02:11:02~139 07:12:00',fontsize=labelsize)
xlabel('Mass/Charge [amu/e]',fontsize=labelsize)
#ylabel('Mass [amu]',fontsize=labelsize)
#text(13,0.05,'~4 to 10AU',fontsize=labelsize)
#text(300,0.05,'CIR-01',fontsize=labelsize)
#text(13,0.2,'The Connection Distance',fontsize=labelsize)
tick_params(right='off',top='off',which='both')
title('STOF',fontsize=labelsize)
show()
tight_layout(pad=0.4,h_pad=0.01,w_pad=0.001)


