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 = 44599
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
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
RowNo.append(int(int(matrix_index[i]))%int(256)) #ver XV
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);
([3729867.1875, 3788101.2837620764, 4012558.0502643143, 4022565.625, 4106335.22221119, 4182978.336228519, 4265722.703530869, 4352284.375, 4355400.0, 4359378.134685804, 4364937.5, 4418551.351269708, 4491585.9375, 4493854.068841211, 4529280.0287171565, 4584833.364847206, 4594862.871696943, 4635724.496047908, 4654000.094058011, 4674056.129313759, 4679893.768508722, 4822240.625, 4881565.531402745, 4908404.50759934, 4924610.337585828, 4936292.470751891, 4963296.129658594, 4968187.543641707, 5021064.187293005, 5196312.5, 5214875.833752954, 5214885.073693647, 5280816.502587391, 6216215.210911921, 6247917.974927701, 6310838.58780523, 6335389.0625, 6534883.507557046, 6541931.548711659, 6569237.5, 6604594.381074746, 6607985.84571539, 6611758.471078174, 6621001.974402585, 6626375.0, 6629790.249359538, 6637679.910942651, 6643753.158373484, 6656396.90228357, 6704582.794100096, 6704853.125, 6705006.068848153, 6728433.955345273, 6737259.121526126, 6762773.358210365, 6768989.295958388, 6796675.0, 6857099.59041109, 6858006.25, 6874620.335049611, 6899247.658756435, 6901838.546410034, 6929525.0, 6955889.0625, 6986520.648014259, 7037993.553475978, 7043620.3125, 7046845.3125, 7052423.4375, 7054072.10022303, 7055508.967715464, 7056045.79052249, 7056149.323362388, 7057001.5625, 7057584.375, 7057629.6875, 7058209.457818814, 7058675.0, 7062059.375, 7062921.38854688, 7064500.7869273, 7064501.280615501, 7107384.375, 7114647.033289047, 7116049.9717114195, 7116689.662933082, 7117673.341117493, 7117800.0, 7118397.941214256, 7121067.1875, 7122071.306206591, 7122756.037047909, 7133709.375, 7137130.580029226, 7142200.163460185, 7156582.84480983, 7171639.0625, 7177410.282298777, 7182865.625, 7185474.433926217, 7185651.424487245, 7187800.0, 7187884.297886817, 7201736.497544628, 7205012.5, 7220285.9375, 7222196.432655251, 7232408.738945503, 7238920.277816884, 7277857.8125, 7310428.125, 7317201.377465011, 7320939.079563465, 7354927.757948502, 7387567.428964973, 7387583.1157503985, 7388716.162011784, 7388724.133461979, 7402661.292977429, 7417418.657889249, 7439785.123662254, 7476992.500982078, 7479546.290000872, 7495449.4128191825, 7497403.5844547, 7515213.0326365875, 7520738.07766961, 7536028.847292758, 7540821.949945838, 7540916.139716263, 7544568.42256698, 7552787.5, 7552869.840560616, 7559273.4375, 7559279.6875, 7564902.966680552, 7586130.595069913, 7594213.970224923, 7600714.0625, 7642648.537893839, 7673715.625, 7673984.294765548, 7674040.284256197, 7748122.331231109, 7752240.143071506, 7755921.875, 7758691.164018966, 7761253.708678938, 7766458.625428359, 7778350.356647127, 7781931.577905938, 7784309.330980479, 7801606.789680014, 7863601.5625, 7914721.660486327, 7916423.4375, 7929994.550473407, 8035563.58720062, 8075923.434411467, 8104592.28401962, 8153526.5625, 8181540.014414495, 8231823.4375, 8246045.3125, 8274901.746186987, 8320061.242611863, 8367779.367460982, 8402745.168337744, 8428724.88500841, 8441203.48938775, 8477787.5, 8481531.8494904, 8481765.625, 8483795.3125, 8484088.53022165, 8540967.174121471, 8556567.1875, 8559984.375, 8561229.6875, 8562861.339124966, 8600930.109194908, 8608578.592842052, 8612987.78107681, 8623036.192432804, 8631732.8125, 8637452.87390647, 8639593.703331152, 8641359.462651184, 8660708.375884242, 8666126.27899324, 8666150.513483912, 8666851.5625, 8682939.0625, 8686209.375, 8688820.3125, 8689828.125, 8691024.341570295, 8699197.913023962, 8699201.712281968, 8707570.3125, 8708251.892384287, 8711287.051780237, 8711552.693620592, 8711556.867765736, 8713079.61541342, 8715750.0, 8716114.0625, 8717004.901676241, 8717465.518835822, 8722926.5625, 8734667.66057927, 8750166.388515456, 8754586.644580733, 8764371.827896139, 8773223.729837457, 8812405.351556996, 8817950.0, 8825820.137728576, 8841953.125, 8860553.824162269, 8885714.0625, 9036408.421619117, 9045745.3125, 9063534.59877465, 9115060.9375, 9147642.91457798, 9181382.483281333, 9211656.671139384, 9230904.6875, 9233948.203037003, 9233957.11807896, 9267823.4375, 9275234.354839686, 9319290.625, 9328031.25, 9333241.878540516, 9344890.310402218, 9347146.607843742, 9347182.154129168, 9347217.1875, 9362452.981777065, 9366174.09656095, 9367276.034948872, 9368127.45052908, 9402143.641840277, 9403832.98865498, 9434131.938183125, 9457843.539373815, 9483832.27232135, 9493475.0, 9493643.900696704, 9506201.268856088, 9519863.386341838, 9524676.5625, 9535677.254215145, 9539972.293536117, 9548457.590575127, 9552898.079058709, 9560562.2650495, 9572110.77876253, 9572171.48815389, 9577119.26473122, 9583148.4375, 9597794.78299228, 9616452.870609686, 9625601.496360544, 9627234.862627689, 9653396.902037097, 9655332.795026014, 10421471.013018256, 10443709.850579355, 10445674.001162885, 10445935.844621936, 10447990.593129985, 10477575.0, 10477586.858727705, 10479083.759577421, 154143159.375], [33.5880915049604, 51.2612553340706, 45.745885209121724, 47.70539754604977, 19.584403764444957, 9.516631982187752, 29.098370075458483, 67.8435287200121, 47.03984485282757, 11.142880163175317, 87.35413058430191, 42.01855270642251, 70.19330831870363, 6.026043266772264, 25.1194488296518, 50.39428129937421, 11.763045114164274, 21.453766398041928, 15.312557748939291, 17.519059293415882, 7.126325551787135, 36.96348219207946, 10.98449337392969, 42.62396365595595, 7.992916879776559, 11.601323812933362, 12.7008443682522, 5.943215140468193, 5.53916794918055, 71.37973459429341, 12.740376669951464, 5.112460465397597, 13.43721034606413, 58.28381215536717, 19.12746047542085, 42.06445130031103, 42.62347427553728, 75.55913260852336, 5.17237725940406, 89.55397429705681, 48.02555132130648, 7.09753149821932, 8.668518078218248, 11.838965672443303, 84.31283408302804, 13.68004966694608, 106.0145145691751, 20.332053448895117, 15.046531439298587, 169.17815185546058, 28.78804206565357, 5.335752355652732, 69.03081683158287, 85.26544345707778, 27.048964415306624, 42.21163990444811, 72.22726307433432, 13.58067430009552, 81.58136857154769, 18.49266583004019, 19.100290783615566, 21.334081912210205, 36.35539172174158, 76.12890162936057, 88.0681064631478, 123.24372191777955, 43.937268509156475, 37.47852873776035, 80.59877827175806, 65.15088839861315, 6.425086472100432, 6.862846029773848, 19.895159843820284, 72.991826461225, 127.12735581174273, 166.3052326075788, 11.259673380972236, 69.1239676207958, 74.10409870421826, 21.629310474771444, 7.9150191688357845, 46.56632459197954, 88.54786496838429, 21.17098099145541, 79.26990202198635, 7.835868349333493, 26.696127431167472, 40.25440564672454, 21.530232110589896, 89.97067164965436, 29.45042782271773, 104.49944405932072, 58.18012451441753, 7.961446456378681, 6.288073663408875, 102.57800323290581, 118.64939845625833, 26.29903772087864, 106.89911134296035, 37.00343377637881, 31.539963396323987, 54.94798923978941, 5.201461748410299, 47.58580796485394, 75.53434076254484, 76.5075931494109, 22.088191247202566, 27.01822253095982, 164.93562157180438, 54.39246640208541, 56.064504315970076, 197.70282955565904, 11.154483253344967, 94.26869377361109, 23.553865382950033, 6.306287517033026, 25.632480543712653, 18.479039671571478, 150.56204980702776, 38.826225728817505, 45.38732739095941, 16.288068942181823, 37.858941942896024, 84.08303913314317, 17.039113060151944, 113.61369975677155, 7.826446322964961, 12.481801497151258, 15.235075309754684, 30.27708178120253, 58.30805032171897, 62.3254873582013, 100.12469387968474, 88.1966051409253, 41.42229378690109, 14.370557420189552, 40.819064345181275, 26.824194527973727, 76.8595609630257, 128.23433448535116, 46.188817955887345, 27.032458757770588, 5.516768585660157, 17.021509534917264, 100.33748879559731, 93.1287245913077, 9.832936549423566, 12.18161334872976, 19.318976877609867, 8.484634461742871, 6.309535316416349, 41.06884793711684, 12.090900159095845, 81.52663405862626, 8.176305601727899, 43.621200592595024, 63.870616489576705, 84.6520869677775, 14.929750432736485, 5.537783352457766, 59.00766569569412, 18.54184713985716, 103.78791515803107, 112.46886797064049, 36.06819729357116, 11.640635837666295, 23.49810191324655, 16.893430434981408, 26.441502469808768, 5.412589363947484, 97.14549814348541, 7.835477154431712, 98.84307464588211, 47.015051478689195, 21.177038275635965, 28.262831185381266, 54.096936591537485, 109.68248402598819, 64.45151140313664, 226.56087186760737, 22.034046925389998, 7.781691373629382, 40.62677875166049, 16.011203528976267, 162.68486731933612, 10.7566737229031, 50.04720103359426, 5.61891168758747, 20.735317849874356, 108.15978101414066, 17.341603184235673, 28.65164843345003, 52.487970931337806, 91.59336604760851, 52.464422722183464, 43.10425437979397, 20.045983129993537, 21.252364666736845, 5.825146602118707, 75.39634744900118, 84.06329658475612, 22.025669724567912, 103.78510559553914, 17.96813901365547, 27.17559305989491, 73.1952951647546, 32.22075477703757, 181.83785789399423, 6.2538778256082574, 28.802570423252448, 54.96629821444377, 6.9261510020213, 6.603955130871481, 14.764960422797216, 7.71250773095068, 18.266030922403633, 58.587638792217554, 8.196268222703937, 123.77706842630356, 145.7974453772103, 161.98157704098242, 77.36224676141148, 63.0880740041817, 52.75997385786788, 39.28894708224124, 56.0559815493494, 207.76447390437403, 11.856627358265238, 78.90611387224206, 9.14071967636966, 8.805993643297924, 29.26360866441861, 41.184975780093275, 93.25696244189041, 108.68339479089822, 8.129683622844, 5.596873731407774, 9.115281405014157, 21.59593508220651, 28.72300474558676, 49.20792750075792, 7.306190525721463, 21.222596313791673, 19.91295543133179, 86.5989049123823, 9.484930248671533, 12.40582108620548, 5.6934830495058195, 24.51331956015094, 55.02444902475379, 8.367909038670009, 116.11942386494198, 7.375715016837946, 91.20546540308166, 37.75992813799467, 24.072358817687906, 41.77425667095395, 65.32076371421607, 149.92146982785098, 18.996223836819443, 6.2195297989117995, 17.348756638814276, 68.59928147543278, 8.920505322677078, 6.2355842363671306, 14.695270106450069, 95.08438381906217, 21.613106415460674, 11.71831501262254, 12.433133854211993, 45.47684615996181, 9.858285325476949, 54.76222097569136, 57.78623526578448, 64.77307806274082, 8.842268948220207, 49.04572602553054, 31.260971100026424])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([3729867.1875, 3788101.2837620764, 4012558.0502643143, 4022565.625, 4106335.22221119, 4182978.336228519, 4265722.703530869, 4352284.375, 4355400.0, 4359378.134685804, 4364937.5, 4418551.351269708, 4491585.9375, 4493854.068841211, 4529280.0287171565, 4584833.364847206, 4594862.871696943, 4635724.496047908, 4654000.094058011, 4674056.129313759, 4679893.768508722, 4822240.625, 4881565.531402745, 4908404.50759934, 4924610.337585828, 4936292.470751891, 4963296.129658594, 4968187.543641707, 5021064.187293005, 5196312.5, 5214875.833752954, 5214885.073693647, 5280816.502587391, 6216215.210911921, 6247917.974927701, 6310838.58780523, 6335389.0625, 6534883.507557046, 6541931.548711659, 6569237.5, 6604594.381074746, 6607985.84571539, 6611758.471078174, 6621001.974402585, 6626375.0, 6629790.249359538, 6637679.910942651, 6643753.158373484, 6656396.90228357, 6704582.794100096, 6704853.125, 6705006.068848153, 6728433.955345273, 6737259.121526126, 6762773.358210365, 6768989.295958388, 6796675.0, 6857099.59041109, 6858006.25, 6874620.335049611, 6899247.658756435, 6901838.546410034, 6929525.0, 6955889.0625, 6986520.648014259, 7037993.553475978, 7043620.3125, 7046845.3125, 7052423.4375, 7054072.10022303, 7055508.967715464, 7056045.79052249, 7056149.323362388, 7057001.5625, 7057584.375, 7057629.6875, 7058209.457818814, 7058675.0, 7062059.375, 7062921.38854688, 7064500.7869273, 7064501.280615501, 7107384.375, 7114647.033289047, 7116049.9717114195, 7116689.662933082, 7117673.341117493, 7117800.0, 7118397.941214256, 7121067.1875, 7122071.306206591, 7122756.037047909, 7133709.375, 7137130.580029226, 7142200.163460185, 7156582.84480983, 7171639.0625, 7177410.282298777, 7182865.625, 7185474.433926217, 7185651.424487245, 7187800.0, 7187884.297886817, 7201736.497544628, 7205012.5, 7220285.9375, 7222196.432655251, 7232408.738945503, 7238920.277816884, 7277857.8125, 7310428.125, 7317201.377465011, 7320939.079563465, 7354927.757948502, 7387567.428964973, 7387583.1157503985, 7388716.162011784, 7388724.133461979, 7402661.292977429, 7417418.657889249, 7439785.123662254, 7476992.500982078, 7479546.290000872, 7495449.4128191825, 7497403.5844547, 7515213.0326365875, 7520738.07766961, 7536028.847292758, 7540821.949945838, 7540916.139716263, 7544568.42256698, 7552787.5, 7552869.840560616, 7559273.4375, 7559279.6875, 7564902.966680552, 7586130.595069913, 7594213.970224923, 7600714.0625, 7642648.537893839, 7673715.625, 7673984.294765548, 7674040.284256197, 7748122.331231109, 7752240.143071506, 7755921.875, 7758691.164018966, 7761253.708678938, 7766458.625428359, 7778350.356647127, 7781931.577905938, 7784309.330980479, 7801606.789680014, 7863601.5625, 7914721.660486327, 7916423.4375, 7929994.550473407, 8035563.58720062, 8075923.434411467, 8104592.28401962, 8153526.5625, 8181540.014414495, 8231823.4375, 8246045.3125, 8274901.746186987, 8320061.242611863, 8367779.367460982, 8402745.168337744, 8428724.88500841, 8441203.48938775, 8477787.5, 8481531.8494904, 8481765.625, 8483795.3125, 8484088.53022165, 8540967.174121471, 8556567.1875, 8559984.375, 8561229.6875, 8562861.339124966, 8600930.109194908, 8608578.592842052, 8612987.78107681, 8623036.192432804, 8631732.8125, 8637452.87390647, 8639593.703331152, 8641359.462651184, 8660708.375884242, 8666126.27899324, 8666150.513483912, 8666851.5625, 8682939.0625, 8686209.375, 8688820.3125, 8689828.125, 8691024.341570295, 8699197.913023962, 8699201.712281968, 8707570.3125, 8708251.892384287, 8711287.051780237, 8711552.693620592, 8711556.867765736, 8713079.61541342, 8715750.0, 8716114.0625, 8717004.901676241, 8717465.518835822, 8722926.5625, 8734667.66057927, 8750166.388515456, 8754586.644580733, 8764371.827896139, 8773223.729837457, 8812405.351556996, 8817950.0, 8825820.137728576, 8841953.125, 8860553.824162269, 8885714.0625, 9036408.421619117, 9045745.3125, 9063534.59877465, 9115060.9375, 9147642.91457798, 9181382.483281333, 9211656.671139384, 9230904.6875, 9233948.203037003, 9233957.11807896, 9267823.4375, 9275234.354839686, 9319290.625, 9328031.25, 9333241.878540516, 9344890.310402218, 9347146.607843742, 9347182.154129168, 9347217.1875, 9362452.981777065, 9366174.09656095, 9367276.034948872, 9368127.45052908, 9402143.641840277, 9403832.98865498, 9434131.938183125, 9457843.539373815, 9483832.27232135, 9493475.0, 9493643.900696704, 9506201.268856088, 9519863.386341838, 9524676.5625, 9535677.254215145, 9539972.293536117, 9548457.590575127, 9552898.079058709, 9560562.2650495, 9572110.77876253, 9572171.48815389, 9577119.26473122, 9583148.4375, 9597794.78299228, 9616452.870609686, 9625601.496360544, 9627234.862627689, 9653396.902037097, 9655332.795026014, 10421471.013018256, 10443709.850579355, 10445674.001162885, 10445935.844621936, 10447990.593129985, 10477575.0, 10477586.858727705, 10479083.759577421, 154143159.375], [33.5880915049604, 51.2612553340706, 45.745885209121724, 47.70539754604977, 19.584403764444957, 9.516631982187752, 29.098370075458483, 67.8435287200121, 47.03984485282757, 11.142880163175317, 87.35413058430191, 42.01855270642251, 70.19330831870363, 6.026043266772264, 25.1194488296518, 50.39428129937421, 11.763045114164274, 21.453766398041928, 15.312557748939291, 17.519059293415882, 7.126325551787135, 36.96348219207946, 10.98449337392969, 42.62396365595595, 7.992916879776559, 11.601323812933362, 12.7008443682522, 5.943215140468193, 5.53916794918055, 71.37973459429341, 12.740376669951464, 5.112460465397597, 13.43721034606413, 58.28381215536717, 19.12746047542085, 42.06445130031103, 42.62347427553728, 75.55913260852336, 5.17237725940406, 89.55397429705681, 48.02555132130648, 7.09753149821932, 8.668518078218248, 11.838965672443303, 84.31283408302804, 13.68004966694608, 106.0145145691751, 20.332053448895117, 15.046531439298587, 169.17815185546058, 28.78804206565357, 5.335752355652732, 69.03081683158287, 85.26544345707778, 27.048964415306624, 42.21163990444811, 72.22726307433432, 13.58067430009552, 81.58136857154769, 18.49266583004019, 19.100290783615566, 21.334081912210205, 36.35539172174158, 76.12890162936057, 88.0681064631478, 123.24372191777955, 43.937268509156475, 37.47852873776035, 80.59877827175806, 65.15088839861315, 6.425086472100432, 6.862846029773848, 19.895159843820284, 72.991826461225, 127.12735581174273, 166.3052326075788, 11.259673380972236, 69.1239676207958, 74.10409870421826, 21.629310474771444, 7.9150191688357845, 46.56632459197954, 88.54786496838429, 21.17098099145541, 79.26990202198635, 7.835868349333493, 26.696127431167472, 40.25440564672454, 21.530232110589896, 89.97067164965436, 29.45042782271773, 104.49944405932072, 58.18012451441753, 7.961446456378681, 6.288073663408875, 102.57800323290581, 118.64939845625833, 26.29903772087864, 106.89911134296035, 37.00343377637881, 31.539963396323987, 54.94798923978941, 5.201461748410299, 47.58580796485394, 75.53434076254484, 76.5075931494109, 22.088191247202566, 27.01822253095982, 164.93562157180438, 54.39246640208541, 56.064504315970076, 197.70282955565904, 11.154483253344967, 94.26869377361109, 23.553865382950033, 6.306287517033026, 25.632480543712653, 18.479039671571478, 150.56204980702776, 38.826225728817505, 45.38732739095941, 16.288068942181823, 37.858941942896024, 84.08303913314317, 17.039113060151944, 113.61369975677155, 7.826446322964961, 12.481801497151258, 15.235075309754684, 30.27708178120253, 58.30805032171897, 62.3254873582013, 100.12469387968474, 88.1966051409253, 41.42229378690109, 14.370557420189552, 40.819064345181275, 26.824194527973727, 76.8595609630257, 128.23433448535116, 46.188817955887345, 27.032458757770588, 5.516768585660157, 17.021509534917264, 100.33748879559731, 93.1287245913077, 9.832936549423566, 12.18161334872976, 19.318976877609867, 8.484634461742871, 6.309535316416349, 41.06884793711684, 12.090900159095845, 81.52663405862626, 8.176305601727899, 43.621200592595024, 63.870616489576705, 84.6520869677775, 14.929750432736485, 5.537783352457766, 59.00766569569412, 18.54184713985716, 103.78791515803107, 112.46886797064049, 36.06819729357116, 11.640635837666295, 23.49810191324655, 16.893430434981408, 26.441502469808768, 5.412589363947484, 97.14549814348541, 7.835477154431712, 98.84307464588211, 47.015051478689195, 21.177038275635965, 28.262831185381266, 54.096936591537485, 109.68248402598819, 64.45151140313664, 226.56087186760737, 22.034046925389998, 7.781691373629382, 40.62677875166049, 16.011203528976267, 162.68486731933612, 10.7566737229031, 50.04720103359426, 5.61891168758747, 20.735317849874356, 108.15978101414066, 17.341603184235673, 28.65164843345003, 52.487970931337806, 91.59336604760851, 52.464422722183464, 43.10425437979397, 20.045983129993537, 21.252364666736845, 5.825146602118707, 75.39634744900118, 84.06329658475612, 22.025669724567912, 103.78510559553914, 17.96813901365547, 27.17559305989491, 73.1952951647546, 32.22075477703757, 181.83785789399423, 6.2538778256082574, 28.802570423252448, 54.96629821444377, 6.9261510020213, 6.603955130871481, 14.764960422797216, 7.71250773095068, 18.266030922403633, 58.587638792217554, 8.196268222703937, 123.77706842630356, 145.7974453772103, 161.98157704098242, 77.36224676141148, 63.0880740041817, 52.75997385786788, 39.28894708224124, 56.0559815493494, 207.76447390437403, 11.856627358265238, 78.90611387224206, 9.14071967636966, 8.805993643297924, 29.26360866441861, 41.184975780093275, 93.25696244189041, 108.68339479089822, 8.129683622844, 5.596873731407774, 9.115281405014157, 21.59593508220651, 28.72300474558676, 49.20792750075792, 7.306190525721463, 21.222596313791673, 19.91295543133179, 86.5989049123823, 9.484930248671533, 12.40582108620548, 5.6934830495058195, 24.51331956015094, 55.02444902475379, 8.367909038670009, 116.11942386494198, 7.375715016837946, 91.20546540308166, 37.75992813799467, 24.072358817687906, 41.77425667095395, 65.32076371421607, 149.92146982785098, 18.996223836819443, 6.2195297989117995, 17.348756638814276, 68.59928147543278, 8.920505322677078, 6.2355842363671306, 14.695270106450069, 95.08438381906217, 21.613106415460674, 11.71831501262254, 12.433133854211993, 45.47684615996181, 9.858285325476949, 54.76222097569136, 57.78623526578448, 64.77307806274082, 8.842268948220207, 49.04572602553054, 31.260971100026424])
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);
([3729867.1875, 3788101.2837620764, 4012558.0502643143, 4022565.625, 4106335.22221119, 4182978.336228519, 4265722.703530869, 4352284.375, 4355400.0, 4359378.134685804, 4364937.5, 4418551.351269708, 4491585.9375, 4493854.068841211, 4529280.0287171565, 4584833.364847206, 4594862.871696943, 4635724.496047908, 4654000.094058011, 4674056.129313759, 4679893.768508722, 4822240.625, 4881565.531402745, 4908404.50759934, 4924610.337585828, 4936292.470751891, 4963296.129658594, 4968187.543641707, 5021064.187293005, 5196312.5, 5214875.833752954, 5214885.073693647, 5280816.502587391, 6216215.210911921, 6247917.974927701, 6310838.58780523, 6335389.0625, 6534883.507557046, 6541931.548711659, 6569237.5, 6604594.381074746, 6607985.84571539, 6611758.471078174, 6621001.974402585, 6626375.0, 6629790.249359538, 6637679.910942651, 6643753.158373484, 6656396.90228357, 6704582.794100096, 6704853.125, 6705006.068848153, 6728433.955345273, 6737259.121526126, 6762773.358210365, 6768989.295958388, 6796675.0, 6857099.59041109, 6858006.25, 6874620.335049611, 6899247.658756435, 6901838.546410034, 6929525.0, 6955889.0625, 6986520.648014259, 7037993.553475978, 7043620.3125, 7046845.3125, 7052423.4375, 7054072.10022303, 7055508.967715464, 7056045.79052249, 7056149.323362388, 7057001.5625, 7057584.375, 7057629.6875, 7058209.457818814, 7058675.0, 7062059.375, 7062921.38854688, 7064500.7869273, 7064501.280615501, 7107384.375, 7114647.033289047, 7116049.9717114195, 7116689.662933082, 7117673.341117493, 7117800.0, 7118397.941214256, 7121067.1875, 7122071.306206591, 7122756.037047909, 7133709.375, 7137130.580029226, 7142200.163460185, 7156582.84480983, 7171639.0625, 7177410.282298777, 7182865.625, 7185474.433926217, 7185651.424487245, 7187800.0, 7187884.297886817, 7201736.497544628, 7205012.5, 7220285.9375, 7222196.432655251, 7232408.738945503, 7238920.277816884, 7277857.8125, 7310428.125, 7317201.377465011, 7320939.079563465, 7354927.757948502, 7387567.428964973, 7387583.1157503985, 7388716.162011784, 7388724.133461979, 7402661.292977429, 7417418.657889249, 7439785.123662254, 7476992.500982078, 7479546.290000872, 7495449.4128191825, 7497403.5844547, 7515213.0326365875, 7520738.07766961, 7536028.847292758, 7540821.949945838, 7540916.139716263, 7544568.42256698, 7552787.5, 7552869.840560616, 7559273.4375, 7559279.6875, 7564902.966680552, 7586130.595069913, 7594213.970224923, 7600714.0625, 7642648.537893839, 7673715.625, 7673984.294765548, 7674040.284256197, 7748122.331231109, 7752240.143071506, 7755921.875, 7758691.164018966, 7761253.708678938, 7766458.625428359, 7778350.356647127, 7781931.577905938, 7784309.330980479, 7801606.789680014, 7863601.5625, 7914721.660486327, 7916423.4375, 7929994.550473407, 8035563.58720062, 8075923.434411467, 8104592.28401962, 8153526.5625, 8181540.014414495, 8231823.4375, 8246045.3125, 8274901.746186987, 8320061.242611863, 8367779.367460982, 8402745.168337744, 8428724.88500841, 8441203.48938775, 8477787.5, 8481531.8494904, 8481765.625, 8483795.3125, 8484088.53022165, 8540967.174121471, 8556567.1875, 8559984.375, 8561229.6875, 8562861.339124966, 8600930.109194908, 8608578.592842052, 8612987.78107681, 8623036.192432804, 8631732.8125, 8637452.87390647, 8639593.703331152, 8641359.462651184, 8660708.375884242, 8666126.27899324, 8666150.513483912, 8666851.5625, 8682939.0625, 8686209.375, 8688820.3125, 8689828.125, 8691024.341570295, 8699197.913023962, 8699201.712281968, 8707570.3125, 8708251.892384287, 8711287.051780237, 8711552.693620592, 8711556.867765736, 8713079.61541342, 8715750.0, 8716114.0625, 8717004.901676241, 8717465.518835822, 8722926.5625, 8734667.66057927, 8750166.388515456, 8754586.644580733, 8764371.827896139, 8773223.729837457, 8812405.351556996, 8817950.0, 8825820.137728576, 8841953.125, 8860553.824162269, 8885714.0625, 9036408.421619117, 9045745.3125, 9063534.59877465, 9115060.9375, 9147642.91457798, 9181382.483281333, 9211656.671139384, 9230904.6875, 9233948.203037003, 9233957.11807896, 9267823.4375, 9275234.354839686, 9319290.625, 9328031.25, 9333241.878540516, 9344890.310402218, 9347146.607843742, 9347182.154129168, 9347217.1875, 9362452.981777065, 9366174.09656095, 9367276.034948872, 9368127.45052908, 9402143.641840277, 9403832.98865498, 9434131.938183125, 9457843.539373815, 9483832.27232135, 9493475.0, 9493643.900696704, 9506201.268856088, 9519863.386341838, 9524676.5625, 9535677.254215145, 9539972.293536117, 9548457.590575127, 9552898.079058709, 9560562.2650495, 9572110.77876253, 9572171.48815389, 9577119.26473122, 9583148.4375, 9597794.78299228, 9616452.870609686, 9625601.496360544, 9627234.862627689, 9653396.902037097, 9655332.795026014, 10421471.013018256, 10443709.850579355, 10445674.001162885, 10445935.844621936, 10447990.593129985, 10477575.0, 10477586.858727705, 10479083.759577421, 154143159.375], [33.5880915049604, 51.2612553340706, 45.745885209121724, 47.70539754604977, 19.584403764444957, 9.516631982187752, 29.098370075458483, 67.8435287200121, 47.03984485282757, 11.142880163175317, 87.35413058430191, 42.01855270642251, 70.19330831870363, 6.026043266772264, 25.1194488296518, 50.39428129937421, 11.763045114164274, 21.453766398041928, 15.312557748939291, 17.519059293415882, 7.126325551787135, 36.96348219207946, 10.98449337392969, 42.62396365595595, 7.992916879776559, 11.601323812933362, 12.7008443682522, 5.943215140468193, 5.53916794918055, 71.37973459429341, 12.740376669951464, 5.112460465397597, 13.43721034606413, 58.28381215536717, 19.12746047542085, 42.06445130031103, 42.62347427553728, 75.55913260852336, 5.17237725940406, 89.55397429705681, 48.02555132130648, 7.09753149821932, 8.668518078218248, 11.838965672443303, 84.31283408302804, 13.68004966694608, 106.0145145691751, 20.332053448895117, 15.046531439298587, 169.17815185546058, 28.78804206565357, 5.335752355652732, 69.03081683158287, 85.26544345707778, 27.048964415306624, 42.21163990444811, 72.22726307433432, 13.58067430009552, 81.58136857154769, 18.49266583004019, 19.100290783615566, 21.334081912210205, 36.35539172174158, 76.12890162936057, 88.0681064631478, 123.24372191777955, 43.937268509156475, 37.47852873776035, 80.59877827175806, 65.15088839861315, 6.425086472100432, 6.862846029773848, 19.895159843820284, 72.991826461225, 127.12735581174273, 166.3052326075788, 11.259673380972236, 69.1239676207958, 74.10409870421826, 21.629310474771444, 7.9150191688357845, 46.56632459197954, 88.54786496838429, 21.17098099145541, 79.26990202198635, 7.835868349333493, 26.696127431167472, 40.25440564672454, 21.530232110589896, 89.97067164965436, 29.45042782271773, 104.49944405932072, 58.18012451441753, 7.961446456378681, 6.288073663408875, 102.57800323290581, 118.64939845625833, 26.29903772087864, 106.89911134296035, 37.00343377637881, 31.539963396323987, 54.94798923978941, 5.201461748410299, 47.58580796485394, 75.53434076254484, 76.5075931494109, 22.088191247202566, 27.01822253095982, 164.93562157180438, 54.39246640208541, 56.064504315970076, 197.70282955565904, 11.154483253344967, 94.26869377361109, 23.553865382950033, 6.306287517033026, 25.632480543712653, 18.479039671571478, 150.56204980702776, 38.826225728817505, 45.38732739095941, 16.288068942181823, 37.858941942896024, 84.08303913314317, 17.039113060151944, 113.61369975677155, 7.826446322964961, 12.481801497151258, 15.235075309754684, 30.27708178120253, 58.30805032171897, 62.3254873582013, 100.12469387968474, 88.1966051409253, 41.42229378690109, 14.370557420189552, 40.819064345181275, 26.824194527973727, 76.8595609630257, 128.23433448535116, 46.188817955887345, 27.032458757770588, 5.516768585660157, 17.021509534917264, 100.33748879559731, 93.1287245913077, 9.832936549423566, 12.18161334872976, 19.318976877609867, 8.484634461742871, 6.309535316416349, 41.06884793711684, 12.090900159095845, 81.52663405862626, 8.176305601727899, 43.621200592595024, 63.870616489576705, 84.6520869677775, 14.929750432736485, 5.537783352457766, 59.00766569569412, 18.54184713985716, 103.78791515803107, 112.46886797064049, 36.06819729357116, 11.640635837666295, 23.49810191324655, 16.893430434981408, 26.441502469808768, 5.412589363947484, 97.14549814348541, 7.835477154431712, 98.84307464588211, 47.015051478689195, 21.177038275635965, 28.262831185381266, 54.096936591537485, 109.68248402598819, 64.45151140313664, 226.56087186760737, 22.034046925389998, 7.781691373629382, 40.62677875166049, 16.011203528976267, 162.68486731933612, 10.7566737229031, 50.04720103359426, 5.61891168758747, 20.735317849874356, 108.15978101414066, 17.341603184235673, 28.65164843345003, 52.487970931337806, 91.59336604760851, 52.464422722183464, 43.10425437979397, 20.045983129993537, 21.252364666736845, 5.825146602118707, 75.39634744900118, 84.06329658475612, 22.025669724567912, 103.78510559553914, 17.96813901365547, 27.17559305989491, 73.1952951647546, 32.22075477703757, 181.83785789399423, 6.2538778256082574, 28.802570423252448, 54.96629821444377, 6.9261510020213, 6.603955130871481, 14.764960422797216, 7.71250773095068, 18.266030922403633, 58.587638792217554, 8.196268222703937, 123.77706842630356, 145.7974453772103, 161.98157704098242, 77.36224676141148, 63.0880740041817, 52.75997385786788, 39.28894708224124, 56.0559815493494, 207.76447390437403, 11.856627358265238, 78.90611387224206, 9.14071967636966, 8.805993643297924, 29.26360866441861, 41.184975780093275, 93.25696244189041, 108.68339479089822, 8.129683622844, 5.596873731407774, 9.115281405014157, 21.59593508220651, 28.72300474558676, 49.20792750075792, 7.306190525721463, 21.222596313791673, 19.91295543133179, 86.5989049123823, 9.484930248671533, 12.40582108620548, 5.6934830495058195, 24.51331956015094, 55.02444902475379, 8.367909038670009, 116.11942386494198, 7.375715016837946, 91.20546540308166, 37.75992813799467, 24.072358817687906, 41.77425667095395, 65.32076371421607, 149.92146982785098, 18.996223836819443, 6.2195297989117995, 17.348756638814276, 68.59928147543278, 8.920505322677078, 6.2355842363671306, 14.695270106450069, 95.08438381906217, 21.613106415460674, 11.71831501262254, 12.433133854211993, 45.47684615996181, 9.858285325476949, 54.76222097569136, 57.78623526578448, 64.77307806274082, 8.842268948220207, 49.04572602553054, 31.260971100026424])
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)