#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np

# Energy, sticking, error
Art = np.array(
[[550,	3240,	174.31],
[600,	3418.09,	168.02],
[650,	3547.6,	191.51],
[700,	3683.31,	205.42],
[750,	3760.72,	216.91],
[900,	4070.12,	274.51]]
)

NN = np.array(
[[400,	2946.95,	147.35],
[450,	3062.33,	153.12],
[500,	3177.70,	158.89],
[550,	3293.08,	164.65],
[600,	3408.45,	170.42],
[650,	3523.83,	176.19],
[700,	3639.20,	181.96],
[750,	3754.58,	187.73],
[800,	3869.95,	193.50],
[900,	4070.12,	274.51],
[950,	4216.08,	300.00],
[1000,	4320.12,	324.01]]
)

NN2 = np.array(
[[400,	2946.95,	147.35*1.1],
[450,	3062.33,	153.12*1.1],
[500,	3177.70,	158.89*1.1],
[550,	3293.08,	164.65*1.1],
[600,	3408.45,	170.42*1.1],
[650,	3523.83,	176.19*1.1],
[700,	3639.20,	181.96*1.1],
[750,	3754.58,	187.73*1.1],
[800,	3869.95,	193.50*1.1],
[900,	4070.12,	274.51],
[950,	4216.08,	300.00],
[1000,	4320.12,	324.01]]
)

mpl.rc("font", size=10)
fig = plt.figure(figsize=(3.69,3))

plt.plot( NN2[:,1], NN2[:,1]*0.055, marker='o', label=r'Theory ($\alpha=0.055\nu_0$)', color='g' )
plt.plot( NN[:,1], NN[:,2], marker='o', label='Theory', color='r' )
plt.plot( Art[:,1], Art[:,2], marker='o', label='Experiment', color='b' )

#plt.legend(loc='best', numpoints=1, frameon=False)
plt.legend(loc='upper left', numpoints=1, frameon=False, borderaxespad=0.2)
plt.xticks(np.arange(2800,5000,400))
plt.xlim(2800,4400.)
#plt.ylim(5*10**-5,1.0)
plt.tick_params(length=6, width=1)
plt.ylabel(r'$\alpha$ (m/s)')
plt.xlabel(r'$\nu_0$ (m/s)')

plt.tight_layout()
plt.savefig('beamparameters.pdf')

plt.clf()
plt.ylim(2800,4400.)
plt.xlim(350,1050)
plt.plot( NN[:,0], NN[:,1], marker='o', label='Theory', color='r' )
plt.plot( Art[:,0], Art[:,1], marker='o', label='Experiment', color='b' )
plt.legend(loc='upper left')
plt.ylabel(r'$\nu_0$ (m/s)')
plt.xlabel(r'$T_n$ (K)')

plt.savefig('beam_velocity.pdf')
#plt.show()
