Observables.py 1.62 KB
from numpy import sort, log10
from matplotlib.pyplot import figure, show
from mpl_toolkits.mplot3d import Axes3D
from Modules.Read import ReadEnergy, ReadTime, ReadExtraFile
from Modules.Constants import degre

def drawObservablesSpace(fileId):
   fig = figure()
   ax = fig.add_subplot(232,projection='3d')
   ax1 = fig.add_subplot(233)
   ax2 = fig.add_subplot(231)
   ax3 = fig.add_subplot(235)

   energy = ReadEnergy(fileId)
   delay  = ReadTime(fileId)
   generation, theta = ReadExtraFile(fileId,[3,4])
   theta*=degre

   colors=['b','g','r','m','c','y']
   i=0

   for gen in sort(list(set(generation))):
      cond = (generation==gen) & (delay>0) & (theta>0)
      ax.scatter(log10(energy[cond]),log10(theta[cond]),log10(delay[cond]),color=colors[i],label="gen = %.0f"%gen)
      ax1.scatter(energy[cond],delay[cond],color=colors[i])
      ax2.scatter(theta[cond],delay[cond],color=colors[i])
      ax3.scatter(theta[cond],energy[cond],color=colors[i])
      i+=1

   ax.legend(loc="best")
   #ax.set_xscale('log')
   #ax.set_yscale('log')
   #ax.set_zscale('log')
   ax.set_xlabel("energy [GeV]")
   ax.set_ylabel("$\\theta$ [deg]")
   ax.set_zlabel("Time delay [s]")

   ax1.grid(b=True,which='major')
   ax1.set_xscale('log')
   ax1.set_yscale('log')
   ax1.set_xlabel("energy [GeV]")
   ax1.set_ylabel("Time delay [s]")

   ax2.grid(b=True,which='major')
   ax2.set_xscale('log')
   ax2.set_yscale('log')
   ax2.set_xlabel("$\\theta$ [deg]")
   ax2.set_ylabel("Time delay [s]")

   ax3.grid(b=True,which='major')
   ax3.set_xscale('log')
   ax3.set_yscale('log')
   ax3.set_xlabel("$\\theta$ [deg]")
   ax3.set_ylabel("energy [GeV]")

   show()