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 = 45900
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);
([5647751.263498774, 5797085.872288381, 5807581.25, 5888196.01458797, 5889958.716103492, 5943985.9375, 5966987.368510297, 5968243.75, 5968618.644104738, 5972014.639649761, 5972513.722783335, 5991151.884210906, 6106053.092839893, 6124419.950494631, 6147225.186669992, 6186721.1515822895, 6202126.5625, 6202706.228670832, 6203575.0, 6205612.5, 6208596.180759371, 6215273.149249185, 6216054.433836346, 6217228.125, 6219045.53119541, 6219309.314691426, 6220222.410325491, 6220510.9375, 6222298.4375, 6223505.901513659, 6232894.999254361, 6233447.120774744, 6236834.015152822, 6237064.357539391, 6238905.537124014, 6241032.8125, 6241958.603411323, 6242001.5625, 6242814.2964420365, 6243498.027964249, 6243843.901422747, 6246367.257328686, 6252059.11117378, 6261118.5796898585, 6263220.016097065, 6284079.701998032, 6293276.36456403, 6399675.0, 6451926.5625, 6454906.25, 6483962.5, 6535168.231785489, 6538604.743275686, 6539240.207524156, 6587798.018878038, 6595237.5, 6596040.619782462, 6610268.223582465, 6610857.397110258, 6615058.706016109, 6615172.445653754, 6619269.641541628, 6644255.335085135, 6665284.441879435, 6668753.447742069, 6670207.361997676, 6672478.125, 6674454.214408908, 6675556.981667988, 6676123.8899342455, 6677443.009723554, 6677910.867036292, 6678720.276761393, 6678928.243856002, 6679769.431393286, 6681343.8279898865, 6682189.489849128, 6682698.806705364, 6683732.698200825, 6684705.956114481, 6685109.375, 6691204.6875, 6702605.298765378, 6703102.473674273, 6780243.496513066, 6791235.9375, 6813359.731215025, 6813517.1875, 6819205.794155447, 6821328.359726736, 6821876.554828618, 6823194.228225265, 6826418.878728121, 6826457.681890553, 6827315.625, 6833877.064115243, 6833906.964662247, 6836839.0625, 6839506.986407697, 6839932.8125, 6840098.334255985, 6840834.375, 6841542.1875, 6843426.176665009, 6846560.759407894, 6850476.185358425, 6871234.420623801, 6871803.438470639, 6880712.029554455, 6882609.109942503, 6882768.75, 6898467.1875, 6903837.341730969, 6904513.452722614, 6904936.82646119, 6905572.832332818, 6906156.037944807, 6907153.934175801, 6907225.639833252, 6907239.22957146, 6907557.480145619, 6907648.429188633, 6909213.415083054, 6910098.4375, 6915906.25, 6919099.889847837, 6919182.8125, 6919378.461951923, 6919571.875, 6920198.4375, 6921296.729753474, 6921955.64352375, 6922262.5, 6922368.063469247, 6922407.858296976, 6922504.6875, 6924353.125, 6924480.793536442, 6926096.615285978, 6926116.044995883, 6926116.982142664, 6926384.771777791, 6926388.573136694, 6926836.17573074, 6927390.625, 6932051.5625, 6933388.738360766, 6933692.027261821, 6934399.601829349, 6934670.960689288, 6934722.859932731, 6934740.630919204, 6935528.125, 6935683.176450651, 6936219.142485023, 6936562.5, 6936643.75, 6936731.756236346, 6936759.375, 6936828.903160985, 6937150.175793842, 6937216.512362117, 6937270.3125, 6937386.071392135, 6937670.206450871, 6938427.0710892, 6938683.651888707, 6939800.804311167, 6939803.125, 6940185.9375, 6940395.203211878, 6940890.078038451, 6941317.587170314, 6941361.0551121365, 6941760.446951469, 6942439.68941974, 6942471.875, 6942502.1897220155, 6942645.670760155, 6943405.228517007, 6943696.875, 6943880.166624697, 6943954.362253634, 6945468.75, 6945785.241977356, 6947118.828153514, 6947780.871392747, 6948279.6875, 6955418.75, 7114614.0625, 7630831.053404257, 7635538.3294280805, 8297763.4744327525, 8338652.702322396, 8511941.683120048, 8655268.75, 8655378.07279571, 8655694.81642283, 8656824.32707823, 8656831.37256702, 8704243.0365488, 8714876.321562467, 8778048.4375, 8778960.113300866, 8779793.459192883, 8782265.951816311, 8783461.47413826, 8784007.8125, 8873385.676157344, 8873443.04509947, 8880807.610525178, 8883154.497699387, 8888131.25, 8890962.5, 8896448.4375, 8933282.133477623, 8934867.439224737, 8934962.546795148, 8940700.63719161, 8980980.709569287, 8981652.040092167, 8981962.435709994, 8982956.091656927, 8983825.219515778, 9001351.5625, 9005565.625, 9082460.162492532, 9457643.732103208, 9666369.90105126, 9733573.314192994, 9763096.875, 9784253.992464285, 9791321.875, 9809918.75, 9810005.20615935, 9841131.25, 9879705.904872674, 9884491.807420041, 9902263.308837635, 9908610.038376248, 9953934.031802826, 9974292.1875, 9986071.875, 9999151.130191531, 10000510.812679542, 10019974.757125678, 10083878.125, 10087586.24157956, 10122607.667524057, 10131696.155057339, 10142910.487675013, 10170619.305671336, 10170907.8125, 10171342.816998105, 10172054.6704563, 10172367.03861241, 10172667.1875, 10172949.948812878, 10172963.328915829, 10173076.797036102, 10173333.881947141, 10173376.5625, 10173918.75, 10173961.159358652, 10175316.844224118, 10175968.75, 10176020.3125, 10176045.255037269, 10176081.25, 10176519.5928079, 10177136.193818321, 10177488.416714536, 10179974.03132277, 10180055.972593065, 10413397.029212829, 10435684.073881011, 10443768.708562752, 10446515.215805179, 10446525.0, 10477524.219454564, 10490404.6875, 10492885.789728012, 10819776.414922135, 10835904.6875, 10859062.86737891, 10860106.985527273, 10865264.28104504, 11100840.625, 11109383.455310663, 15021244.87660759, 16094752.749901243, 16108555.274290731, 16110439.0625, 16113348.01024047, 16153065.557073772, 16154812.5, 18099238.801673483, 18104753.43057302, 18105001.14647437, 18105217.753686707, 18105520.3125, 18109488.078496918, 18112603.3202819, 18113376.14935965, 18119148.26963311, 18119817.1875, 18121241.598024238, 18125081.84589758, 18129978.489814926, 18130329.6875, 18135493.75, 18136705.743326604, 18139388.448606484, 18139417.144774143, 18139437.279469524, 18140167.179471504, 18141195.05193372, 18142309.73713266, 18143131.25, 18143408.687721405, 18143566.314493284, 18143812.985328913, 18144681.020945847, 18144964.01134809, 18145487.810870584, 18146510.221000075, 18147137.5, 18147576.76433121, 18148453.336885706, 18156322.21453107], [32.45806409819326, 41.75970728180488, 51.630227815318044, 5.145796091792954, 12.910959792149233, 70.00637920469167, 66.28240936415284, 69.84400266991547, 72.89154159661274, 17.717069001243807, 5.330414055197714, 16.328037093615286, 45.289741464342676, 16.733810170901826, 11.432582439788076, 39.04670667099039, 56.92295510133352, 28.10956889180628, 60.56405700347978, 50.340979270683135, 12.823788650505707, 84.09234679678212, 50.75049251366599, 73.51842619875168, 70.84621599683531, 43.35985925178106, 12.082036329881127, 122.25510635264472, 93.75279479739953, 6.695872673072016, 54.98682290944489, 81.78273202698827, 27.0683160620734, 57.25576869754154, 5.318073377720503, 34.64379368988862, 12.639069946011027, 66.08956197729583, 39.79859123785293, 36.973794928685486, 15.551879596342344, 21.673132913561084, 24.224077176148665, 25.561893781476954, 7.045656783765305, 68.14754740640855, 52.575538071534154, 49.449410044315066, 91.90514444760267, 157.98535504044705, 72.46115897758445, 13.276436072506902, 26.42717679030907, 7.458914405490249, 22.34520799003405, 83.17445590930491, 11.47611949232353, 13.254272281993332, 13.563904927254383, 5.501470264334953, 11.892145279744547, 25.888323520055607, 76.42384242252629, 5.464644419493392, 9.620070790142734, 7.448039408240927, 33.07066137005744, 6.040245876823375, 8.715509054699941, 17.00083793534004, 12.71287099665145, 11.019325191456819, 48.350529638541076, 8.350446612371103, 99.23041529428849, 16.96358870794929, 11.868547827200825, 7.742463940347222, 17.974878934781376, 59.620612282299305, 61.87834479244849, 55.7999217726242, 17.9273252692, 55.54994830641183, 6.713933490624197, 53.91804476605328, 64.36974276995824, 40.055662782779166, 13.448626391961843, 7.184552150539651, 22.131044501085334, 7.785873364719979, 28.34561804073539, 105.1259519001306, 45.80798167665456, 17.2739264574946, 18.606944711349115, 37.81468245791332, 60.228770327725414, 73.84336940050173, 26.637766457969438, 91.03957299540558, 44.117238542551114, 45.98842727370281, 6.4595314765961716, 9.03164592407273, 8.310852217684698, 92.40944805765295, 8.96295684674803, 9.116906334476319, 59.87283553579892, 48.1470744505027, 20.304921737712075, 20.463716308885946, 47.15221863015851, 10.297434291688896, 9.158311937683228, 19.290483594982252, 12.300517028276065, 9.476783132323842, 53.02684835096718, 66.27288586133912, 20.138633663580105, 74.79475262542819, 69.7712821294279, 56.48592936347242, 36.593579196259135, 45.738176994431804, 29.615366179315863, 54.80261500713347, 58.21478572087654, 41.86564974378077, 46.45507815894328, 19.81441900387989, 15.11898726982067, 52.95239756647695, 73.15361101029626, 40.61664990353542, 14.036113073046497, 20.681425380986806, 55.33196043224952, 9.691057924839617, 21.599867237634225, 15.934559579515968, 71.20440326511397, 42.87854091145802, 23.447217059296854, 25.716795419998682, 22.572830130696147, 7.855801374384783, 10.330857621876945, 7.605379962163792, 62.83141489667064, 98.32955111907307, 9.686889868297806, 62.41362663188356, 41.463438134892804, 18.49213056293332, 66.57590636000856, 40.82228619153018, 11.414070142952824, 56.09587333668048, 39.21995127904256, 5.823954009429112, 26.5905860266104, 12.028054467325969, 116.91037197089528, 26.4829256973894, 64.66147550850769, 65.93548487144965, 26.536355703169466, 45.76421778129048, 5.07623695135307, 66.35063141506254, 62.892089422354914, 8.648475771221952, 45.47471485956563, 12.27350066141765, 6.126164702785698, 12.093625740487596, 37.04515555587471, 23.04017582555504, 9.070740487900743, 56.28505362628675, 10.190575008572909, 34.338003980480444, 120.26516754311122, 73.6496170278393, 75.70094910861702, 82.41922323739115, 31.791371071413504, 45.38203572241497, 24.61116536127819, 63.0083901194863, 39.06252918857733, 74.58567183784693, 9.287648169601956, 5.440869717908554, 52.258677274280444, 7.154047888580252, 6.380779840302367, 14.09635383218911, 52.3984865906781, 27.580911133190135, 27.155046083805328, 16.352969160454894, 14.412592912491347, 61.771341194462195, 11.353903729167182, 5.029861837821437, 54.87476542979337, 6.45774430899453, 52.252229460043914, 71.17336868261359, 70.10254134080648, 5.882375909307649, 70.32338297182143, 7.13380724984595, 8.654958327994311, 27.516551023993323, 17.13907688036409, 41.02985017700744, 25.746194270867143, 9.524179646139737, 61.17800223662903, 45.95193936114801, 40.15544315319245, 11.099847720452262, 85.15368163368939, 6.739136456956618, 55.50490221789684, 36.3220357233022, 51.73262003170427, 102.39376023038477, 5.216840283949812, 58.871614012040204, 53.30894514170656, 59.52280076790443, 62.482948381520664, 9.963282914219484, 7.0340662137695125, 55.62860170052128, 91.58379258401797, 5.590567258218598, 16.199972049107153, 24.508940442346375, 46.78914657440432, 8.454203298149789, 25.95587775383889, 35.63558294508948, 10.49056468554865, 17.588001322047802, 80.14272905392818, 18.042426801105478, 59.83345765535549, 25.89409382611235, 72.38192164597828, 14.74993250180054, 7.9333360400519926, 7.690326756088138, 64.35522565285092, 64.93043448393364, 163.94010309691166, 15.860400302436876, 5.280600182484121, 75.23941853588097, 109.78540165194083, 41.13227888557571, 35.09966356760147, 32.77768538448883, 16.01760704349166, 10.248918159283388, 7.286818070872984, 142.75856930374192, 8.369846710684588, 66.22161048298841, 70.01870980569743, 45.80691274377049, 38.259702897635535, 19.08699228048805, 45.690361947560945, 5.697417506426846, 9.209659163019204, 31.599484641005255, 5.47775892874718, 19.85345595870433, 5.543782073280224, 116.02255304957926, 18.127706831221406, 22.157367836730607, 10.587997119687932, 62.73542615869198, 48.872543758897095, 13.529779980303767, 133.2209890278989, 68.02700427341418, 35.698686089564255, 27.261194477053127, 60.632836038051686, 5.743764716364925, 51.14633124987099, 112.63585146619748, 25.656627734795286, 27.720190038492152, 168.76501886265726, 59.45702438980651, 20.64467084004398, 5.562717574966435, 24.135315456101303, 49.94605026445158, 57.47598409157397, 6.994341363397568, 20.427516525978135, 14.781121362606392, 70.47783062529855, 37.14187352079537, 14.033396404108396, 5.634397329798758, 100.59867470239254, 12.840819035469636, 12.408713320482251, 91.20735754281468, 97.63928590867381, 27.55176886498441, 16.27544031714682, 47.7387962987938, 213.20503250149503, 15.77096326801183, 7.178286599088974, 21.856568259563034])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([5647751.263498774, 5797085.872288381, 5807581.25, 5888196.01458797, 5889958.716103492, 5943985.9375, 5966987.368510297, 5968243.75, 5968618.644104738, 5972014.639649761, 5972513.722783335, 5991151.884210906, 6106053.092839893, 6124419.950494631, 6147225.186669992, 6186721.1515822895, 6202126.5625, 6202706.228670832, 6203575.0, 6205612.5, 6208596.180759371, 6215273.149249185, 6216054.433836346, 6217228.125, 6219045.53119541, 6219309.314691426, 6220222.410325491, 6220510.9375, 6222298.4375, 6223505.901513659, 6232894.999254361, 6233447.120774744, 6236834.015152822, 6237064.357539391, 6238905.537124014, 6241032.8125, 6241958.603411323, 6242001.5625, 6242814.2964420365, 6243498.027964249, 6243843.901422747, 6246367.257328686, 6252059.11117378, 6261118.5796898585, 6263220.016097065, 6284079.701998032, 6293276.36456403, 6399675.0, 6451926.5625, 6454906.25, 6483962.5, 6535168.231785489, 6538604.743275686, 6539240.207524156, 6587798.018878038, 6595237.5, 6596040.619782462, 6610268.223582465, 6610857.397110258, 6615058.706016109, 6615172.445653754, 6619269.641541628, 6644255.335085135, 6665284.441879435, 6668753.447742069, 6670207.361997676, 6672478.125, 6674454.214408908, 6675556.981667988, 6676123.8899342455, 6677443.009723554, 6677910.867036292, 6678720.276761393, 6678928.243856002, 6679769.431393286, 6681343.8279898865, 6682189.489849128, 6682698.806705364, 6683732.698200825, 6684705.956114481, 6685109.375, 6691204.6875, 6702605.298765378, 6703102.473674273, 6780243.496513066, 6791235.9375, 6813359.731215025, 6813517.1875, 6819205.794155447, 6821328.359726736, 6821876.554828618, 6823194.228225265, 6826418.878728121, 6826457.681890553, 6827315.625, 6833877.064115243, 6833906.964662247, 6836839.0625, 6839506.986407697, 6839932.8125, 6840098.334255985, 6840834.375, 6841542.1875, 6843426.176665009, 6846560.759407894, 6850476.185358425, 6871234.420623801, 6871803.438470639, 6880712.029554455, 6882609.109942503, 6882768.75, 6898467.1875, 6903837.341730969, 6904513.452722614, 6904936.82646119, 6905572.832332818, 6906156.037944807, 6907153.934175801, 6907225.639833252, 6907239.22957146, 6907557.480145619, 6907648.429188633, 6909213.415083054, 6910098.4375, 6915906.25, 6919099.889847837, 6919182.8125, 6919378.461951923, 6919571.875, 6920198.4375, 6921296.729753474, 6921955.64352375, 6922262.5, 6922368.063469247, 6922407.858296976, 6922504.6875, 6924353.125, 6924480.793536442, 6926096.615285978, 6926116.044995883, 6926116.982142664, 6926384.771777791, 6926388.573136694, 6926836.17573074, 6927390.625, 6932051.5625, 6933388.738360766, 6933692.027261821, 6934399.601829349, 6934670.960689288, 6934722.859932731, 6934740.630919204, 6935528.125, 6935683.176450651, 6936219.142485023, 6936562.5, 6936643.75, 6936731.756236346, 6936759.375, 6936828.903160985, 6937150.175793842, 6937216.512362117, 6937270.3125, 6937386.071392135, 6937670.206450871, 6938427.0710892, 6938683.651888707, 6939800.804311167, 6939803.125, 6940185.9375, 6940395.203211878, 6940890.078038451, 6941317.587170314, 6941361.0551121365, 6941760.446951469, 6942439.68941974, 6942471.875, 6942502.1897220155, 6942645.670760155, 6943405.228517007, 6943696.875, 6943880.166624697, 6943954.362253634, 6945468.75, 6945785.241977356, 6947118.828153514, 6947780.871392747, 6948279.6875, 6955418.75, 7114614.0625, 7630831.053404257, 7635538.3294280805, 8297763.4744327525, 8338652.702322396, 8511941.683120048, 8655268.75, 8655378.07279571, 8655694.81642283, 8656824.32707823, 8656831.37256702, 8704243.0365488, 8714876.321562467, 8778048.4375, 8778960.113300866, 8779793.459192883, 8782265.951816311, 8783461.47413826, 8784007.8125, 8873385.676157344, 8873443.04509947, 8880807.610525178, 8883154.497699387, 8888131.25, 8890962.5, 8896448.4375, 8933282.133477623, 8934867.439224737, 8934962.546795148, 8940700.63719161, 8980980.709569287, 8981652.040092167, 8981962.435709994, 8982956.091656927, 8983825.219515778, 9001351.5625, 9005565.625, 9082460.162492532, 9457643.732103208, 9666369.90105126, 9733573.314192994, 9763096.875, 9784253.992464285, 9791321.875, 9809918.75, 9810005.20615935, 9841131.25, 9879705.904872674, 9884491.807420041, 9902263.308837635, 9908610.038376248, 9953934.031802826, 9974292.1875, 9986071.875, 9999151.130191531, 10000510.812679542, 10019974.757125678, 10083878.125, 10087586.24157956, 10122607.667524057, 10131696.155057339, 10142910.487675013, 10170619.305671336, 10170907.8125, 10171342.816998105, 10172054.6704563, 10172367.03861241, 10172667.1875, 10172949.948812878, 10172963.328915829, 10173076.797036102, 10173333.881947141, 10173376.5625, 10173918.75, 10173961.159358652, 10175316.844224118, 10175968.75, 10176020.3125, 10176045.255037269, 10176081.25, 10176519.5928079, 10177136.193818321, 10177488.416714536, 10179974.03132277, 10180055.972593065, 10413397.029212829, 10435684.073881011, 10443768.708562752, 10446515.215805179, 10446525.0, 10477524.219454564, 10490404.6875, 10492885.789728012, 10819776.414922135, 10835904.6875, 10859062.86737891, 10860106.985527273, 10865264.28104504, 11100840.625, 11109383.455310663, 15021244.87660759, 16094752.749901243, 16108555.274290731, 16110439.0625, 16113348.01024047, 16153065.557073772, 16154812.5, 18099238.801673483, 18104753.43057302, 18105001.14647437, 18105217.753686707, 18105520.3125, 18109488.078496918, 18112603.3202819, 18113376.14935965, 18119148.26963311, 18119817.1875, 18121241.598024238, 18125081.84589758, 18129978.489814926, 18130329.6875, 18135493.75, 18136705.743326604, 18139388.448606484, 18139417.144774143, 18139437.279469524, 18140167.179471504, 18141195.05193372, 18142309.73713266, 18143131.25, 18143408.687721405, 18143566.314493284, 18143812.985328913, 18144681.020945847, 18144964.01134809, 18145487.810870584, 18146510.221000075, 18147137.5, 18147576.76433121, 18148453.336885706, 18156322.21453107], [32.45806409819326, 41.75970728180488, 51.630227815318044, 5.145796091792954, 12.910959792149233, 70.00637920469167, 66.28240936415284, 69.84400266991547, 72.89154159661274, 17.717069001243807, 5.330414055197714, 16.328037093615286, 45.289741464342676, 16.733810170901826, 11.432582439788076, 39.04670667099039, 56.92295510133352, 28.10956889180628, 60.56405700347978, 50.340979270683135, 12.823788650505707, 84.09234679678212, 50.75049251366599, 73.51842619875168, 70.84621599683531, 43.35985925178106, 12.082036329881127, 122.25510635264472, 93.75279479739953, 6.695872673072016, 54.98682290944489, 81.78273202698827, 27.0683160620734, 57.25576869754154, 5.318073377720503, 34.64379368988862, 12.639069946011027, 66.08956197729583, 39.79859123785293, 36.973794928685486, 15.551879596342344, 21.673132913561084, 24.224077176148665, 25.561893781476954, 7.045656783765305, 68.14754740640855, 52.575538071534154, 49.449410044315066, 91.90514444760267, 157.98535504044705, 72.46115897758445, 13.276436072506902, 26.42717679030907, 7.458914405490249, 22.34520799003405, 83.17445590930491, 11.47611949232353, 13.254272281993332, 13.563904927254383, 5.501470264334953, 11.892145279744547, 25.888323520055607, 76.42384242252629, 5.464644419493392, 9.620070790142734, 7.448039408240927, 33.07066137005744, 6.040245876823375, 8.715509054699941, 17.00083793534004, 12.71287099665145, 11.019325191456819, 48.350529638541076, 8.350446612371103, 99.23041529428849, 16.96358870794929, 11.868547827200825, 7.742463940347222, 17.974878934781376, 59.620612282299305, 61.87834479244849, 55.7999217726242, 17.9273252692, 55.54994830641183, 6.713933490624197, 53.91804476605328, 64.36974276995824, 40.055662782779166, 13.448626391961843, 7.184552150539651, 22.131044501085334, 7.785873364719979, 28.34561804073539, 105.1259519001306, 45.80798167665456, 17.2739264574946, 18.606944711349115, 37.81468245791332, 60.228770327725414, 73.84336940050173, 26.637766457969438, 91.03957299540558, 44.117238542551114, 45.98842727370281, 6.4595314765961716, 9.03164592407273, 8.310852217684698, 92.40944805765295, 8.96295684674803, 9.116906334476319, 59.87283553579892, 48.1470744505027, 20.304921737712075, 20.463716308885946, 47.15221863015851, 10.297434291688896, 9.158311937683228, 19.290483594982252, 12.300517028276065, 9.476783132323842, 53.02684835096718, 66.27288586133912, 20.138633663580105, 74.79475262542819, 69.7712821294279, 56.48592936347242, 36.593579196259135, 45.738176994431804, 29.615366179315863, 54.80261500713347, 58.21478572087654, 41.86564974378077, 46.45507815894328, 19.81441900387989, 15.11898726982067, 52.95239756647695, 73.15361101029626, 40.61664990353542, 14.036113073046497, 20.681425380986806, 55.33196043224952, 9.691057924839617, 21.599867237634225, 15.934559579515968, 71.20440326511397, 42.87854091145802, 23.447217059296854, 25.716795419998682, 22.572830130696147, 7.855801374384783, 10.330857621876945, 7.605379962163792, 62.83141489667064, 98.32955111907307, 9.686889868297806, 62.41362663188356, 41.463438134892804, 18.49213056293332, 66.57590636000856, 40.82228619153018, 11.414070142952824, 56.09587333668048, 39.21995127904256, 5.823954009429112, 26.5905860266104, 12.028054467325969, 116.91037197089528, 26.4829256973894, 64.66147550850769, 65.93548487144965, 26.536355703169466, 45.76421778129048, 5.07623695135307, 66.35063141506254, 62.892089422354914, 8.648475771221952, 45.47471485956563, 12.27350066141765, 6.126164702785698, 12.093625740487596, 37.04515555587471, 23.04017582555504, 9.070740487900743, 56.28505362628675, 10.190575008572909, 34.338003980480444, 120.26516754311122, 73.6496170278393, 75.70094910861702, 82.41922323739115, 31.791371071413504, 45.38203572241497, 24.61116536127819, 63.0083901194863, 39.06252918857733, 74.58567183784693, 9.287648169601956, 5.440869717908554, 52.258677274280444, 7.154047888580252, 6.380779840302367, 14.09635383218911, 52.3984865906781, 27.580911133190135, 27.155046083805328, 16.352969160454894, 14.412592912491347, 61.771341194462195, 11.353903729167182, 5.029861837821437, 54.87476542979337, 6.45774430899453, 52.252229460043914, 71.17336868261359, 70.10254134080648, 5.882375909307649, 70.32338297182143, 7.13380724984595, 8.654958327994311, 27.516551023993323, 17.13907688036409, 41.02985017700744, 25.746194270867143, 9.524179646139737, 61.17800223662903, 45.95193936114801, 40.15544315319245, 11.099847720452262, 85.15368163368939, 6.739136456956618, 55.50490221789684, 36.3220357233022, 51.73262003170427, 102.39376023038477, 5.216840283949812, 58.871614012040204, 53.30894514170656, 59.52280076790443, 62.482948381520664, 9.963282914219484, 7.0340662137695125, 55.62860170052128, 91.58379258401797, 5.590567258218598, 16.199972049107153, 24.508940442346375, 46.78914657440432, 8.454203298149789, 25.95587775383889, 35.63558294508948, 10.49056468554865, 17.588001322047802, 80.14272905392818, 18.042426801105478, 59.83345765535549, 25.89409382611235, 72.38192164597828, 14.74993250180054, 7.9333360400519926, 7.690326756088138, 64.35522565285092, 64.93043448393364, 163.94010309691166, 15.860400302436876, 5.280600182484121, 75.23941853588097, 109.78540165194083, 41.13227888557571, 35.09966356760147, 32.77768538448883, 16.01760704349166, 10.248918159283388, 7.286818070872984, 142.75856930374192, 8.369846710684588, 66.22161048298841, 70.01870980569743, 45.80691274377049, 38.259702897635535, 19.08699228048805, 45.690361947560945, 5.697417506426846, 9.209659163019204, 31.599484641005255, 5.47775892874718, 19.85345595870433, 5.543782073280224, 116.02255304957926, 18.127706831221406, 22.157367836730607, 10.587997119687932, 62.73542615869198, 48.872543758897095, 13.529779980303767, 133.2209890278989, 68.02700427341418, 35.698686089564255, 27.261194477053127, 60.632836038051686, 5.743764716364925, 51.14633124987099, 112.63585146619748, 25.656627734795286, 27.720190038492152, 168.76501886265726, 59.45702438980651, 20.64467084004398, 5.562717574966435, 24.135315456101303, 49.94605026445158, 57.47598409157397, 6.994341363397568, 20.427516525978135, 14.781121362606392, 70.47783062529855, 37.14187352079537, 14.033396404108396, 5.634397329798758, 100.59867470239254, 12.840819035469636, 12.408713320482251, 91.20735754281468, 97.63928590867381, 27.55176886498441, 16.27544031714682, 47.7387962987938, 213.20503250149503, 15.77096326801183, 7.178286599088974, 21.856568259563034])
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);
([5647751.263498774, 5797085.872288381, 5807581.25, 5888196.01458797, 5889958.716103492, 5943985.9375, 5966987.368510297, 5968243.75, 5968618.644104738, 5972014.639649761, 5972513.722783335, 5991151.884210906, 6106053.092839893, 6124419.950494631, 6147225.186669992, 6186721.1515822895, 6202126.5625, 6202706.228670832, 6203575.0, 6205612.5, 6208596.180759371, 6215273.149249185, 6216054.433836346, 6217228.125, 6219045.53119541, 6219309.314691426, 6220222.410325491, 6220510.9375, 6222298.4375, 6223505.901513659, 6232894.999254361, 6233447.120774744, 6236834.015152822, 6237064.357539391, 6238905.537124014, 6241032.8125, 6241958.603411323, 6242001.5625, 6242814.2964420365, 6243498.027964249, 6243843.901422747, 6246367.257328686, 6252059.11117378, 6261118.5796898585, 6263220.016097065, 6284079.701998032, 6293276.36456403, 6399675.0, 6451926.5625, 6454906.25, 6483962.5, 6535168.231785489, 6538604.743275686, 6539240.207524156, 6587798.018878038, 6595237.5, 6596040.619782462, 6610268.223582465, 6610857.397110258, 6615058.706016109, 6615172.445653754, 6619269.641541628, 6644255.335085135, 6665284.441879435, 6668753.447742069, 6670207.361997676, 6672478.125, 6674454.214408908, 6675556.981667988, 6676123.8899342455, 6677443.009723554, 6677910.867036292, 6678720.276761393, 6678928.243856002, 6679769.431393286, 6681343.8279898865, 6682189.489849128, 6682698.806705364, 6683732.698200825, 6684705.956114481, 6685109.375, 6691204.6875, 6702605.298765378, 6703102.473674273, 6780243.496513066, 6791235.9375, 6813359.731215025, 6813517.1875, 6819205.794155447, 6821328.359726736, 6821876.554828618, 6823194.228225265, 6826418.878728121, 6826457.681890553, 6827315.625, 6833877.064115243, 6833906.964662247, 6836839.0625, 6839506.986407697, 6839932.8125, 6840098.334255985, 6840834.375, 6841542.1875, 6843426.176665009, 6846560.759407894, 6850476.185358425, 6871234.420623801, 6871803.438470639, 6880712.029554455, 6882609.109942503, 6882768.75, 6898467.1875, 6903837.341730969, 6904513.452722614, 6904936.82646119, 6905572.832332818, 6906156.037944807, 6907153.934175801, 6907225.639833252, 6907239.22957146, 6907557.480145619, 6907648.429188633, 6909213.415083054, 6910098.4375, 6915906.25, 6919099.889847837, 6919182.8125, 6919378.461951923, 6919571.875, 6920198.4375, 6921296.729753474, 6921955.64352375, 6922262.5, 6922368.063469247, 6922407.858296976, 6922504.6875, 6924353.125, 6924480.793536442, 6926096.615285978, 6926116.044995883, 6926116.982142664, 6926384.771777791, 6926388.573136694, 6926836.17573074, 6927390.625, 6932051.5625, 6933388.738360766, 6933692.027261821, 6934399.601829349, 6934670.960689288, 6934722.859932731, 6934740.630919204, 6935528.125, 6935683.176450651, 6936219.142485023, 6936562.5, 6936643.75, 6936731.756236346, 6936759.375, 6936828.903160985, 6937150.175793842, 6937216.512362117, 6937270.3125, 6937386.071392135, 6937670.206450871, 6938427.0710892, 6938683.651888707, 6939800.804311167, 6939803.125, 6940185.9375, 6940395.203211878, 6940890.078038451, 6941317.587170314, 6941361.0551121365, 6941760.446951469, 6942439.68941974, 6942471.875, 6942502.1897220155, 6942645.670760155, 6943405.228517007, 6943696.875, 6943880.166624697, 6943954.362253634, 6945468.75, 6945785.241977356, 6947118.828153514, 6947780.871392747, 6948279.6875, 6955418.75, 7114614.0625, 7630831.053404257, 7635538.3294280805, 8297763.4744327525, 8338652.702322396, 8511941.683120048, 8655268.75, 8655378.07279571, 8655694.81642283, 8656824.32707823, 8656831.37256702, 8704243.0365488, 8714876.321562467, 8778048.4375, 8778960.113300866, 8779793.459192883, 8782265.951816311, 8783461.47413826, 8784007.8125, 8873385.676157344, 8873443.04509947, 8880807.610525178, 8883154.497699387, 8888131.25, 8890962.5, 8896448.4375, 8933282.133477623, 8934867.439224737, 8934962.546795148, 8940700.63719161, 8980980.709569287, 8981652.040092167, 8981962.435709994, 8982956.091656927, 8983825.219515778, 9001351.5625, 9005565.625, 9082460.162492532, 9457643.732103208, 9666369.90105126, 9733573.314192994, 9763096.875, 9784253.992464285, 9791321.875, 9809918.75, 9810005.20615935, 9841131.25, 9879705.904872674, 9884491.807420041, 9902263.308837635, 9908610.038376248, 9953934.031802826, 9974292.1875, 9986071.875, 9999151.130191531, 10000510.812679542, 10019974.757125678, 10083878.125, 10087586.24157956, 10122607.667524057, 10131696.155057339, 10142910.487675013, 10170619.305671336, 10170907.8125, 10171342.816998105, 10172054.6704563, 10172367.03861241, 10172667.1875, 10172949.948812878, 10172963.328915829, 10173076.797036102, 10173333.881947141, 10173376.5625, 10173918.75, 10173961.159358652, 10175316.844224118, 10175968.75, 10176020.3125, 10176045.255037269, 10176081.25, 10176519.5928079, 10177136.193818321, 10177488.416714536, 10179974.03132277, 10180055.972593065, 10413397.029212829, 10435684.073881011, 10443768.708562752, 10446515.215805179, 10446525.0, 10477524.219454564, 10490404.6875, 10492885.789728012, 10819776.414922135, 10835904.6875, 10859062.86737891, 10860106.985527273, 10865264.28104504, 11100840.625, 11109383.455310663, 15021244.87660759, 16094752.749901243, 16108555.274290731, 16110439.0625, 16113348.01024047, 16153065.557073772, 16154812.5, 18099238.801673483, 18104753.43057302, 18105001.14647437, 18105217.753686707, 18105520.3125, 18109488.078496918, 18112603.3202819, 18113376.14935965, 18119148.26963311, 18119817.1875, 18121241.598024238, 18125081.84589758, 18129978.489814926, 18130329.6875, 18135493.75, 18136705.743326604, 18139388.448606484, 18139417.144774143, 18139437.279469524, 18140167.179471504, 18141195.05193372, 18142309.73713266, 18143131.25, 18143408.687721405, 18143566.314493284, 18143812.985328913, 18144681.020945847, 18144964.01134809, 18145487.810870584, 18146510.221000075, 18147137.5, 18147576.76433121, 18148453.336885706, 18156322.21453107], [32.45806409819326, 41.75970728180488, 51.630227815318044, 5.145796091792954, 12.910959792149233, 70.00637920469167, 66.28240936415284, 69.84400266991547, 72.89154159661274, 17.717069001243807, 5.330414055197714, 16.328037093615286, 45.289741464342676, 16.733810170901826, 11.432582439788076, 39.04670667099039, 56.92295510133352, 28.10956889180628, 60.56405700347978, 50.340979270683135, 12.823788650505707, 84.09234679678212, 50.75049251366599, 73.51842619875168, 70.84621599683531, 43.35985925178106, 12.082036329881127, 122.25510635264472, 93.75279479739953, 6.695872673072016, 54.98682290944489, 81.78273202698827, 27.0683160620734, 57.25576869754154, 5.318073377720503, 34.64379368988862, 12.639069946011027, 66.08956197729583, 39.79859123785293, 36.973794928685486, 15.551879596342344, 21.673132913561084, 24.224077176148665, 25.561893781476954, 7.045656783765305, 68.14754740640855, 52.575538071534154, 49.449410044315066, 91.90514444760267, 157.98535504044705, 72.46115897758445, 13.276436072506902, 26.42717679030907, 7.458914405490249, 22.34520799003405, 83.17445590930491, 11.47611949232353, 13.254272281993332, 13.563904927254383, 5.501470264334953, 11.892145279744547, 25.888323520055607, 76.42384242252629, 5.464644419493392, 9.620070790142734, 7.448039408240927, 33.07066137005744, 6.040245876823375, 8.715509054699941, 17.00083793534004, 12.71287099665145, 11.019325191456819, 48.350529638541076, 8.350446612371103, 99.23041529428849, 16.96358870794929, 11.868547827200825, 7.742463940347222, 17.974878934781376, 59.620612282299305, 61.87834479244849, 55.7999217726242, 17.9273252692, 55.54994830641183, 6.713933490624197, 53.91804476605328, 64.36974276995824, 40.055662782779166, 13.448626391961843, 7.184552150539651, 22.131044501085334, 7.785873364719979, 28.34561804073539, 105.1259519001306, 45.80798167665456, 17.2739264574946, 18.606944711349115, 37.81468245791332, 60.228770327725414, 73.84336940050173, 26.637766457969438, 91.03957299540558, 44.117238542551114, 45.98842727370281, 6.4595314765961716, 9.03164592407273, 8.310852217684698, 92.40944805765295, 8.96295684674803, 9.116906334476319, 59.87283553579892, 48.1470744505027, 20.304921737712075, 20.463716308885946, 47.15221863015851, 10.297434291688896, 9.158311937683228, 19.290483594982252, 12.300517028276065, 9.476783132323842, 53.02684835096718, 66.27288586133912, 20.138633663580105, 74.79475262542819, 69.7712821294279, 56.48592936347242, 36.593579196259135, 45.738176994431804, 29.615366179315863, 54.80261500713347, 58.21478572087654, 41.86564974378077, 46.45507815894328, 19.81441900387989, 15.11898726982067, 52.95239756647695, 73.15361101029626, 40.61664990353542, 14.036113073046497, 20.681425380986806, 55.33196043224952, 9.691057924839617, 21.599867237634225, 15.934559579515968, 71.20440326511397, 42.87854091145802, 23.447217059296854, 25.716795419998682, 22.572830130696147, 7.855801374384783, 10.330857621876945, 7.605379962163792, 62.83141489667064, 98.32955111907307, 9.686889868297806, 62.41362663188356, 41.463438134892804, 18.49213056293332, 66.57590636000856, 40.82228619153018, 11.414070142952824, 56.09587333668048, 39.21995127904256, 5.823954009429112, 26.5905860266104, 12.028054467325969, 116.91037197089528, 26.4829256973894, 64.66147550850769, 65.93548487144965, 26.536355703169466, 45.76421778129048, 5.07623695135307, 66.35063141506254, 62.892089422354914, 8.648475771221952, 45.47471485956563, 12.27350066141765, 6.126164702785698, 12.093625740487596, 37.04515555587471, 23.04017582555504, 9.070740487900743, 56.28505362628675, 10.190575008572909, 34.338003980480444, 120.26516754311122, 73.6496170278393, 75.70094910861702, 82.41922323739115, 31.791371071413504, 45.38203572241497, 24.61116536127819, 63.0083901194863, 39.06252918857733, 74.58567183784693, 9.287648169601956, 5.440869717908554, 52.258677274280444, 7.154047888580252, 6.380779840302367, 14.09635383218911, 52.3984865906781, 27.580911133190135, 27.155046083805328, 16.352969160454894, 14.412592912491347, 61.771341194462195, 11.353903729167182, 5.029861837821437, 54.87476542979337, 6.45774430899453, 52.252229460043914, 71.17336868261359, 70.10254134080648, 5.882375909307649, 70.32338297182143, 7.13380724984595, 8.654958327994311, 27.516551023993323, 17.13907688036409, 41.02985017700744, 25.746194270867143, 9.524179646139737, 61.17800223662903, 45.95193936114801, 40.15544315319245, 11.099847720452262, 85.15368163368939, 6.739136456956618, 55.50490221789684, 36.3220357233022, 51.73262003170427, 102.39376023038477, 5.216840283949812, 58.871614012040204, 53.30894514170656, 59.52280076790443, 62.482948381520664, 9.963282914219484, 7.0340662137695125, 55.62860170052128, 91.58379258401797, 5.590567258218598, 16.199972049107153, 24.508940442346375, 46.78914657440432, 8.454203298149789, 25.95587775383889, 35.63558294508948, 10.49056468554865, 17.588001322047802, 80.14272905392818, 18.042426801105478, 59.83345765535549, 25.89409382611235, 72.38192164597828, 14.74993250180054, 7.9333360400519926, 7.690326756088138, 64.35522565285092, 64.93043448393364, 163.94010309691166, 15.860400302436876, 5.280600182484121, 75.23941853588097, 109.78540165194083, 41.13227888557571, 35.09966356760147, 32.77768538448883, 16.01760704349166, 10.248918159283388, 7.286818070872984, 142.75856930374192, 8.369846710684588, 66.22161048298841, 70.01870980569743, 45.80691274377049, 38.259702897635535, 19.08699228048805, 45.690361947560945, 5.697417506426846, 9.209659163019204, 31.599484641005255, 5.47775892874718, 19.85345595870433, 5.543782073280224, 116.02255304957926, 18.127706831221406, 22.157367836730607, 10.587997119687932, 62.73542615869198, 48.872543758897095, 13.529779980303767, 133.2209890278989, 68.02700427341418, 35.698686089564255, 27.261194477053127, 60.632836038051686, 5.743764716364925, 51.14633124987099, 112.63585146619748, 25.656627734795286, 27.720190038492152, 168.76501886265726, 59.45702438980651, 20.64467084004398, 5.562717574966435, 24.135315456101303, 49.94605026445158, 57.47598409157397, 6.994341363397568, 20.427516525978135, 14.781121362606392, 70.47783062529855, 37.14187352079537, 14.033396404108396, 5.634397329798758, 100.59867470239254, 12.840819035469636, 12.408713320482251, 91.20735754281468, 97.63928590867381, 27.55176886498441, 16.27544031714682, 47.7387962987938, 213.20503250149503, 15.77096326801183, 7.178286599088974, 21.856568259563034])
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)