script for convert .t3pa files to .t3pa_cls
.t3pa file example:
Index $\quad$ Matrix $\quad$ Index $\quad$ ToA $\quad$ ToT $\quad$ FToA $\quad$ Overflow
0 $\quad$ 4574 $\quad$ 832 $\quad$ 29 $\quad$ 6 $\quad$ 0
1 $\quad$ 4831 $\quad$ 832 $\quad$ 35 $\quad$ 7 $\quad$ 0
2 $\quad$ 4575 $\quad$ 832 $\quad$ 100 $\quad$ 8 $\quad$ 0
3 $\quad$ 31031 $\quad$ 1745 $\quad$ 22 $\quad$ 11 $\quad$ 0
.
.
.
.t3pa_cls file example:
% Index $\quad$ Matrix Index $\quad$ [ RowNo, ClmNo ] $\quad$ ToA $\quad$ FToA $\quad$ ( ToA_in_ns ) $\quad$ ToT ( ToT_in_keV ) $\quad$ Overflow
# 1, $\quad$ Nunmasked = 3, $\quad$ Nmasked = 0, $\quad$ Ntot = 3 # Tfirst = 2.0787500000000000e+04 ns, $\quad$ Tlast = 2.0790625000000000e+04 ns, $\quad$ dT = 3.125000 ns, $\quad$ Etot = 64.428148 keV
2 $\quad$ 4575 $\quad$ [ 17, 223 ] $\quad$ 832 $\quad$ 8 $\quad$ ( 2.0787500000000000e+04 ns ) $\quad$ 100 $\quad$ ( 37.867914 keV ) $\quad$ 0
1 $\quad$ 4831 $\quad$ [ 18, 223 ] $\quad$ 832 $\quad$ 7 $\quad$ ( 2.0789062500000000e+04 ns ) $\quad$ 35 $\quad$ ( 14.733453 keV ) $\quad$ 0
0 $\quad$ 4574 $\quad$ [ 17, 222 ] $\quad$ 832 $\quad$ 6 $\quad$ ( 2.0790625000000000e+04 ns ) $\quad$ 29 $\quad$ ( 11.826781 keV ) $\quad$ 0
# 2, $\quad$ Nunmasked = 3, $\quad$ Nmasked = 0, $\quad$ Ntot = 3 # Tfirst = 4.3601562500000000e+04 ns, $\quad$ Tlast = 4.3607812500000000e+04 ns, $\quad$ dT = 6.250000 ns, $\quad$ Etot = 63.577435 keV
5 $\quad$ 30775 $\quad$ [ 120, 55 ] $\quad$ 1745 $\quad$ 15 $\quad$ ( 4.3601562500000000e+04 ns ) $\quad$ 99 $\quad$ ( 37.617059 keV ) $\quad$ 0
4 $\quad$ 30776 $\quad$ [ 120, 56 ] $\quad$ 1745 $\quad$ 13 $\quad$ ( 4.3604687500000000e+04 ns ) $\quad$ 44 $\quad$ ( 14.715446 keV ) $\quad$ 0
3 $\quad$ 31031 $\quad$ [ 121, 55 ] $\quad$ 1745 $\quad$ 11 $\quad$ ( 4.3607812500000000e+04 ns ) $\quad$2 2 $\quad$ ( 11.244929 keV ) $\quad$ 0
.
.
.
import numpy as np
import math
#import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.cm as cm
#from matplotlib.mlab import griddata
from urllib.error import HTTPError # recognise the error stemming from missing data
#import urllib
import urllib.request
t3pa2cls_XII - upravena fce energy(a, b, c, t, ToT, pocet_udalosti, RowNo, ClmNo) - nyni je se pocita i s pripadem "nan" t3pa2cls_XV_pc - zkousim vyzobat vysoke energie (jednotlive interakce) - funkce single_interaction. Dale delam prumernou velikost stopy stopy interakce pro danou energii - funkce size_of_interactions_average. Dale delam spektra 2 casti vyboje podle zadaneho casu - primarne pro double breakdown, tj. funkce energy_spectra_doublebreakdown
#Define an exception which will be raised if the data is missing and stop the notebook execution
class StopExecution(Exception):
def _render_traceback_(self):
pass
#shot_no = 44395 #test discharge for which the notebook will definitely work
shot_no = 44849
shot = shot_no
identifier='H03-W0051_shot_'+str(shot)+'_450V'
detector = 'H03-W0051'
ds = np.DataSource('/tmp') # temporary storage for downloaded files
scalars_URL = 'http://golem.fjfi.cvut.cz/shots/{shot_no}/Diagnostics/PlasmaDetection/Results/{name}'
def get_scalar(shot_no, name):
return float(ds.open(scalars_URL.format(shot_no=shot_no, name=name)).read())
t_plasma_start = get_scalar(shot_no, 't_plasma_start')
t_plasma_end = get_scalar(shot_no, 't_plasma_end')
is_plasma = get_scalar(shot_no, 'b_plasma')
def get_file(shot, identifier):
#Pick the discharge to analyse
URL = 'http://golem.fjfi.cvut.cz/shots/{shot}/Diagnostics/TimepixDetector/H03/{identifier}.t3pa'
url = URL.format(shot=shot, identifier=identifier)
try:
file_name_t3pa=url
with urllib.request.urlopen(file_name_t3pa) as ft3pa:
line = ft3pa.readline()
line = line.decode('utf‐8')
ft3pa.close
except HTTPError:
print('File not found at %s. Aborting notebook execution.' % url)
raise StopExecution
return file_name_t3pa
def get_file_calib(name_calib):
#Pick the discharge to analyse
URL = 'http://golem.fjfi.cvut.cz/shots/{shot}/Diagnostics/TimepixDetector/calib_matrix_H03/{name_calib}.txt'
url = URL.format(shot=shot, name_calib=name_calib)
#print(url)
try:
file_calib=url
with urllib.request.urlopen(file_calib) as calib:
line = calib.readline()
line = line.decode('utf‐8')
calib.close
except HTTPError:
print('File not found at %s. Aborting notebook execution.' % url)
raise StopExecution
return file_calib
def load_calib(file_calib):
with urllib.request.urlopen(file_calib) as fc:
calib=[] #vytvoreni 1D pole
for i in range(0,256): #tj. rozsah 0-255
temp = [] # docasne pole
for j in range(0,256):
temp.append(0) #naplneni docasneho pole 0
calib.append(temp) #naplneni pole a[] docasnym polem temp
for i in range(0,256): #nacteni calib matice do pole calib
line = fc.readline()
line = line.decode('utf‐8')
word=line.strip().split(' ')
for j in range(0,256):
#calib[i][j]=float(word[j]) #i = radek, j = sloupec0
calib[j][i]=float(word[j]) #j = radek, i = sloupec0 - pouze pro stavajici kalibraci - verze XV
fc.close
return calib
def load_t3pa_file(file_t3pa):
index=[]
matrix_index=[]
ToA=[]
ToT=[]
FToA=[]
overflow=[]
pocet_udalosti = 0
with urllib.request.urlopen(file_t3pa) as ft3pa:
line = ft3pa.readline()
line = line.decode('utf‐8')
while True:
line = ft3pa.readline()
line = line.decode('utf‐8')
word=line.strip().split('\t') #v t3pa souboru je oddelovac \t
if line == '':
break
index.append(word[0])
matrix_index.append(word[1])
ToA.append(float(word[2]))
ToT.append(float(word[3]))
FToA.append(float(word[4]))
overflow.append(float(word[5]))
pocet_udalosti = pocet_udalosti + 1
ft3pa.close
return index, matrix_index, ToA, ToT, FToA, overflow, pocet_udalosti
def noise(index, matrix_index, ToA, ToT, FToA, overflow, pocet_udalosti): #tuto fci nemus9m explicitn2 volat - volam ji v fci load_t3pa
pocet=int(0) #pocet sumicich pixelu
konst=int(len(index)/1000)+1
noise_matrix_index=[]
for i in range(0,konst):
pom = [] # pomocne pole
k=0 #pomocna promenna - udava, kolik je v czklu ve skutecnosti udalosti - aby nebyla chyba 'list index out of range'
for j in range(0,1001):
if i*1000+j>=len(index):
break
pom.append(matrix_index[i*1000+j])
k=k+1
for m in range(0,k):
count=int(0) #pocet vvyskytu stejneho matrix index behem 1000 udalosti
index_=int(-1) #budu testovat, jestli pixel na ktery koukam je sumici (abych ho nezapocital 2x)
for p in range(0,pocet):
#index=int(p)
if pom[m]==noise_matrix_index[p]:
index_=p #pixel na ktery jsem uz koukal a byl sumici
break
if index_ >=0 and pom[m]==noise_matrix_index[index_]:
continue
for l in range(0,k):
if pom[m]==pom[l]:
count=count+1
####podminka na sumici pixely
if count>=50: #kdyz se pixel vyskytne behem tisice udalosti vicekrat nez toto cislo, je sumici
noise_matrix_index.append(pom[m])
#noise_matrix_index[pocet]=pom[i]
pocet=pocet+1
pom.clear()
pocet_udalosti=len(index)
for n in range (0,pocet_udalosti):
for o in range(0,len(noise_matrix_index)):
if n >=pocet_udalosti:
break
if(matrix_index[n]==noise_matrix_index[o]):
del matrix_index[n]
del index[n]
del ToA[n]
del ToT[n]
del FToA[n]
del overflow[n]
pocet_udalosti=pocet_udalosti-1
continue
return pocet_udalosti,index, matrix_index, ToA, ToT, FToA, overflow
def t3pa_data(pocet_udalosti,index, matrix_index, ToA, ToT, FToA, overflow):
#rovnou vyhodim sumici pixely
pocet_udalosti,index, matrix_index, ToA, ToT, FToA, overflow=noise(index, matrix_index, ToA, ToT, FToA, overflow, pocet_udalosti)
RowNo=[]
ClmNo=[]
for i in range(0,len(matrix_index)):
#RowNo.append(int(int(matrix_index[i]))//int(256))
#ClmNo.append(int(int(matrix_index[i]))%int(256))
ClmNo.append(int(int(matrix_index[i]))//int(256)) #ver XV - bude pro novou kalibraci - nyn9 to bere 3patnou kalibraci jednotlivych pixelu (cislovani radku a sloupcu stejne jako v pixetu)
RowNo.append(int(int(matrix_index[i]))%int(256)) ##ver XV - bude super pro novou kalibraci - odpovida radkum a sloupcum v pixetu. Nyni bere spatne kalibrace pixelu (viz fce load_calib)
return index, matrix_index, ToA, ToT, FToA, overflow, pocet_udalosti, RowNo, ClmNo
def hit_map(detector,hit_map_fig,RowNo,ClmNo):
plt.hist2d(RowNo,ClmNo,bins=(256,256),cmap='Blues')
cb=plt.colorbar()
cb.set_label('Counts in pixel')
plt.xlabel('x [pixel]')
plt.ylabel('y [pixel]')
plt.title(detector)
plt.savefig(hit_map_fig, dpi = 1000)
return
def energy(a, b, c, t, ToT, pocet_udalosti, RowNo, ClmNo):
E=[] #energy in keV
#for i in range (0,pocet_udalosti):
pom=0
for i in range (0,len(ToT)):
Sqrt=float(0.0)
e1=float(0.0)
e2=float(0.0)
# promenna sqrt je vnitrek odmocniny
Sqrt = (((float(b[RowNo[i]][ClmNo[i]])+float(a[RowNo[i]][ClmNo[i]])*float(t[RowNo[i]][ClmNo[i]])-float(ToT[i])))*(((float(b[RowNo[i]][ClmNo[i]])+float(a[RowNo[i]][ClmNo[i]])*float(t[RowNo[i]][ClmNo[i]])-float(ToT[i])))) + (float(4)*float(a[RowNo[i]][ClmNo[i]])*float(c[RowNo[i]][ClmNo[i]]))) #zmena oproti verzi VI
if float(Sqrt)<float(0):
E.append(float(0))
else:
'''
V kalibracni matici a se obcas vyskytne 0 -> ve vypoctu energie
je tim padem deleni nulou -> energie diverguje. Jak to vyresit?
zatim polozim energii = 0 (kdyz a=0), pak se uvidi
nakonec udelam limitu vyrazu energie pro a->0 (L'hopital)
'''
if a[RowNo[i]][ClmNo[i]]==0:
e1=((float(t[RowNo[i]][ClmNo[i]]))/float(2)) + ((((float(b[RowNo[i]][ClmNo[i]])+float(a[RowNo[i]][ClmNo[i]])*float(t[RowNo[i]][ClmNo[i]])-float(ToT[i]))*(float(t[RowNo[i]][ClmNo[i]]))) - 2*(float(c[RowNo[i]][ClmNo[i]])))/(float(2)*np.sqrt(float(Sqrt))))
e2=((float(t[RowNo[i]][ClmNo[i]]))/float(2)) - ((((float(b[RowNo[i]][ClmNo[i]])+float(a[RowNo[i]][ClmNo[i]])*float(t[RowNo[i]][ClmNo[i]])-float(ToT[i]))*(float(t[RowNo[i]][ClmNo[i]]))) - 2*(float(c[RowNo[i]][ClmNo[i]])))/(float(2)*np.sqrt(float(Sqrt))))
else:
e1=((-(float(b[RowNo[i]][ClmNo[i]]) - (float(a[RowNo[i]][ClmNo[i]])*float(t[RowNo[i]][ClmNo[i]]))-float(ToT[i])))+np.sqrt(float(Sqrt)))/(float(2)*float(a[RowNo[i]][ClmNo[i]]))
e2=((-(float(b[RowNo[i]][ClmNo[i]]) - (float(a[RowNo[i]][ClmNo[i]])*float(t[RowNo[i]][ClmNo[i]]))-float(ToT[i])))-np.sqrt(float(Sqrt)))/(float(2)*float(a[RowNo[i]][ClmNo[i]]))
if a[RowNo[i]][ClmNo[i]]<0:
e1=-1
e2=-1
if math.isnan(e1):
e1=-1
if math.isnan(e2):
e2=-1
if e1<0 and e2<0:
E.append(float(0))
if e1>=0 and e1>e2:
E.append(float(e1))
if e2>=0 and e2>e1:
E.append(float(e2))
if e1>=0 and e2==e1:
E.append(float(e1))
return E
def Time(ToA, FToA, pocet_udalosti, RowNo, ClmNo):
T=[] #time in ns
for i in range (0,pocet_udalosti):
Time=float(0.0)
Time=(float(ToA[i])-((float(FToA[i])/float(16))))*float(25)
T.append(float(Time))
return T
def Timewalk_parameters_Si():
#SI - korekce na TimeWalk - parametry
A = -1.21988
B = 4.33638
C = 29.5075
D = 1
sigma_A=0.7013
sigma_B=0.1366
sigma_C=4.753
sigma_D=0
return A, B, C, D, sigma_A, sigma_B, sigma_C, sigma_D
def Timewalk(E,T):
i=0
A, B, C, D, sigma_A, sigma_B, sigma_C, sigma_D = Timewalk_parameters_Si()
while i < len(T):
timewalk=float(0)
timewalk = (C / (E[i] - B)) + A
if(timewalk<0):
timewalk=0
T[i]=T[i]-timewalk
i=i+1
return E,T
def remove_interactions_with_zero_energy(index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E, T):
i=0
treshold=5.015347
while i < len(T):
if E[i]<treshold: #E[i] < energy treshold
index.pop(i)
matrix_index.pop(i)
ToA.pop(i)
ToT.pop(i)
FToA.pop(i)
overflow.pop(i)
RowNo.pop(i)
ClmNo.pop(i)
E.pop(i)
T.pop(i)
continue
i=i+1
return index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E, T
def clustering_new(index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E, T):
dT=float(50)
indexCl, TCl,ECl, matrix_indexCl, ToACl,ToTCl,FToACl,RowNoCl,ClmNoCl,overflowCl=[],[],[],[],[],[],[],[],[],[]
StartLastElem=len(T)-1
indexCl.append(int(index[StartLastElem]))
TCl.append(float(T[StartLastElem]))
ECl.append(float(E[StartLastElem]))
matrix_indexCl.append(int(matrix_index[StartLastElem]))
RowNoCl.append(int(RowNo[StartLastElem]))
ClmNoCl.append(int(ClmNo[StartLastElem]))
ToACl.append(float(ToA[StartLastElem]))
ToTCl.append(float(ToT[StartLastElem]))
FToACl.append(float(FToA[StartLastElem]))
overflowCl.append(float(overflow[StartLastElem]))
del index[StartLastElem]
del T[StartLastElem]
del E[StartLastElem]
del matrix_index[StartLastElem]
del RowNo[StartLastElem]
del ClmNo[StartLastElem]
del ToA[StartLastElem]
del ToT[StartLastElem]
del FToA[StartLastElem]
del overflow[StartLastElem]
j=1
pom=float(TCl[0]+dT)
while(j >0):
if(len(T) == 0):
break
k=0
j=0
while (k<=(len(TCl)-1)):
i=len(T)-1
if(len(T) == 0):
break
pocet_sousedu=0 #pocet sousednich pixelu - mohou byt maximalne 4
delka=0
# verze X
count=0 #pomocna promanna, kterou urcuji, ze se ma nasledujici cyklus while projit jeste jednou, pokud je i = -1
while(float(T[i])<=(pom)):
delka=delka+1
if(((((int(RowNoCl[k]))==(int(RowNo[i])+1))or((int(RowNoCl[k]))==(int(RowNo[i])-1))) and ((int(ClmNoCl[k]))==(int(ClmNo[i])))) or (((int(RowNoCl[k]))==(int(RowNo[i]))) and (((int(ClmNoCl[k]))==(int(ClmNo[i])+1))or((int(ClmNoCl[k]))==(int(ClmNo[i])-1))))):
#beru jen pixely, které mají společnou jednu stranu.
#pixely, kter0 spolu sousedí přes roh neuvažuji
indexCl.append(int(index[i]))
TCl.append(float(T[i]))
ECl.append(float(E[i]))
matrix_indexCl.append(int(matrix_index[i]))
RowNoCl.append(int(RowNo[i]))
ClmNoCl.append(int(ClmNo[i]))
ToACl.append(float(ToA[i]))
ToTCl.append(float(ToT[i]))
FToACl.append(float(FToA[i]))
overflowCl.append(float(overflow[i]))
# Removes i-th Row
del index[i]
del T[i]
del E[i]
del matrix_index[i]
del RowNo[i]
del ClmNo[i]
del ToA[i]
del ToT[i]
del FToA[i]
del overflow[i]
j=j+1
i=len(T)-1
pocet_sousedu=pocet_sousedu+1
if(len(T) == 0):
break
if(pocet_sousedu==4):
break
continue
i=i-1
if(i==-1): # verze X
count=count+1
if(i<0 and len(T)>0): # verze X
i=0
if(count>1):
break
if(i>=len(T)):
break
k=k+1
if(len(TCl)>2):
indexCl, TCl, ECl, matrix_indexCl, RowNoCl, ClmNoCl, ToACl, ToTCl, FToACl, overflowCl = insertionSort(indexCl, TCl, ECl, matrix_indexCl, RowNoCl, ClmNoCl, ToACl, ToTCl, FToACl, overflowCl)
return T, indexCl,TCl, ECl, matrix_indexCl, RowNoCl, ClmNoCl, ToACl, ToTCl, FToACl, overflowCl
def insertionSort(indexCl, TCl, ECl, matrix_indexCl, RowNoCl, ClmNoCl, ToACl, ToTCl, FToACl, overflowCl):
# Function to do insertion sort
# Traverse through 1 to len(arr)
for i in range(1, len(TCl)):
key = TCl[i]
# Move elements of arr[0..i-1], that are
# greater than key, to one position ahead
# of their current position
#ostatni
key1 = indexCl[i]
key2 = ECl[i]
key3 = matrix_indexCl[i]
key4 = RowNoCl[i]
key5 = ClmNoCl[i]
key6 = ToACl[i]
key7 = ToTCl[i]
key8 = FToACl[i]
key9 = overflowCl[i]
j = i-1
while j >= 0 and key < TCl[j] :
TCl[j + 1] = TCl[j]
#ostatni
indexCl[j + 1] = indexCl[j]
ECl[j + 1] = ECl[j]
matrix_indexCl[j + 1] = matrix_indexCl[j]
RowNoCl[j + 1] = RowNoCl[j]
ClmNoCl[j + 1] = ClmNoCl[j]
ToACl[j + 1] = ToACl[j]
ToTCl[j + 1] = ToTCl[j]
FToACl[j + 1] = FToACl[j]
overflowCl[j + 1] = overflowCl[j]
j -= 1
TCl[j + 1] = key
#ostatni
indexCl[j + 1] = key1
ECl[j + 1] = key2
matrix_indexCl[j + 1] = key3
RowNoCl[j + 1] =key4
ClmNoCl[j + 1] = key5
ToACl[j + 1] = key6
ToTCl[j + 1] = key7
FToACl[j + 1] = key8
overflowCl [j + 1] = key9
return indexCl, TCl, ECl, matrix_indexCl, RowNoCl, ClmNoCl, ToACl, ToTCl, FToACl, overflowCl
def file_t3pa_cls_new(file_t3pa_cls,T):
with open(file_t3pa_cls, "w", encoding="utf-8") as t3pa_cls:
t3pa_cls.write('%\n')
t3pa_cls.write('% Index Matrix Index [ RowNo, ClmNo ] ToA FToA ( ToA_in_ns ) ToT ( ToT_in_keV ) Overflow\n')
t3pa_cls.write('\n')
i=1
T_first=[]
E_tot=[]
N_tot=[]
eventNo=0 #for high_energy_event function
while(len(T) > 0):
T, indexCl,TCl, ECl, matrix_indexCl, RowNoCl, ClmNoCl, ToACl, ToTCl, FToACl, overflowCl = clustering_new(index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E, T)
Tfirst=float(TCl[0])
Tlast=float(TCl[len(TCl)-1])
dT=Tlast-Tfirst
Etot=float(0)
for k in range(0,len(TCl)):
Etot=Etot+float(ECl[k])
T_first.append(float(Tfirst))
dT=Tlast-Tfirst
E_tot.append(float(Etot))
N_tot.append(len(TCl)) #new in ver. XV
t3pa_cls.write('# '+str(i)+', Nunmasked = '+str(len(TCl))+', Nmasked = 0, Ntot = '+str(len(TCl))+'\n')
t3pa_cls.write('# Tfirst = '+str(Tfirst)+' ns, Tlast = '+str(Tlast)+' ns, dT = '+str(dT)+' ns, Etot = '+str(Etot)+' keV\n')
for j in range(0,len(TCl)):
t3pa_cls.write(str(indexCl[j])+' '+str(matrix_indexCl[j])+' [ '+str(RowNoCl[j])+', '+str(ClmNoCl[j])+' ] '+str(ToACl[j])+' '+str(FToACl[j])+' ( '+str(TCl[j])+' ns ) '+str(ToTCl[j])+' ( '+str(ECl[j])+' keV ) '+str(overflowCl[j])+'\n')
t3pa_cls.write('\n')
#eventNo=single_interaction(eventNo,Etot, Tfirst, ECl, TCl, RowNoCl, ClmNoCl,path)
i=i+1
t3pa_cls.close
return T_first, E_tot, N_tot
def energy_spectrum_in_time(Tfirst, Etot): #dela histogram - energie zaznamenana v case
pom = 0
dt=100 #(ns) time width of 1 bin
T_first=0 #cas, kdy prisel trigger a yacalo mereni
T_last=(max(Tfirst)) #posledni z Tfirst
Delta_T = T_last - T_first
poc = int(int(Delta_T) / float(dt)) + 1 #pocet casovych oken
T_int_first=[] #cas
E=[] #energie
for i in range(0,poc):
T_int_first.append((i*dt) + dt/2)
E.append(0)
#XII
for j in range(0,len(Tfirst)):
time_index=0
time_index=int(((Tfirst[j]-T_first)/dt))
if float(Tfirst[j]-T_first) >= (T_int_first[time_index] - dt / 2) and float(Tfirst[j]-T_first) < (T_int_first[time_index] + dt / 2):
E[time_index]=float(E[time_index])+float(Etot[j])
pom=pom+1
for l in range(0,len(T_int_first)):
T_int_first[l]=T_int_first[l]+T_first
caption, T_int_first = energy_in_time_hist(T_int_first, E, figure_E_in_time_hist, t_plasma_start, t_plasma_end, is_plasma, dt)
return dt, caption, T_int_first, E
def energy_in_time_hist(T_int_first, E,figure_E_in_time_hist, t_plasma_start, t_plasma_end, is_plasma, dt):
plt.rcParams.update({'font.size': 20})
fig, ax = plt.subplots(figsize =(10, 7))
for k in range(0,len(T_int_first)):
T_int_first[k] = T_int_first[k] / 1000000
plt.plot(T_int_first, E, drawstyle='steps-mid')
plt.title(detector+', #'+str(shot_no))
plt.xlabel('Time [ms]')
plt.ylabel('Energy [keV]')
if is_plasma == 1:
for t in (t_plasma_start, t_plasma_end):
plt.axvline(t, color='k', linestyle='--')
plt.xlim([0, (t_plasma_start + t_plasma_end)])
else:
plt.xlim(0,)
plt.ylim(0,) #10 000 keV
plt.savefig(figure_E_in_time_hist, dpi = 1000)
caption = '# x = time in ms, count = energy in keV, dT= '+str(dt)+' ns'
return caption, T_int_first
def hits_in_time_hist_new(T, dt, t_plasma_start, t_plasma_end, is_plasma,figure_count_in_time_hist):
pom = 0
T_first=0 #cas, kdy prisel trigger a yacalo mereni
T_last=(max(T)) #posledni z Tfirst
Delta_T = T_last - T_first
poc = int(int(Delta_T) / float(dt)) + 1 #pocet casovych oken
T_hit=[] #cas
count=[] #energie
for i in range(0,poc):
T_hit.append((i*dt) + dt/2)
count.append(0)
for j in range(0,len(T)):
time_index=0
time_index=int(((T[j]-T_first)/dt))
k=time_index
for j in range(0,len(T)):
time_index=0
time_index=int(((T[j]-T_first)/dt))
if float(T[j]-T_first) >= (T_hit[time_index] - dt / 2) and float(T[j]-T_first) < (T_hit[time_index] + dt / 2):
count[time_index] = count[time_index] + 1
pom=pom+1
for l in range(0,len(T_hit)):
T_hit[l]=T_hit[l]+T_first
plt.rcParams.update({'font.size': 20})
fig, ax = plt.subplots(figsize =(10, 7))
for k in range(0,len(T_hit)):
T_hit[k] = T_hit[k] / 1000000
#plt.plot(T_hit, count)
plt.plot(T_hit, count, drawstyle='steps-mid')
plt.title(detector+', #'+str(shot_no))
plt.xlabel('Time [ms]')
plt.ylabel('Count')
if is_plasma == 1:
for t in (t_plasma_start, t_plasma_end):
plt.axvline(t, color='k', linestyle='--')
plt.xlim([0, (t_plasma_start + t_plasma_end)])
else:
plt.xlim(0,)
plt.ylim(0,) #10 000 keV
plt.savefig(figure_count_in_time_hist, dpi = 1000)
caption = '# x = time in ms, dT= '+str(dt)+' ns'
return caption, T_hit,count
def energy_spectrum(Etot):
E_min=0
dE=5 #keV
E_max=max(Etot)
pocet=(E_max//dE) + 3
pocet=int(pocet)
E_max=float(dE*pocet)
xle=[]
xre=[]
xmean=[]
for p in range (0,pocet):
xle.append(E_min + (p * (E_max - E_min)) / pocet)
xre.append(xle[p]+dE)
xmean.append((xle[p] + xre[p]) / 2)
count=[]
for l in range(0,pocet):
count.append(0)
#XII
for i in range(0,len(Etot)):
E_index=int(((Etot[i]-E_min)/dE))
if ((xle[E_index] <= Etot[i]) and (Etot[i] < xre[E_index])):
count[E_index]=count[E_index]+1
plt.rcParams.update({'font.size': 20})
fig, ax = plt.subplots(figsize =(10, 7))
#ax.hist(Etot, bins = xle)
plt.fill_between(xmean, count,step='mid') #pre mid post
plt.plot(xmean, count, drawstyle='steps-mid')
plt.title(detector+', #'+str(shot_no))
plt.xlabel('Energy [keV]')
plt.ylabel('Count')
plt.xlim(0,)
ax.set_yscale('log') #log scale y
caption = '# x = energy in keV, dE= '+str(dE)+' keV'
plt.savefig(figure_E_hist, dpi = 1000)
return caption, xmean,count, xle, Etot
def hist_file(file_hist, xmean, count, caption ):
with open(file_hist, "w", encoding="utf-8") as hist:
hist.write('#\n')
hist.write('#'+str(caption)+'\n')
hist.write('# x_mean count\n')
hist.write('\n')
for m in range(0,len(xmean)):
hist.write(str(xmean[m])+' '+str(count[m])+'\n')
hist.close
return T_first, E_tot
def multiplot(icon_fig, x1,y1,x2,y2):
plt.rcParams.update({'font.size': 20})
fig, ax = plt.subplots(nrows=2,figsize =(10, 7))
ax[0].plot(x1, y1, drawstyle='steps-mid')
ax[0].set_xlabel('Time [ms]')
ax[0].set_ylabel('Energy [keV]')
if is_plasma == 1:
for t in (t_plasma_start, t_plasma_end):
ax[0].axvline(t, color='k', linestyle='--')
ax[0].set_xlim([0, (t_plasma_start + t_plasma_end)])
else:
ax[0].set_xlim(0,)
ax[0].set_ylim(0,) #keV
#ax[1].hist(y2, bins = x2)
ax[1].fill_between(x2, y2,step='mid') #pre mid post
ax[1].plot(x2, y2, drawstyle='steps-mid')
ax[1].set_xlabel('Energy [keV]')
ax[1].set_ylabel('Count')
ax[1].set_xlim(0,)
#ax[1].set_ylim(0,)
ax[1].set_yscale('log') #log scale y
fig.subplots_adjust(hspace=0.3)
plt.savefig(icon_fig, dpi = 1000)
return
def single_interaction(eventNo,Etot, Tfirst, ECl, TCl, RowNoCl, ClmNoCl,path): # ver XV
#tuto funkci volam ve funkci file_t3pa_cls_new(file_t3pa_cls,T):
#This function is calling in function file_t3pa_cls_new(file_t3pa_cls,T)
high_E = 1500 #[keV] - zadani, jaka energie je pro me vysoka
if(Etot>=high_E or len(ECl)>15):
#if (len(ECl)>15): #len(ECl) = pocet pixelu dane interakce
print("Total energy of track: "+str(Etot)+" keV\n")
A, B, C, D, sigma_A, sigma_B, sigma_C, sigma_D = Timewalk_parameters_Si()
######################
#SI - rekonstrukce z(t) - parametry
a=0.0193947
b=-0.0273934
sigma_a=0.0004163
sigma_b=0.009832
#######################
time=[]
sigma_time=[]
time_min = []
time_max=[]
z_rec=[]
z_rec_min=[]
z_rec_max=[]
sigma_z_rec=[]
for i in range(0, len(TCl)):
time.append(TCl[i] - Tfirst)
#chyba urceni casu = chyba timewalk ->
sigma_time.append(np.sqrt(((sigma_C / (pow((ECl[i] - B), D)))*(sigma_C / (pow((ECl[i] - B), D)))) + (((sigma_B*C*D) / (pow((ECl[i] - B), (D + 1))))*((sigma_B*C*D) / (pow((ECl[i] - B), (D + 1))))) + (((sigma_D*C*math.log(ECl[i] - B)) / (pow((ECl[i] - B), D)))* ((sigma_D*C*math.log(ECl[i] - B)) / (pow((ECl[i] - B), D)))) + (sigma_A*sigma_A)))
time_min.append(time[i] - sigma_time[i])
time_max.append(time[i] + sigma_time[i])
#//
#//rekonstrukce hloubky interakce
z_rec.append(a * time[i] + (b))
sigma_z_rec.append(np.sqrt(((time[i]*time[i])*(sigma_a*sigma_a)) + (sigma_b*sigma_b) + (a*a)*(sigma_time[i]*sigma_time[i])))
z_rec_min.append(z_rec[i] - sigma_z_rec[i])
z_rec_max.append(z_rec[i] + sigma_z_rec[i])
#//
single_interaction_file=str(path)+'event'+str(eventNo)+'.txt'
single_interaction_2D_fig=str(path)+'2D_event'+str(eventNo)+'.png'
single_interaction_3D_fig=str(path)+'3D_event'+str(eventNo)+'.png'
with open(single_interaction_file, "w", encoding="utf-8") as f:
f.write('#\n')
f.write('# x_mean y_mean z_rec z_rec_min z_rec_max sigma_z_rec\n')
f.write('#E_tot='+str(Etot)+'\n')
f.write('\n')
for m in range(0,len(TCl)):
#print(str(RowNoCl[m])+' '+str(ClmNoCl[m])+' '+str(z_rec[m])+' '+str(z_rec_min[m])+' '+str(z_rec_max[m])+' '+str(sigma_z_rec[m])+' '+str(ECl[m])+'\n')
f.write(str(RowNoCl[m])+' '+str(ClmNoCl[m])+' '+str(z_rec[m])+' '+str(z_rec_min[m])+' '+str(z_rec_max[m])+' '+str(sigma_z_rec[m])+' '+str(ECl[m])+'\n')
f.close
############################### plot
#binwidth=1
if ((max(RowNoCl)-min(RowNoCl))>=(max(ClmNoCl)-min(ClmNoCl))):
rang=max(RowNoCl)-min(RowNoCl)
#bins=(range((min(RowNoCl)-1), (max(RowNoCl)+3), binwidth), range((min(ClmNoCl)-1), (min(ClmNoCl)+rang+3), binwidth))
x_min=min(RowNoCl)-1
x_max=max(RowNoCl)+2
y_min=min(ClmNoCl)-1
y_max=min(ClmNoCl)+rang+2
else:
rang = max(ClmNoCl)-min(ClmNoCl)
#bins=(range((min(RowNoCl)-1), (min(RowNoCl)+rang+3), binwidth), range((min(ClmNoCl)-1), (max(ClmNoCl)+3), binwidth))
x_min=min(RowNoCl)-1
x_max=min(RowNoCl)+rang+2
y_min=min(ClmNoCl)-1
y_max=max(ClmNoCl)+2
###############$$$$$$$$$$$$$$$$$$$$
rows, cols = (x_max-x_min, x_max-x_min)
#arrECl = [[0]*cols]*rows
arrECl= [[0] * cols for _ in range(rows)]
for i in range (x_min,x_max):
for j in range (y_min,y_max):
for k in range(0,len(RowNoCl)):
if ((i==RowNoCl[k]) and (j==ClmNoCl[k])):
#print(str(i)+" "+str(j)+" "+str(RowNoCl[k])+" "+str(ClmNoCl[k])+"\n")
arrECl[i-x_min][j-y_min]=ECl[k]
arrECl=np.transpose(arrECl)
arrECl[arrECl == 0] = np.nan
#2D plot
plt.imshow(arrECl,cmap='jet', interpolation='none', origin=[(x_min-0.2),(y_min-0.2)], aspect='equal', extent=[x_min-0.2,x_max,y_min-0.2,y_max])
###############$$$$$$$$$$$$$$$$$$$$
cb=plt.colorbar(pad=0.005)
plt.tick_params(axis="x",direction="in")
plt.tick_params(axis="y",direction="in")
cb.ax.tick_params(axis='y', direction='in')
cb.set_label('Energy in pixel [keV]')
plt.xlabel('x [pixel]')
plt.ylabel('y [pixel]')
plt.title('$E_{tot}$ = '+str(round(Etot, 2))+' keV, $N_{tot}$ = '+str(len(ECl)))
plt.savefig(single_interaction_2D_fig, dpi = 1000)
plt.show()
plt.close()
############################### plot
############## 3D plot
# Creating figure
fig = plt.figure(figsize = (16, 9))
ax = plt.axes(projection ="3d")
# Add x, y gridlines
ax.grid(b = True, color ='grey', #
linestyle ='-.', linewidth = 0.3,
alpha = 0.2)
# Creating plot
sctt = ax.scatter3D(RowNoCl, ClmNoCl, z_rec,
alpha = 0.8,
c = ECl,
cmap = 'jet',
s = 4000, #size of bubbles in plot
marker ='o')
plt.title('$E_{tot}$ = '+str(round(Etot, 2))+' keV, $N_{tot}$ = '+str(len(ECl)))
ax.set_xlabel('x [pixel]', fontweight ='bold')
ax.set_ylabel('y [pixel]', fontweight ='bold')
ax.set_zlabel('z [mm]', fontweight ='bold')
cb=fig.colorbar(sctt, ax = ax, shrink = 0.5,aspect = 10,pad=0.00005) #
cb.ax.tick_params(axis='y', direction='in')
cb.set_label('Energy in pixel [keV]', fontweight ='bold')
plt.savefig(single_interaction_3D_fig, dpi = 1000)
# show plot
plt.show()
plt.close()
############## 3D plot
eventNo=eventNo+1
return eventNo
def size_of_interactions_average(Etot, Ntot,file_hist): #ver XV
E_min=0
dE=5 #keV
E_max=max(Etot)
pocet=(E_max//dE) + 3
pocet=int(pocet)
E_max=float(dE*pocet)
xle=[]
xre=[]
xmean=[]
count=[]
nop=[] #number of pixels
nop_mean=[] #mean number of pixels in dE
sigma=[] #root mean square error of the mean - stredni kvadraticka chyba prumeru
for p in range (0,pocet):
xle.append(E_min + (p * (E_max - E_min)) / pocet)
xre.append(xle[p]+dE)
xmean.append((xle[p] + xre[p]) / 2)
count.append(0)
nop.append(0)
nop_mean.append(0)
sigma.append(0)
#XII
for i in range(0,len(Etot)):
E_index=int(((Etot[i]-E_min)/dE))
if ((xle[E_index] <= Etot[i]) and (Etot[i] < xre[E_index])):
count[E_index]=count[E_index]+1
nop[E_index]=nop[E_index]+Ntot[i] #ver XV
for l in range(0,pocet):
if nop[l]!=0:
nop_mean[l]=float(nop[l])/float(count[l])
#####Computing sigma
for i in range(0,len(Etot)):
E_index=int(((Etot[i]-E_min)/dE))
if ((xle[E_index] <= Etot[i]) and (Etot[i] < xre[E_index])):
if nop_mean[E_index]!=0:
sigma[E_index]=sigma[E_index]+((float(Ntot[i])-float(nop_mean[E_index]))*(float(Ntot[i])-float(nop_mean[E_index])))
for l in range(0,pocet):
if nop[l]!=0 and count[l]>1:
sigma[l]=np.sqrt(sigma[l]/(float(count[l])*(float(count[l])-1)))
if nop[l]!=0 and count[l]==1:
sigma[l]=10
#####Computing sigma
#####write to file
with open(file_hist, "w", encoding="utf-8") as hist:
hist.write('# x_mean [keV] mean_size_of_interaction [pixel] sigma_mean_size_of_interaction\n')
for m in range(0,len(xmean)):
hist.write(str(xmean[m])+' '+str(nop_mean[m])+' '+str(sigma[m])+'\n')
hist.close
#####write to file
plt.rcParams.update({'font.size': 20})
fig, ax = plt.subplots(figsize =(10, 7))
#plt.fill_between(xmean, nop,step='mid',color='blue', alpha=0.3) #pre mid post
#plt.fill_between(xmean, nop,step='mid') #pre mid post
plt.plot(xmean, nop_mean, drawstyle='steps-mid')
plt.errorbar(xmean, nop_mean, yerr = sigma,fmt ='.', linewidth=0.7)
plt.title(detector+', #'+str(shot_no))
plt.xlabel('Energy [keV]')
plt.ylabel('Average size of interaction [pixel]')
plt.xlim(0,500)
plt.ylim(0,17)
#ax.set_yscale('log') #log scale y
caption = '# x = energy in keV, dE= '+str(dE)+' keV'
plt.savefig(figure_size_interaction, dpi = 1000)
return
def energy_spectra_doublebreakdown(Etot, Tfirst, file_hist):
#this function separates discharge into two parts acording to time Tsep and creates energy spectrum for each part.
#This is for discharges with double brakdown
Tsep=14636000 # [ns]
E_min=0
dE=5 #keV
E_max=max(Etot)
pocet=(E_max//dE) + 3
pocet=int(pocet)
E_max=float(dE*pocet)
xle=[]
xre=[]
xmean=[]
for p in range (0,pocet):
xle.append(E_min + (p * (E_max - E_min)) / pocet)
xre.append(xle[p]+dE)
xmean.append((xle[p] + xre[p]) / 2)
count_first=[]
count_second=[]
for l in range(0,pocet):
count_first.append(0)
count_second.append(0)
#XII
for i in range(0,len(Etot)):
E_index=int(((Etot[i]-E_min)/dE))
if ((xle[E_index] <= Etot[i]) and (Etot[i] < xre[E_index])):
if(Tfirst[i]<Tsep):
count_first[E_index]=count_first[E_index]+1
else:
count_second[E_index]=count_second[E_index]+1
caption = '# x = energy in keV, dE= '+str(dE)+' keV'
with open(file_hist, "w", encoding="utf-8") as hist:
hist.write('#\n')
hist.write('#'+str(caption)+'\n')
hist.write('# x_mean count_before_2nd_breakdown count_2nd_breakdown\n')
hist.write('\n')
for m in range(0,len(xmean)):
hist.write(str(xmean[m])+' '+str(count_first[m])+' '+str(count_second[m])+'\n')
hist.close
plt.rcParams.update({'font.size': 20})
fig, ax = plt.subplots(figsize =(10, 7))
#plt.fill_between(xmean, count_first,step='mid') #pre mid post
plt.plot(xmean, count_first, label='Before 2nd breakdown', drawstyle='steps-mid')
plt.plot(xmean, count_second, label='2nd breakdown', drawstyle='steps-mid')
plt.legend(loc='best')
plt.title(detector+', #'+str(shot_no))
plt.xlabel('Energy [keV]')
plt.ylabel('Count')
plt.xlim(0,500)
ax.set_yscale('log') #log scale y
plt.savefig(figure_energy_spectra_doublebreakdown, dpi = 1000)
return
#soubory, ktere ctu
#read files
t3pa=get_file(shot, identifier)
name_calib='caliba'
caliba=get_file_calib(name_calib)
name_calib='calibb'
calibb=get_file_calib(name_calib)
name_calib='calibc'
calibc=get_file_calib(name_calib)
name_calib='calibt'
calibt=get_file_calib(name_calib)
#vytvorene soubory:
#created files
t3pa_cls= 'H03-W0051_shot_'+str(shot)+'_450V.t3pa_cls'
E_hist= 'H03-W0051_shot_'+str(shot)+'_450V_E_hist.txt'
E_in_time_hist= 'H03-W0051_shot_'+str(shot)+'_450V_discharge_energy.txt'
count_in_time_hist= 'H03-W0051_shot_'+str(shot)+'_450V_discharge_hits.txt'
size_interaction= 'H03-W0051_shot_'+str(shot)+'size_interaction.txt'
file_energy_spectra_doublebreakdown= 'H03-W0051_shot_'+str(shot)+'energy_spectra_doublebreakdown.txt'
#created figures
icon_fig='icon-fig'
figure_E_in_time_hist='discharge_energy'
figure_count_in_time_hist='discharge_hits'
figure_E_hist='Energy_spectrum'
hit_map_fig='hit-map'
figure_size_interaction= 'H03-W0051_shot_'+str(shot)+'size_interaction'
figure_energy_spectra_doublebreakdown= 'H03-W0051_shot_'+str(shot)+'energy_spectra_doublebreakdown'
#nactu jednotlive kalibracni matice - abych to nemusel delat v kazde funkci
a=load_calib(caliba)
b=load_calib(calibb)
c=load_calib(calibc)
t=load_calib(calibt)
#nactu a urcim jednotlive hodnoty - abych to nemusel delat v kazde funkci
index, matrix_index, ToA, ToT, FToA, overflow, pocet_udalosti = load_t3pa_file(t3pa)
index, matrix_index, ToA, ToT, FToA, overflow, pocet_udalosti, RowNo, ClmNo = t3pa_data(pocet_udalosti,index, matrix_index, ToA, ToT, FToA, overflow)
raw data
#hit map
hit_map(detector,hit_map_fig,RowNo,ClmNo)
Energy and time calculation from raw data.
E=energy(a, b, c, t, ToT, pocet_udalosti, RowNo, ClmNo)
T=Time(ToA, FToA, pocet_udalosti, RowNo, ClmNo)
index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E, T = remove_interactions_with_zero_energy(index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E, T)
E,T=Timewalk(E,T)
#sort by time
T, index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E = (list(t) for t in zip(*sorted(zip(T, index, matrix_index, ToA, ToT, FToA, overflow, RowNo, ClmNo, E), reverse=True))) #serazeni od nejvetsiho po nejmensi
T_pom=T.copy()
#save to file
T_first, E_tot, Ntot = file_t3pa_cls_new(t3pa_cls,T)
dt, caption, T_int_first, E = energy_spectrum_in_time(T_first, E_tot)
hist_file(E_in_time_hist, T_int_first, E, caption);
([5545639.278581159, 5602707.8125, 5633865.25494908, 5787878.720405822, 5993552.800852535, 6100875.113944518, 6149118.75, 6176060.5086557735, 6225793.965321171, 6640188.379698239, 7163688.62006106, 7173669.984925613, 7302392.1875, 7362275.0, 7365240.313188071, 7367023.968307481, 7369493.616279009, 7390098.4375, 7403895.283591966, 7456901.567574721, 7480324.139257368, 7772642.564443536, 7868774.953857617, 7877918.557335877, 7880096.247047502, 7880184.507619298, 7881345.3125, 7881722.484354605, 7923857.749135001, 7939480.109131537, 7985740.625, 8052270.779847069, 8062176.106110548, 8074649.502578789, 8100191.273300501, 8120621.187016339, 8121813.427756163, 8160576.5625, 8162359.048233675, 8168448.4375, 8191987.181818524, 8260848.252396287, 8265660.068892887, 8445636.269626847, 8445657.623496514, 8467218.75, 8467221.703965839, 8863026.550572762, 8903756.147758693, 8905079.228707395, 8905997.838156972, 8944553.832184158, 8948596.875, 8968945.767888278, 8971102.61159483, 8971452.408591604, 8972032.8125, 8972107.303948112, 8973317.089044522, 8974370.3125, 8975962.61472381, 8977282.551719725, 8978716.954418976, 8985476.5625, 8989445.536418453, 8989760.9375, 8991933.160724321, 8993181.257945668, 8993528.125, 8993729.80405335, 8998040.347840631, 8998538.499822397, 9018489.060266187, 9023840.02553564, 9036692.553941313, 9039769.895024156, 9042197.97857193, 9047974.84666404, 9049217.039074354, 9054007.077040935, 9061500.357713008, 9062873.869487744, 9063242.1875, 9063252.7349133, 9063551.5625, 9064744.412961181, 9065919.774935786, 9066504.6875, 9067870.3125, 9067899.077971065, 9068188.56724704, 9068431.070294011, 9068642.026329381, 9069235.468374653, 9069780.464815209, 9071292.690149335, 9071415.075605974, 9071562.5, 9071804.503441405, 9071926.5625, 9082383.504242245, 9098594.63947813, 9103327.913652044, 9105736.995260661, 9106511.565300915, 9106809.161432186, 9107362.5, 9110244.644374477, 9110403.092225933, 9110544.457052397, 9113226.208909113, 9115027.443632185, 9115075.0, 9126892.1875, 9127261.975197798, 9127403.125, 9130034.94855855, 9131487.289931372, 9131726.817452658, 9132127.086270146, 9132423.4375, 9132498.755811082, 9142741.354221927, 9147375.011129515, 9151823.012883233, 9154530.968005637, 9156037.790120047, 9162318.75, 9164752.609428477, 9165455.475944798, 9165616.874529682, 9166493.620508753, 9167897.443890281, 9168126.390215587, 9168195.3125, 9170315.4026926, 9173020.652136967, 9174831.881775001, 9176263.92816197, 9180241.326247524, 9181129.516420443, 9181521.655902088, 9181957.8125, 9182015.086689176, 9182210.464236436, 9184399.865318758, 9186614.0625, 9188939.569052342, 9191928.125, 9193191.35497648, 9193631.509306071, 9194533.724385863, 9194859.375, 9195103.125, 9196738.586953975, 9197083.043395318, 9197089.0625, 9197503.836326709, 9197596.686493311, 9198886.373987777, 9199453.125, 9200119.672792422, 9200349.60260518, 9200535.327921081, 9202880.560056437, 9203346.655886615, 9204422.482025992, 9204658.33858408, 9207103.793778278, 9207474.023160264, 9208022.640508385, 9209038.277147055, 9209142.551220281, 9211178.874955982, 9212333.065584738, 9214854.405658253, 9216232.8125, 9217913.942961091, 9217973.942250902, 9237123.684238732, 9238473.10638308, 9238739.995499272, 9238992.461072907, 9240853.125, 9240879.953725658, 9241569.145029465, 9243770.3125, 9246285.9375, 9246637.662231062, 9252771.882716415, 9256333.770437596, 9256676.4852516, 9256686.949558053, 9258271.875, 9258627.202828897, 9261897.895586682, 9262173.117962414, 9264183.885036437, 9265251.5625, 9265757.570173291, 9268121.484578824, 9268789.963534078, 9270333.88215949, 9270651.5625, 9271058.673039284, 9271925.309424985, 9273046.880009979, 9274059.62071671, 9274425.0, 9274449.311186068, 9274490.8443953, 9275119.213932045, 9275126.141544417, 9275635.9375, 9276130.784357795, 9276775.0, 9277231.25, 9277417.557021292, 9280121.411104461, 9280510.455480628, 9283038.902260197, 9283243.793624267, 9284050.229875477, 9284310.9375, 9284766.706107792, 9285231.54905242, 9285486.062142732, 9286044.970769724, 9286069.59856635, 9286142.286264941, 9286146.57935851, 9286221.875, 9286247.161055397, 9286279.451073451, 9286389.788104264, 9286714.162767973, 9286980.281882435, 9287068.75, 9287278.125, 9287305.647142889, 9287444.57231467, 9287448.457839033, 9287468.007387577, 9287489.04827617, 9287747.535846038, 9287764.0625, 9287917.022219645, 9288083.377668122, 9288104.838688128, 9288223.926688083, 9288573.601067174, 9288654.999001274, 9289514.0625, 9293205.646499712, 9294909.977907812, 9295268.465547383, 9296062.320133721, 9296079.6875, 9297188.278267799, 9297406.554551926, 9297430.286765566, 9297624.390373738, 9298104.42547105, 9298459.375, 9301498.372937696, 9301792.470206417, 9302669.660748005, 9303039.542098796, 9303632.942407146, 9303756.11069969, 9304861.837985072, 9305092.213258253, 9305399.099349719, 9305694.458729139, 9309874.491138563, 9310099.214561388, 9310182.35461395, 9310253.125, 9310553.583047286, 9310887.432767726, 9310888.41518996, 9311077.27856058, 9311107.446211144, 9318199.643923314, 9324941.021067826, 9325757.654973803, 9325972.983390389, 9326100.00619422, 9327097.767560774, 9328060.9375, 9328238.0226751, 9328329.6875, 9328501.973924534, 9330582.821449844, 9330792.1875, 9332026.350274067, 9333427.500112245, 9338903.125, 9339581.288995624, 9340506.816310825, 9341096.905844724, 9341688.32592134, 9341724.057840334, 9341857.611364584, 9342005.351072097, 9342483.422068324, 9342596.525364522, 9342615.353610795, 9342697.79967758, 9343385.9375, 9344082.8125, 9344641.629539879, 9344990.334590925, 9345058.054889843, 9345307.8125, 9345639.769283857, 9345850.700050646, 9346091.676702322, 9346250.0, 9346435.9375, 9346645.21543306, 9346725.0, 9346733.362866383, 9347152.930549521, 9349040.639757745, 9349081.17827909, 9349813.778673848, 9350685.63427462, 9351488.177412085, 9352193.807490021, 9352525.144077653, 9354524.469906406, 9354595.3125, 9354606.198823303, 9355089.889554769, 9355115.625, 9355695.3125, 9355953.459340302, 9356701.851375403, 9356715.279386949, 9356720.018077677, 9358290.920296341, 9358323.346965399, 9358395.355265213, 9366360.461957514, 9371996.321812365, 9372638.575968573, 9372704.6875, 9373358.731642375, 9374420.76774822, 9374781.25, 9374839.856953302, 9375735.309255337, 9377106.391616626, 9377126.5625, 9377934.375, 9378642.745952614, 9383318.16726788, 9391990.386039542, 9392808.08869764, 9398042.1875, 9403450.0, 9405041.23951731, 9405289.44312433, 9409654.093835138, 9442540.950434497, 9848723.4375, 9860492.507397948, 9862228.125, 9862762.5, 9864132.62607556, 9864137.5, 9866062.5, 9867990.089901438, 9869234.907586569, 9879781.678534042, 9881491.456044847, 9881693.411416018, 9881859.09321189, 9884733.587199802, 9886426.5625, 9886617.400861707, 9887491.953627044, 9889923.151358556, 9889988.746763812, 9891630.907953495, 9893021.186557774, 9893287.5, 9893494.827694917, 9897222.45803388, 9897865.078561172, 9898004.294942854, 9903760.9375, 9903829.081502808, 9904200.58941203, 9904646.22906417, 9905607.545572065, 9909227.754954873, 9914217.765365582], [25.758812301713867, 49.24567074555878, 7.0274594254924185, 12.206150159825155, 14.7003792860864, 11.310605942468893, 102.1647086111246, 60.543803642821295, 7.683017532022856, 201.11610819728418, 72.65316502648514, 34.466818664485054, 99.50380904526325, 65.60022191719034, 13.872795541674533, 20.757242517991422, 41.645696149441214, 32.760762110785016, 9.307078832422494, 39.84251724904152, 22.042611374073886, 17.53555295785385, 18.469811608027083, 77.78400537413856, 5.886523660574854, 64.38347213858701, 33.83175854973306, 17.915374550376537, 50.68482350119122, 11.857570737540907, 31.48053659682611, 65.0298820712676, 12.282083140648759, 86.50774666569697, 91.8936292745974, 10.199344305910733, 93.20117398758734, 74.42004888482889, 106.79328774555992, 71.10437722178676, 34.89151953478552, 25.338402823206984, 5.492358801870856, 9.628964782780272, 6.243610857981969, 45.103685204021765, 10.870494455363728, 5.6133846375087995, 41.85729908016238, 31.968477676232652, 8.87130485688446, 18.55551990148817, 56.55448756990774, 17.016915006114584, 7.42753483669082, 72.84844415387857, 71.34619164330968, 13.302685290297386, 14.579068355210227, 35.83113844585952, 28.983739628080897, 50.65323351064749, 43.95924707073661, 76.34263518675243, 11.496723445090234, 70.21496586594586, 5.3539973531073075, 11.140149148144411, 58.165748810077446, 11.314908963996228, 7.505978283017717, 26.283279760361015, 28.481021595564734, 10.30430978875307, 19.6914751442767, 60.755713208479214, 13.43995774682706, 25.82426016273613, 128.49281583376472, 19.427113124588132, 33.45351320343226, 54.202967184563356, 44.69378251860255, 10.568208411022773, 65.86487699415197, 12.350543662114855, 58.15349400860726, 39.63774689035421, 30.076429791595555, 14.512011246449726, 30.04366723325674, 25.41940042448521, 59.24720515237021, 12.133372671537984, 19.05286204354938, 27.23686559702445, 29.972598807090687, 52.83398950108459, 14.283493031052773, 82.90068082045875, 86.56860317221727, 19.924879582694864, 6.240860321442046, 21.445952731210607, 40.82408122366001, 14.185516845241796, 58.80734258869283, 76.40654548535043, 27.892364691119386, 90.62550452046742, 42.334546806819944, 68.16845886665072, 49.01127974969071, 53.735120899533214, 66.7037497846134, 45.19622592573236, 30.381164344409463, 40.28422637568724, 63.02795614533678, 12.058612838456543, 48.88604089780936, 11.664579416811845, 48.181315923580414, 6.76573052551966, 46.70687008439391, 23.98349611004708, 17.69737087068355, 30.225669850100985, 8.031537363691596, 23.86948798434389, 23.66101303760456, 7.087823354621632, 88.0381526657218, 10.868685955329559, 112.96043429602037, 51.83798561475497, 9.636103752145432, 25.416140248997444, 31.844794632750578, 91.22539016607578, 43.526825281433844, 46.34145136954126, 33.68910891572327, 21.119256797155995, 5.120514875357994, 26.120186522102568, 39.46434250640537, 9.799894459347248, 40.240491126113525, 29.677123070263434, 98.85124271172793, 10.24320306838182, 49.01654954604721, 46.38495891030361, 5.060349614685074, 9.5345795295803, 66.8058595586005, 54.71482976463613, 19.73003494047876, 95.13708805775421, 31.624550063754363, 20.204145709011883, 13.616125162021815, 61.01888027234641, 12.83429197704904, 14.167319539656141, 29.22889552331435, 23.832684294492555, 66.55794275276314, 76.8573271603281, 40.16703944072357, 10.088068142030192, 11.748165027046234, 18.854757921329735, 45.06686130006993, 89.60005544106795, 63.445150668371326, 14.504651730385339, 5.48385625367631, 69.18518212710856, 23.361240481552468, 56.837006446001794, 8.436746981887936, 60.36700770795788, 26.048009167102716, 9.689359607271179, 39.23828981940375, 71.07736122579146, 15.598144386183257, 8.290662114411274, 7.990811912863228, 14.65502839798056, 68.42934581210963, 29.691267729388986, 267.8873940651144, 6.659934489528636, 23.504343450671808, 6.99834810390216, 59.10275824671642, 8.162457427319758, 22.66059190469416, 72.20925721659373, 13.345697053133184, 44.193982440890025, 18.251444518384556, 46.07949366021909, 5.29124203745419, 15.968787071547728, 60.128332204734754, 8.809793047189633, 13.140365929260465, 17.063644345627605, 10.527844117020964, 96.77856406925945, 20.009369748477898, 163.64038782449632, 35.79690088829017, 77.45925925355391, 152.77196119040084, 40.522754699443176, 18.051685163496693, 36.48888453783438, 9.533645784022728, 64.65206117322435, 167.63082822104715, 37.09646688433533, 5.950334167059745, 23.23193957693793, 16.3451518597736, 22.699259657523125, 70.30501283394224, 40.42465788671679, 62.0424959006896, 67.28721611129049, 18.68286391254834, 9.417649288655571, 17.822455338873617, 84.20897382369924, 72.08736427954356, 6.027573523401806, 28.956224320565163, 11.159647538201192, 7.929381792565186, 9.319405012468252, 8.669960970055469, 49.0515392666055, 10.878830306366494, 57.56892248816696, 98.79005337402452, 9.78238494912436, 15.60389011746445, 7.719926650072814, 30.96233581851076, 7.9912926816267245, 38.431298801495544, 37.425848017616076, 10.857740133334435, 94.6679158916822, 21.281065845085884, 18.30994471569672, 8.63111961697178, 37.04661734282891, 24.24819713110497, 35.67894092061677, 14.701008733380755, 11.600348265425996, 73.76485390902928, 9.772763467493977, 27.49321766180411, 26.046155955733152, 96.58520803253295, 17.14017010202482, 78.94383257247553, 24.168444475594992, 65.0425787910246, 12.60683968840569, 21.923754593624324, 62.92708008811772, 17.0314213844106, 27.261730511799154, 10.247112514805139, 18.61660198252292, 22.93938048984048, 23.05992759271692, 16.701694280970493, 62.444886454947884, 10.485070119705162, 160.87731276975705, 72.54776179263267, 96.86299618032137, 7.26597687521102, 62.17166254514802, 11.838053848337589, 14.626294679464417, 30.563112643941494, 24.940651878225626, 90.1784747508161, 31.894392929572856, 31.414562477561326, 18.06102767832786, 15.060392973599503, 38.92155786204725, 9.917480553092108, 31.27970350445803, 12.351873617863825, 81.57027093643808, 38.37794315235571, 10.728446555155777, 22.405079205307764, 37.18868039674859, 73.65312279208834, 43.719387042475454, 23.87403044071612, 9.545126914512545, 66.70667929206482, 41.4848042267817, 83.39693910093035, 42.15725349888365, 63.054860127480985, 88.77301098441248, 29.07507090886731, 55.65072077131286, 12.112738970121686, 53.510956916218355, 9.343912931706114, 51.2418778562059, 24.979270093502816, 67.36147396685583, 18.354408397233673, 19.256247158676686, 93.58417925581598, 40.74276703994276, 36.26608154908419, 7.5848322289201775, 61.68915366015178, 43.89318879298977, 28.535704406833293, 11.69386857331176, 16.170125978132454, 13.769744945022433, 16.72635237414078, 28.14655345996667, 26.854062557564653, 15.107054816319634, 94.03470720702273, 10.360694524918303, 8.951317246608646, 33.28417791453305, 18.46581867110853, 8.54294435323504, 95.78107938510962, 6.174804644770016, 20.302564855432724, 8.362913776181179, 40.211207095624204, 62.191091362740664, 18.072401092231782, 87.45459212226888, 24.563060607026806, 11.588727908146675, 41.55012642282165, 90.3481605845219, 24.23342338381694, 55.736999766619086, 7.995750724153718, 8.466511580352421, 78.08644861284905, 8.463313435981473, 48.12946354735187, 56.09317937353728, 7.537174657561656, 37.83119465788363, 57.10813994611805, 10.383025415559619, 52.01153768153368, 11.870826732330888, 30.719953265861214, 21.901703352646276, 30.493898552269204, 50.86042903890433, 37.579474801071356, 12.225898366091933, 27.681763856827132, 13.952574813310243, 55.9317037617642, 13.780513174027066, 66.56904642670288, 32.1748642219886, 10.445991598416112, 9.878375079283071, 13.200635316171498, 60.04462797109528, 50.19894364783351, 48.577197886324164, 17.79188888131399, 53.406610845572125, 24.182588314980684, 16.341739847011887, 7.282117998295218])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([5545639.278581159, 5602707.8125, 5633865.25494908, 5787878.720405822, 5993552.800852535, 6100875.113944518, 6149118.75, 6176060.5086557735, 6225793.965321171, 6640188.379698239, 7163688.62006106, 7173669.984925613, 7302392.1875, 7362275.0, 7365240.313188071, 7367023.968307481, 7369493.616279009, 7390098.4375, 7403895.283591966, 7456901.567574721, 7480324.139257368, 7772642.564443536, 7868774.953857617, 7877918.557335877, 7880096.247047502, 7880184.507619298, 7881345.3125, 7881722.484354605, 7923857.749135001, 7939480.109131537, 7985740.625, 8052270.779847069, 8062176.106110548, 8074649.502578789, 8100191.273300501, 8120621.187016339, 8121813.427756163, 8160576.5625, 8162359.048233675, 8168448.4375, 8191987.181818524, 8260848.252396287, 8265660.068892887, 8445636.269626847, 8445657.623496514, 8467218.75, 8467221.703965839, 8863026.550572762, 8903756.147758693, 8905079.228707395, 8905997.838156972, 8944553.832184158, 8948596.875, 8968945.767888278, 8971102.61159483, 8971452.408591604, 8972032.8125, 8972107.303948112, 8973317.089044522, 8974370.3125, 8975962.61472381, 8977282.551719725, 8978716.954418976, 8985476.5625, 8989445.536418453, 8989760.9375, 8991933.160724321, 8993181.257945668, 8993528.125, 8993729.80405335, 8998040.347840631, 8998538.499822397, 9018489.060266187, 9023840.02553564, 9036692.553941313, 9039769.895024156, 9042197.97857193, 9047974.84666404, 9049217.039074354, 9054007.077040935, 9061500.357713008, 9062873.869487744, 9063242.1875, 9063252.7349133, 9063551.5625, 9064744.412961181, 9065919.774935786, 9066504.6875, 9067870.3125, 9067899.077971065, 9068188.56724704, 9068431.070294011, 9068642.026329381, 9069235.468374653, 9069780.464815209, 9071292.690149335, 9071415.075605974, 9071562.5, 9071804.503441405, 9071926.5625, 9082383.504242245, 9098594.63947813, 9103327.913652044, 9105736.995260661, 9106511.565300915, 9106809.161432186, 9107362.5, 9110244.644374477, 9110403.092225933, 9110544.457052397, 9113226.208909113, 9115027.443632185, 9115075.0, 9126892.1875, 9127261.975197798, 9127403.125, 9130034.94855855, 9131487.289931372, 9131726.817452658, 9132127.086270146, 9132423.4375, 9132498.755811082, 9142741.354221927, 9147375.011129515, 9151823.012883233, 9154530.968005637, 9156037.790120047, 9162318.75, 9164752.609428477, 9165455.475944798, 9165616.874529682, 9166493.620508753, 9167897.443890281, 9168126.390215587, 9168195.3125, 9170315.4026926, 9173020.652136967, 9174831.881775001, 9176263.92816197, 9180241.326247524, 9181129.516420443, 9181521.655902088, 9181957.8125, 9182015.086689176, 9182210.464236436, 9184399.865318758, 9186614.0625, 9188939.569052342, 9191928.125, 9193191.35497648, 9193631.509306071, 9194533.724385863, 9194859.375, 9195103.125, 9196738.586953975, 9197083.043395318, 9197089.0625, 9197503.836326709, 9197596.686493311, 9198886.373987777, 9199453.125, 9200119.672792422, 9200349.60260518, 9200535.327921081, 9202880.560056437, 9203346.655886615, 9204422.482025992, 9204658.33858408, 9207103.793778278, 9207474.023160264, 9208022.640508385, 9209038.277147055, 9209142.551220281, 9211178.874955982, 9212333.065584738, 9214854.405658253, 9216232.8125, 9217913.942961091, 9217973.942250902, 9237123.684238732, 9238473.10638308, 9238739.995499272, 9238992.461072907, 9240853.125, 9240879.953725658, 9241569.145029465, 9243770.3125, 9246285.9375, 9246637.662231062, 9252771.882716415, 9256333.770437596, 9256676.4852516, 9256686.949558053, 9258271.875, 9258627.202828897, 9261897.895586682, 9262173.117962414, 9264183.885036437, 9265251.5625, 9265757.570173291, 9268121.484578824, 9268789.963534078, 9270333.88215949, 9270651.5625, 9271058.673039284, 9271925.309424985, 9273046.880009979, 9274059.62071671, 9274425.0, 9274449.311186068, 9274490.8443953, 9275119.213932045, 9275126.141544417, 9275635.9375, 9276130.784357795, 9276775.0, 9277231.25, 9277417.557021292, 9280121.411104461, 9280510.455480628, 9283038.902260197, 9283243.793624267, 9284050.229875477, 9284310.9375, 9284766.706107792, 9285231.54905242, 9285486.062142732, 9286044.970769724, 9286069.59856635, 9286142.286264941, 9286146.57935851, 9286221.875, 9286247.161055397, 9286279.451073451, 9286389.788104264, 9286714.162767973, 9286980.281882435, 9287068.75, 9287278.125, 9287305.647142889, 9287444.57231467, 9287448.457839033, 9287468.007387577, 9287489.04827617, 9287747.535846038, 9287764.0625, 9287917.022219645, 9288083.377668122, 9288104.838688128, 9288223.926688083, 9288573.601067174, 9288654.999001274, 9289514.0625, 9293205.646499712, 9294909.977907812, 9295268.465547383, 9296062.320133721, 9296079.6875, 9297188.278267799, 9297406.554551926, 9297430.286765566, 9297624.390373738, 9298104.42547105, 9298459.375, 9301498.372937696, 9301792.470206417, 9302669.660748005, 9303039.542098796, 9303632.942407146, 9303756.11069969, 9304861.837985072, 9305092.213258253, 9305399.099349719, 9305694.458729139, 9309874.491138563, 9310099.214561388, 9310182.35461395, 9310253.125, 9310553.583047286, 9310887.432767726, 9310888.41518996, 9311077.27856058, 9311107.446211144, 9318199.643923314, 9324941.021067826, 9325757.654973803, 9325972.983390389, 9326100.00619422, 9327097.767560774, 9328060.9375, 9328238.0226751, 9328329.6875, 9328501.973924534, 9330582.821449844, 9330792.1875, 9332026.350274067, 9333427.500112245, 9338903.125, 9339581.288995624, 9340506.816310825, 9341096.905844724, 9341688.32592134, 9341724.057840334, 9341857.611364584, 9342005.351072097, 9342483.422068324, 9342596.525364522, 9342615.353610795, 9342697.79967758, 9343385.9375, 9344082.8125, 9344641.629539879, 9344990.334590925, 9345058.054889843, 9345307.8125, 9345639.769283857, 9345850.700050646, 9346091.676702322, 9346250.0, 9346435.9375, 9346645.21543306, 9346725.0, 9346733.362866383, 9347152.930549521, 9349040.639757745, 9349081.17827909, 9349813.778673848, 9350685.63427462, 9351488.177412085, 9352193.807490021, 9352525.144077653, 9354524.469906406, 9354595.3125, 9354606.198823303, 9355089.889554769, 9355115.625, 9355695.3125, 9355953.459340302, 9356701.851375403, 9356715.279386949, 9356720.018077677, 9358290.920296341, 9358323.346965399, 9358395.355265213, 9366360.461957514, 9371996.321812365, 9372638.575968573, 9372704.6875, 9373358.731642375, 9374420.76774822, 9374781.25, 9374839.856953302, 9375735.309255337, 9377106.391616626, 9377126.5625, 9377934.375, 9378642.745952614, 9383318.16726788, 9391990.386039542, 9392808.08869764, 9398042.1875, 9403450.0, 9405041.23951731, 9405289.44312433, 9409654.093835138, 9442540.950434497, 9848723.4375, 9860492.507397948, 9862228.125, 9862762.5, 9864132.62607556, 9864137.5, 9866062.5, 9867990.089901438, 9869234.907586569, 9879781.678534042, 9881491.456044847, 9881693.411416018, 9881859.09321189, 9884733.587199802, 9886426.5625, 9886617.400861707, 9887491.953627044, 9889923.151358556, 9889988.746763812, 9891630.907953495, 9893021.186557774, 9893287.5, 9893494.827694917, 9897222.45803388, 9897865.078561172, 9898004.294942854, 9903760.9375, 9903829.081502808, 9904200.58941203, 9904646.22906417, 9905607.545572065, 9909227.754954873, 9914217.765365582], [25.758812301713867, 49.24567074555878, 7.0274594254924185, 12.206150159825155, 14.7003792860864, 11.310605942468893, 102.1647086111246, 60.543803642821295, 7.683017532022856, 201.11610819728418, 72.65316502648514, 34.466818664485054, 99.50380904526325, 65.60022191719034, 13.872795541674533, 20.757242517991422, 41.645696149441214, 32.760762110785016, 9.307078832422494, 39.84251724904152, 22.042611374073886, 17.53555295785385, 18.469811608027083, 77.78400537413856, 5.886523660574854, 64.38347213858701, 33.83175854973306, 17.915374550376537, 50.68482350119122, 11.857570737540907, 31.48053659682611, 65.0298820712676, 12.282083140648759, 86.50774666569697, 91.8936292745974, 10.199344305910733, 93.20117398758734, 74.42004888482889, 106.79328774555992, 71.10437722178676, 34.89151953478552, 25.338402823206984, 5.492358801870856, 9.628964782780272, 6.243610857981969, 45.103685204021765, 10.870494455363728, 5.6133846375087995, 41.85729908016238, 31.968477676232652, 8.87130485688446, 18.55551990148817, 56.55448756990774, 17.016915006114584, 7.42753483669082, 72.84844415387857, 71.34619164330968, 13.302685290297386, 14.579068355210227, 35.83113844585952, 28.983739628080897, 50.65323351064749, 43.95924707073661, 76.34263518675243, 11.496723445090234, 70.21496586594586, 5.3539973531073075, 11.140149148144411, 58.165748810077446, 11.314908963996228, 7.505978283017717, 26.283279760361015, 28.481021595564734, 10.30430978875307, 19.6914751442767, 60.755713208479214, 13.43995774682706, 25.82426016273613, 128.49281583376472, 19.427113124588132, 33.45351320343226, 54.202967184563356, 44.69378251860255, 10.568208411022773, 65.86487699415197, 12.350543662114855, 58.15349400860726, 39.63774689035421, 30.076429791595555, 14.512011246449726, 30.04366723325674, 25.41940042448521, 59.24720515237021, 12.133372671537984, 19.05286204354938, 27.23686559702445, 29.972598807090687, 52.83398950108459, 14.283493031052773, 82.90068082045875, 86.56860317221727, 19.924879582694864, 6.240860321442046, 21.445952731210607, 40.82408122366001, 14.185516845241796, 58.80734258869283, 76.40654548535043, 27.892364691119386, 90.62550452046742, 42.334546806819944, 68.16845886665072, 49.01127974969071, 53.735120899533214, 66.7037497846134, 45.19622592573236, 30.381164344409463, 40.28422637568724, 63.02795614533678, 12.058612838456543, 48.88604089780936, 11.664579416811845, 48.181315923580414, 6.76573052551966, 46.70687008439391, 23.98349611004708, 17.69737087068355, 30.225669850100985, 8.031537363691596, 23.86948798434389, 23.66101303760456, 7.087823354621632, 88.0381526657218, 10.868685955329559, 112.96043429602037, 51.83798561475497, 9.636103752145432, 25.416140248997444, 31.844794632750578, 91.22539016607578, 43.526825281433844, 46.34145136954126, 33.68910891572327, 21.119256797155995, 5.120514875357994, 26.120186522102568, 39.46434250640537, 9.799894459347248, 40.240491126113525, 29.677123070263434, 98.85124271172793, 10.24320306838182, 49.01654954604721, 46.38495891030361, 5.060349614685074, 9.5345795295803, 66.8058595586005, 54.71482976463613, 19.73003494047876, 95.13708805775421, 31.624550063754363, 20.204145709011883, 13.616125162021815, 61.01888027234641, 12.83429197704904, 14.167319539656141, 29.22889552331435, 23.832684294492555, 66.55794275276314, 76.8573271603281, 40.16703944072357, 10.088068142030192, 11.748165027046234, 18.854757921329735, 45.06686130006993, 89.60005544106795, 63.445150668371326, 14.504651730385339, 5.48385625367631, 69.18518212710856, 23.361240481552468, 56.837006446001794, 8.436746981887936, 60.36700770795788, 26.048009167102716, 9.689359607271179, 39.23828981940375, 71.07736122579146, 15.598144386183257, 8.290662114411274, 7.990811912863228, 14.65502839798056, 68.42934581210963, 29.691267729388986, 267.8873940651144, 6.659934489528636, 23.504343450671808, 6.99834810390216, 59.10275824671642, 8.162457427319758, 22.66059190469416, 72.20925721659373, 13.345697053133184, 44.193982440890025, 18.251444518384556, 46.07949366021909, 5.29124203745419, 15.968787071547728, 60.128332204734754, 8.809793047189633, 13.140365929260465, 17.063644345627605, 10.527844117020964, 96.77856406925945, 20.009369748477898, 163.64038782449632, 35.79690088829017, 77.45925925355391, 152.77196119040084, 40.522754699443176, 18.051685163496693, 36.48888453783438, 9.533645784022728, 64.65206117322435, 167.63082822104715, 37.09646688433533, 5.950334167059745, 23.23193957693793, 16.3451518597736, 22.699259657523125, 70.30501283394224, 40.42465788671679, 62.0424959006896, 67.28721611129049, 18.68286391254834, 9.417649288655571, 17.822455338873617, 84.20897382369924, 72.08736427954356, 6.027573523401806, 28.956224320565163, 11.159647538201192, 7.929381792565186, 9.319405012468252, 8.669960970055469, 49.0515392666055, 10.878830306366494, 57.56892248816696, 98.79005337402452, 9.78238494912436, 15.60389011746445, 7.719926650072814, 30.96233581851076, 7.9912926816267245, 38.431298801495544, 37.425848017616076, 10.857740133334435, 94.6679158916822, 21.281065845085884, 18.30994471569672, 8.63111961697178, 37.04661734282891, 24.24819713110497, 35.67894092061677, 14.701008733380755, 11.600348265425996, 73.76485390902928, 9.772763467493977, 27.49321766180411, 26.046155955733152, 96.58520803253295, 17.14017010202482, 78.94383257247553, 24.168444475594992, 65.0425787910246, 12.60683968840569, 21.923754593624324, 62.92708008811772, 17.0314213844106, 27.261730511799154, 10.247112514805139, 18.61660198252292, 22.93938048984048, 23.05992759271692, 16.701694280970493, 62.444886454947884, 10.485070119705162, 160.87731276975705, 72.54776179263267, 96.86299618032137, 7.26597687521102, 62.17166254514802, 11.838053848337589, 14.626294679464417, 30.563112643941494, 24.940651878225626, 90.1784747508161, 31.894392929572856, 31.414562477561326, 18.06102767832786, 15.060392973599503, 38.92155786204725, 9.917480553092108, 31.27970350445803, 12.351873617863825, 81.57027093643808, 38.37794315235571, 10.728446555155777, 22.405079205307764, 37.18868039674859, 73.65312279208834, 43.719387042475454, 23.87403044071612, 9.545126914512545, 66.70667929206482, 41.4848042267817, 83.39693910093035, 42.15725349888365, 63.054860127480985, 88.77301098441248, 29.07507090886731, 55.65072077131286, 12.112738970121686, 53.510956916218355, 9.343912931706114, 51.2418778562059, 24.979270093502816, 67.36147396685583, 18.354408397233673, 19.256247158676686, 93.58417925581598, 40.74276703994276, 36.26608154908419, 7.5848322289201775, 61.68915366015178, 43.89318879298977, 28.535704406833293, 11.69386857331176, 16.170125978132454, 13.769744945022433, 16.72635237414078, 28.14655345996667, 26.854062557564653, 15.107054816319634, 94.03470720702273, 10.360694524918303, 8.951317246608646, 33.28417791453305, 18.46581867110853, 8.54294435323504, 95.78107938510962, 6.174804644770016, 20.302564855432724, 8.362913776181179, 40.211207095624204, 62.191091362740664, 18.072401092231782, 87.45459212226888, 24.563060607026806, 11.588727908146675, 41.55012642282165, 90.3481605845219, 24.23342338381694, 55.736999766619086, 7.995750724153718, 8.466511580352421, 78.08644861284905, 8.463313435981473, 48.12946354735187, 56.09317937353728, 7.537174657561656, 37.83119465788363, 57.10813994611805, 10.383025415559619, 52.01153768153368, 11.870826732330888, 30.719953265861214, 21.901703352646276, 30.493898552269204, 50.86042903890433, 37.579474801071356, 12.225898366091933, 27.681763856827132, 13.952574813310243, 55.9317037617642, 13.780513174027066, 66.56904642670288, 32.1748642219886, 10.445991598416112, 9.878375079283071, 13.200635316171498, 60.04462797109528, 50.19894364783351, 48.577197886324164, 17.79188888131399, 53.406610845572125, 24.182588314980684, 16.341739847011887, 7.282117998295218])
caption, T_hit,count1 = hits_in_time_hist_new(T_pom, dt, t_plasma_start, t_plasma_end, is_plasma, figure_count_in_time_hist)
hist_file(count_in_time_hist, T_hit, count1, caption);
([5545639.278581159, 5602707.8125, 5633865.25494908, 5787878.720405822, 5993552.800852535, 6100875.113944518, 6149118.75, 6176060.5086557735, 6225793.965321171, 6640188.379698239, 7163688.62006106, 7173669.984925613, 7302392.1875, 7362275.0, 7365240.313188071, 7367023.968307481, 7369493.616279009, 7390098.4375, 7403895.283591966, 7456901.567574721, 7480324.139257368, 7772642.564443536, 7868774.953857617, 7877918.557335877, 7880096.247047502, 7880184.507619298, 7881345.3125, 7881722.484354605, 7923857.749135001, 7939480.109131537, 7985740.625, 8052270.779847069, 8062176.106110548, 8074649.502578789, 8100191.273300501, 8120621.187016339, 8121813.427756163, 8160576.5625, 8162359.048233675, 8168448.4375, 8191987.181818524, 8260848.252396287, 8265660.068892887, 8445636.269626847, 8445657.623496514, 8467218.75, 8467221.703965839, 8863026.550572762, 8903756.147758693, 8905079.228707395, 8905997.838156972, 8944553.832184158, 8948596.875, 8968945.767888278, 8971102.61159483, 8971452.408591604, 8972032.8125, 8972107.303948112, 8973317.089044522, 8974370.3125, 8975962.61472381, 8977282.551719725, 8978716.954418976, 8985476.5625, 8989445.536418453, 8989760.9375, 8991933.160724321, 8993181.257945668, 8993528.125, 8993729.80405335, 8998040.347840631, 8998538.499822397, 9018489.060266187, 9023840.02553564, 9036692.553941313, 9039769.895024156, 9042197.97857193, 9047974.84666404, 9049217.039074354, 9054007.077040935, 9061500.357713008, 9062873.869487744, 9063242.1875, 9063252.7349133, 9063551.5625, 9064744.412961181, 9065919.774935786, 9066504.6875, 9067870.3125, 9067899.077971065, 9068188.56724704, 9068431.070294011, 9068642.026329381, 9069235.468374653, 9069780.464815209, 9071292.690149335, 9071415.075605974, 9071562.5, 9071804.503441405, 9071926.5625, 9082383.504242245, 9098594.63947813, 9103327.913652044, 9105736.995260661, 9106511.565300915, 9106809.161432186, 9107362.5, 9110244.644374477, 9110403.092225933, 9110544.457052397, 9113226.208909113, 9115027.443632185, 9115075.0, 9126892.1875, 9127261.975197798, 9127403.125, 9130034.94855855, 9131487.289931372, 9131726.817452658, 9132127.086270146, 9132423.4375, 9132498.755811082, 9142741.354221927, 9147375.011129515, 9151823.012883233, 9154530.968005637, 9156037.790120047, 9162318.75, 9164752.609428477, 9165455.475944798, 9165616.874529682, 9166493.620508753, 9167897.443890281, 9168126.390215587, 9168195.3125, 9170315.4026926, 9173020.652136967, 9174831.881775001, 9176263.92816197, 9180241.326247524, 9181129.516420443, 9181521.655902088, 9181957.8125, 9182015.086689176, 9182210.464236436, 9184399.865318758, 9186614.0625, 9188939.569052342, 9191928.125, 9193191.35497648, 9193631.509306071, 9194533.724385863, 9194859.375, 9195103.125, 9196738.586953975, 9197083.043395318, 9197089.0625, 9197503.836326709, 9197596.686493311, 9198886.373987777, 9199453.125, 9200119.672792422, 9200349.60260518, 9200535.327921081, 9202880.560056437, 9203346.655886615, 9204422.482025992, 9204658.33858408, 9207103.793778278, 9207474.023160264, 9208022.640508385, 9209038.277147055, 9209142.551220281, 9211178.874955982, 9212333.065584738, 9214854.405658253, 9216232.8125, 9217913.942961091, 9217973.942250902, 9237123.684238732, 9238473.10638308, 9238739.995499272, 9238992.461072907, 9240853.125, 9240879.953725658, 9241569.145029465, 9243770.3125, 9246285.9375, 9246637.662231062, 9252771.882716415, 9256333.770437596, 9256676.4852516, 9256686.949558053, 9258271.875, 9258627.202828897, 9261897.895586682, 9262173.117962414, 9264183.885036437, 9265251.5625, 9265757.570173291, 9268121.484578824, 9268789.963534078, 9270333.88215949, 9270651.5625, 9271058.673039284, 9271925.309424985, 9273046.880009979, 9274059.62071671, 9274425.0, 9274449.311186068, 9274490.8443953, 9275119.213932045, 9275126.141544417, 9275635.9375, 9276130.784357795, 9276775.0, 9277231.25, 9277417.557021292, 9280121.411104461, 9280510.455480628, 9283038.902260197, 9283243.793624267, 9284050.229875477, 9284310.9375, 9284766.706107792, 9285231.54905242, 9285486.062142732, 9286044.970769724, 9286069.59856635, 9286142.286264941, 9286146.57935851, 9286221.875, 9286247.161055397, 9286279.451073451, 9286389.788104264, 9286714.162767973, 9286980.281882435, 9287068.75, 9287278.125, 9287305.647142889, 9287444.57231467, 9287448.457839033, 9287468.007387577, 9287489.04827617, 9287747.535846038, 9287764.0625, 9287917.022219645, 9288083.377668122, 9288104.838688128, 9288223.926688083, 9288573.601067174, 9288654.999001274, 9289514.0625, 9293205.646499712, 9294909.977907812, 9295268.465547383, 9296062.320133721, 9296079.6875, 9297188.278267799, 9297406.554551926, 9297430.286765566, 9297624.390373738, 9298104.42547105, 9298459.375, 9301498.372937696, 9301792.470206417, 9302669.660748005, 9303039.542098796, 9303632.942407146, 9303756.11069969, 9304861.837985072, 9305092.213258253, 9305399.099349719, 9305694.458729139, 9309874.491138563, 9310099.214561388, 9310182.35461395, 9310253.125, 9310553.583047286, 9310887.432767726, 9310888.41518996, 9311077.27856058, 9311107.446211144, 9318199.643923314, 9324941.021067826, 9325757.654973803, 9325972.983390389, 9326100.00619422, 9327097.767560774, 9328060.9375, 9328238.0226751, 9328329.6875, 9328501.973924534, 9330582.821449844, 9330792.1875, 9332026.350274067, 9333427.500112245, 9338903.125, 9339581.288995624, 9340506.816310825, 9341096.905844724, 9341688.32592134, 9341724.057840334, 9341857.611364584, 9342005.351072097, 9342483.422068324, 9342596.525364522, 9342615.353610795, 9342697.79967758, 9343385.9375, 9344082.8125, 9344641.629539879, 9344990.334590925, 9345058.054889843, 9345307.8125, 9345639.769283857, 9345850.700050646, 9346091.676702322, 9346250.0, 9346435.9375, 9346645.21543306, 9346725.0, 9346733.362866383, 9347152.930549521, 9349040.639757745, 9349081.17827909, 9349813.778673848, 9350685.63427462, 9351488.177412085, 9352193.807490021, 9352525.144077653, 9354524.469906406, 9354595.3125, 9354606.198823303, 9355089.889554769, 9355115.625, 9355695.3125, 9355953.459340302, 9356701.851375403, 9356715.279386949, 9356720.018077677, 9358290.920296341, 9358323.346965399, 9358395.355265213, 9366360.461957514, 9371996.321812365, 9372638.575968573, 9372704.6875, 9373358.731642375, 9374420.76774822, 9374781.25, 9374839.856953302, 9375735.309255337, 9377106.391616626, 9377126.5625, 9377934.375, 9378642.745952614, 9383318.16726788, 9391990.386039542, 9392808.08869764, 9398042.1875, 9403450.0, 9405041.23951731, 9405289.44312433, 9409654.093835138, 9442540.950434497, 9848723.4375, 9860492.507397948, 9862228.125, 9862762.5, 9864132.62607556, 9864137.5, 9866062.5, 9867990.089901438, 9869234.907586569, 9879781.678534042, 9881491.456044847, 9881693.411416018, 9881859.09321189, 9884733.587199802, 9886426.5625, 9886617.400861707, 9887491.953627044, 9889923.151358556, 9889988.746763812, 9891630.907953495, 9893021.186557774, 9893287.5, 9893494.827694917, 9897222.45803388, 9897865.078561172, 9898004.294942854, 9903760.9375, 9903829.081502808, 9904200.58941203, 9904646.22906417, 9905607.545572065, 9909227.754954873, 9914217.765365582], [25.758812301713867, 49.24567074555878, 7.0274594254924185, 12.206150159825155, 14.7003792860864, 11.310605942468893, 102.1647086111246, 60.543803642821295, 7.683017532022856, 201.11610819728418, 72.65316502648514, 34.466818664485054, 99.50380904526325, 65.60022191719034, 13.872795541674533, 20.757242517991422, 41.645696149441214, 32.760762110785016, 9.307078832422494, 39.84251724904152, 22.042611374073886, 17.53555295785385, 18.469811608027083, 77.78400537413856, 5.886523660574854, 64.38347213858701, 33.83175854973306, 17.915374550376537, 50.68482350119122, 11.857570737540907, 31.48053659682611, 65.0298820712676, 12.282083140648759, 86.50774666569697, 91.8936292745974, 10.199344305910733, 93.20117398758734, 74.42004888482889, 106.79328774555992, 71.10437722178676, 34.89151953478552, 25.338402823206984, 5.492358801870856, 9.628964782780272, 6.243610857981969, 45.103685204021765, 10.870494455363728, 5.6133846375087995, 41.85729908016238, 31.968477676232652, 8.87130485688446, 18.55551990148817, 56.55448756990774, 17.016915006114584, 7.42753483669082, 72.84844415387857, 71.34619164330968, 13.302685290297386, 14.579068355210227, 35.83113844585952, 28.983739628080897, 50.65323351064749, 43.95924707073661, 76.34263518675243, 11.496723445090234, 70.21496586594586, 5.3539973531073075, 11.140149148144411, 58.165748810077446, 11.314908963996228, 7.505978283017717, 26.283279760361015, 28.481021595564734, 10.30430978875307, 19.6914751442767, 60.755713208479214, 13.43995774682706, 25.82426016273613, 128.49281583376472, 19.427113124588132, 33.45351320343226, 54.202967184563356, 44.69378251860255, 10.568208411022773, 65.86487699415197, 12.350543662114855, 58.15349400860726, 39.63774689035421, 30.076429791595555, 14.512011246449726, 30.04366723325674, 25.41940042448521, 59.24720515237021, 12.133372671537984, 19.05286204354938, 27.23686559702445, 29.972598807090687, 52.83398950108459, 14.283493031052773, 82.90068082045875, 86.56860317221727, 19.924879582694864, 6.240860321442046, 21.445952731210607, 40.82408122366001, 14.185516845241796, 58.80734258869283, 76.40654548535043, 27.892364691119386, 90.62550452046742, 42.334546806819944, 68.16845886665072, 49.01127974969071, 53.735120899533214, 66.7037497846134, 45.19622592573236, 30.381164344409463, 40.28422637568724, 63.02795614533678, 12.058612838456543, 48.88604089780936, 11.664579416811845, 48.181315923580414, 6.76573052551966, 46.70687008439391, 23.98349611004708, 17.69737087068355, 30.225669850100985, 8.031537363691596, 23.86948798434389, 23.66101303760456, 7.087823354621632, 88.0381526657218, 10.868685955329559, 112.96043429602037, 51.83798561475497, 9.636103752145432, 25.416140248997444, 31.844794632750578, 91.22539016607578, 43.526825281433844, 46.34145136954126, 33.68910891572327, 21.119256797155995, 5.120514875357994, 26.120186522102568, 39.46434250640537, 9.799894459347248, 40.240491126113525, 29.677123070263434, 98.85124271172793, 10.24320306838182, 49.01654954604721, 46.38495891030361, 5.060349614685074, 9.5345795295803, 66.8058595586005, 54.71482976463613, 19.73003494047876, 95.13708805775421, 31.624550063754363, 20.204145709011883, 13.616125162021815, 61.01888027234641, 12.83429197704904, 14.167319539656141, 29.22889552331435, 23.832684294492555, 66.55794275276314, 76.8573271603281, 40.16703944072357, 10.088068142030192, 11.748165027046234, 18.854757921329735, 45.06686130006993, 89.60005544106795, 63.445150668371326, 14.504651730385339, 5.48385625367631, 69.18518212710856, 23.361240481552468, 56.837006446001794, 8.436746981887936, 60.36700770795788, 26.048009167102716, 9.689359607271179, 39.23828981940375, 71.07736122579146, 15.598144386183257, 8.290662114411274, 7.990811912863228, 14.65502839798056, 68.42934581210963, 29.691267729388986, 267.8873940651144, 6.659934489528636, 23.504343450671808, 6.99834810390216, 59.10275824671642, 8.162457427319758, 22.66059190469416, 72.20925721659373, 13.345697053133184, 44.193982440890025, 18.251444518384556, 46.07949366021909, 5.29124203745419, 15.968787071547728, 60.128332204734754, 8.809793047189633, 13.140365929260465, 17.063644345627605, 10.527844117020964, 96.77856406925945, 20.009369748477898, 163.64038782449632, 35.79690088829017, 77.45925925355391, 152.77196119040084, 40.522754699443176, 18.051685163496693, 36.48888453783438, 9.533645784022728, 64.65206117322435, 167.63082822104715, 37.09646688433533, 5.950334167059745, 23.23193957693793, 16.3451518597736, 22.699259657523125, 70.30501283394224, 40.42465788671679, 62.0424959006896, 67.28721611129049, 18.68286391254834, 9.417649288655571, 17.822455338873617, 84.20897382369924, 72.08736427954356, 6.027573523401806, 28.956224320565163, 11.159647538201192, 7.929381792565186, 9.319405012468252, 8.669960970055469, 49.0515392666055, 10.878830306366494, 57.56892248816696, 98.79005337402452, 9.78238494912436, 15.60389011746445, 7.719926650072814, 30.96233581851076, 7.9912926816267245, 38.431298801495544, 37.425848017616076, 10.857740133334435, 94.6679158916822, 21.281065845085884, 18.30994471569672, 8.63111961697178, 37.04661734282891, 24.24819713110497, 35.67894092061677, 14.701008733380755, 11.600348265425996, 73.76485390902928, 9.772763467493977, 27.49321766180411, 26.046155955733152, 96.58520803253295, 17.14017010202482, 78.94383257247553, 24.168444475594992, 65.0425787910246, 12.60683968840569, 21.923754593624324, 62.92708008811772, 17.0314213844106, 27.261730511799154, 10.247112514805139, 18.61660198252292, 22.93938048984048, 23.05992759271692, 16.701694280970493, 62.444886454947884, 10.485070119705162, 160.87731276975705, 72.54776179263267, 96.86299618032137, 7.26597687521102, 62.17166254514802, 11.838053848337589, 14.626294679464417, 30.563112643941494, 24.940651878225626, 90.1784747508161, 31.894392929572856, 31.414562477561326, 18.06102767832786, 15.060392973599503, 38.92155786204725, 9.917480553092108, 31.27970350445803, 12.351873617863825, 81.57027093643808, 38.37794315235571, 10.728446555155777, 22.405079205307764, 37.18868039674859, 73.65312279208834, 43.719387042475454, 23.87403044071612, 9.545126914512545, 66.70667929206482, 41.4848042267817, 83.39693910093035, 42.15725349888365, 63.054860127480985, 88.77301098441248, 29.07507090886731, 55.65072077131286, 12.112738970121686, 53.510956916218355, 9.343912931706114, 51.2418778562059, 24.979270093502816, 67.36147396685583, 18.354408397233673, 19.256247158676686, 93.58417925581598, 40.74276703994276, 36.26608154908419, 7.5848322289201775, 61.68915366015178, 43.89318879298977, 28.535704406833293, 11.69386857331176, 16.170125978132454, 13.769744945022433, 16.72635237414078, 28.14655345996667, 26.854062557564653, 15.107054816319634, 94.03470720702273, 10.360694524918303, 8.951317246608646, 33.28417791453305, 18.46581867110853, 8.54294435323504, 95.78107938510962, 6.174804644770016, 20.302564855432724, 8.362913776181179, 40.211207095624204, 62.191091362740664, 18.072401092231782, 87.45459212226888, 24.563060607026806, 11.588727908146675, 41.55012642282165, 90.3481605845219, 24.23342338381694, 55.736999766619086, 7.995750724153718, 8.466511580352421, 78.08644861284905, 8.463313435981473, 48.12946354735187, 56.09317937353728, 7.537174657561656, 37.83119465788363, 57.10813994611805, 10.383025415559619, 52.01153768153368, 11.870826732330888, 30.719953265861214, 21.901703352646276, 30.493898552269204, 50.86042903890433, 37.579474801071356, 12.225898366091933, 27.681763856827132, 13.952574813310243, 55.9317037617642, 13.780513174027066, 66.56904642670288, 32.1748642219886, 10.445991598416112, 9.878375079283071, 13.200635316171498, 60.04462797109528, 50.19894364783351, 48.577197886324164, 17.79188888131399, 53.406610845572125, 24.182588314980684, 16.341739847011887, 7.282117998295218])
Detected energies during the discharge + Energy spectrum
multiplot(icon_fig, T_int_first,E,xmean,count)
size_of_interactions_average(Etot, Ntot,size_interaction)
#energy_spectra_doublebreakdown(Etot, T_first, file_energy_spectra_doublebreakdown)