# plot of the thresholds

import matplotlib.pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
from matplotlib.ticker import (MultipleLocator, AutoMinorLocator)

from data import *


# FONT -----------------------------------------------------------------------
rc = {"font.family" : "serif", 
      "mathtext.fontset" : "stix"}
plt.rcParams.update(rc)
# ----------------------------------------------------------------------------



# PLOT
# ----------------------------------------------------------------------------
xval = np.arange(0,1402,2).tolist()
fig, ax = plt.subplots(figsize=(6,10))
# ----------------------------------------------------------------------------




# MF3 
# ----------------------------------------------------------------------------
ax.plot(field_output_461,data_output_461,color='red',linewidth=0.5)
ax.plot(field_output_462,data_output_462,color='red',linewidth=0.5)
ax.plot(field_output_463,data_output_463,color='red',linewidth=0.5)
ax.plot(field_output_464,data_output_464,color='red',linewidth=0.5)
ax.plot(field_output_465,data_output_465,color='red',linewidth=0.5)
ax.plot(field_output_466,data_output_466,color='red',linewidth=0.5)
ax.plot(field_output_467,data_output_467,color='red',linewidth=0.5)
ax.plot(field_output_468,data_output_468,color='red',linewidth=0.5)
ax.plot(field_output_469,data_output_469,color='red',linewidth=0.5)
# ----------------------------------------------------------------------------


# MF2
# ----------------------------------------------------------------------------
ax.plot(field_output_590,data_output_590,color='blue',linewidth=0.5)
ax.plot(field_output_591,data_output_591,color='blue',linewidth=0.5)
ax.plot(field_output_592,data_output_592,color='blue',linewidth=0.5)
ax.plot(field_output_593,data_output_593,color='blue',linewidth=0.5)
ax.plot(field_output_594,data_output_594,color='blue',linewidth=0.5)
ax.plot(field_output_595,data_output_595,color='blue',linewidth=0.5)
ax.plot(field_output_596,data_output_596,color='blue',linewidth=0.5)
ax.plot(field_output_597,data_output_597,color='blue',linewidth=0.5)
ax.plot(field_output_598,data_output_598,color='blue',linewidth=0.5)
ax.plot(field_output_598,data_output_598,color='blue',linewidth=0.5)
ax.plot(field_output_599,data_output_599,color='blue',linewidth=0.5)
ax.plot(field_output_600,data_output_600,color='blue',linewidth=0.5)
ax.plot(field_output_601,data_output_601,color='blue',linewidth=0.5)
ax.plot(field_output_602,data_output_602,color='blue',linewidth=0.5)
ax.plot(field_output_603,data_output_603,color='blue',linewidth=0.5)
ax.plot(field_output_604,data_output_604,color='blue',linewidth=0.5)
ax.plot(field_output_605,data_output_605,color='blue',linewidth=0.5)
ax.plot(field_output_606,data_output_606,color='blue',linewidth=0.5)
# ----------------------------------------------------------------------------


# MF1
# ----------------------------------------------------------------------------
ax.plot(field_output_612,data_output_612,color='green',linewidth=0.5)
ax.plot(field_output_613,data_output_613,color='green',linewidth=0.5)
ax.plot(field_output_614,data_output_614,color='green',linewidth=0.5)
ax.plot(field_output_615,data_output_615,color='green',linewidth=0.5)
ax.plot(field_output_616,data_output_616,color='green',linewidth=0.5)
ax.plot(field_output_617,data_output_617,color='green',linewidth=0.5)
ax.plot(field_output_618,data_output_618,color='green',linewidth=0.5)
ax.plot(field_output_619,data_output_619,color='green',linewidth=0.5)
ax.plot(field_output_620,data_output_620,color='green',linewidth=0.5)
ax.plot(field_output_621,data_output_621,color='green',linewidth=0.5)
ax.plot(field_output_622,data_output_622,color='green',linewidth=0.5)
ax.plot(field_output_623,data_output_623,color='green',linewidth=0.5)
ax.plot(field_output_624,data_output_624,color='green',linewidth=0.5)
ax.plot(field_output_625,data_output_625,color='green',linewidth=0.5)
ax.plot(field_output_626,data_output_626,color='green',linewidth=0.5)
ax.plot(field_output_627,data_output_627,color='green',linewidth=0.5)
ax.plot(field_output_628,data_output_628,color='green',linewidth=0.5)
ax.plot(field_output_629,data_output_629,color='green',linewidth=0.5)
ax.plot(field_output_630,data_output_630,color='green',linewidth=0.5)
ax.plot(field_output_631,data_output_631,color='green',linewidth=0.5)
# ----------------------------------------------------------------------------



# MF5
# ----------------------------------------------------------------------------
ax.plot(field_output_153,data_output_153,color='orange',linewidth=0.5)
ax.plot(field_output_154,data_output_154,color='orange',linewidth=0.5)
ax.plot(field_output_155,data_output_155,color='orange',linewidth=0.5)
# ----------------------------------------------------------------------------




# MF6
# ----------------------------------------------------------------------------
ax.plot(field_output_23,data_output_23,color='purple',linewidth=0.5)
# ----------------------------------------------------------------------------




# MF4
# ----------------------------------------------------------------------------
lineref2 = ax.plot(xval,energy_4_list,'--',color='black',linewidth=1.2)

ax.plot(field_list_312,data_output_312,color='black',linewidth=1.5)
ax.plot(field_list_311,data_output_311,color='black',linewidth=1.5)
ax.plot(field_list_310,data_output_310,color='black',linewidth=1.5)
ax.plot(field_list_309,data_output_309,color='black',linewidth=1.5)
ax.plot(field_list_308,data_output_308,color='black',linewidth=1.5)
ax.plot(field_list_307,data_output_307,color='black',linewidth=1.5)
ax.plot(field_list_307,data_output_307,color='black',linewidth=1.5)
ax.plot(field_list_306,data_output_306,color='black',linewidth=1.5)
# ----------------------------------------------------------------------------


# AX PARAMETERS
# ----------------------------------------------------------------------------
ax.set_yticks(np.arange(0,-4600,-500))
ax.set_xlim(0,1400)
ax.set_ylim(-4300,50)
ax.set_xlabel('Magnetic field  (G)',labelpad=12,size=18)
ax.set_ylabel('$E/h$  (MHz)',labelpad=10,size=18)
ax.set_xticks(np.arange(0,1450,200))
ax.xaxis.set_minor_locator(MultipleLocator(40))
ax.yaxis.set_minor_locator(MultipleLocator(100))
ax.tick_params(axis="x",which='both',direction="in",labelsize=16)
ax.tick_params(axis="y",which='both',direction="in",labelsize=16)
# ----------------------------------------------------------------------------


# FIG TEXT
# ----------------------------------------------------------------------------
fig.text(0.75,0.84,'$M_F=1$',color='green',size=18)
fig.text(0.75,0.81,'$M_F=2$',color='blue',size=18)
fig.text(0.75,0.78,'$M_F=3$',color='red',size=18)
fig.text(0.75,0.75,'$M_F=4$',color='black',size=18)
fig.text(0.75,0.72,'$M_F=5$',color='orange',size=18)
fig.text(0.75,0.69,'$M_F=6$',color='purple',size=18)

fig.text(0.058,0.81,'(1,3)',size=15)
fig.text(0.058,0.475,'(2,3)',size=15)
fig.text(0.058,0.2,'(1,3)',size=15)
fig.text(0.058,0.14,'(2,4)',size=15)
# ----------------------------------------------------------------------------

plt.show()