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
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"
#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 = 36529 #test discharge for which the notebook will definitely work
shot_no = 43747
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))
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 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=[]
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))
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')
i=i+1
t3pa_cls.close
return T_first, E_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)
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.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.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)
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].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
#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'
#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'
#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)
#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 = 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);
([9083195.3125, 10182789.0625, 10376153.125, 10380454.6875, 10569148.4375, 10673773.4375, 10816226.5625, 10850040.625, 11033610.9375, 11107403.125, 11140881.25, 11141178.125, 11159423.4375, 11168787.5, 11169921.875, 11172668.75, 11172676.5625, 11197417.1875, 11269132.8125, 11301321.875, 11308795.3125, 11317831.25, 11317835.9375, 11350587.5, 11361076.5625, 11361085.9375, 11363829.6875, 11378298.4375, 11378325.0, 11382368.75, 11399018.75, 11402039.0625, 11408114.0625, 11413535.9375, 11413635.9375, 11420401.5625, 11421634.375, 11423942.1875, 11423942.1875, 11435407.8125, 11461831.25, 11461851.5625, 11477467.1875, 11492203.125, 11512348.4375, 11514040.625, 11519203.125, 11526326.5625, 11537045.3125, 11537842.1875, 11537850.0, 11537895.3125, 11549679.6875, 11560057.8125, 11567007.8125, 11584696.875, 11584709.375, 11587085.9375, 11594995.3125, 11596992.1875, 11597140.625, 11597176.5625, 11598784.375, 11606035.9375, 11606060.9375, 11622339.0625, 11625998.4375, 11630465.625, 11633134.375, 11644462.5, 11648828.125, 11671965.625, 11672762.5, 11689535.9375, 11700367.1875, 11701787.5, 11707954.6875, 12869506.25, 13720018.75, 13720195.3125, 13826735.9375, 13830353.125, 14553239.0625, 14942653.125, 14979759.375, 14986278.125, 15106514.0625, 15106906.25, 15107076.5625, 15107629.6875, 15109806.25, 15116287.5, 15116296.875, 15265131.25, 15265131.25, 15265501.5625, 15271242.1875, 15281706.25, 15281981.25, 15282120.3125, 15689129.6875, 15703534.375, 15734323.4375, 15743834.375, 15769982.8125, 15806954.6875, 15806967.1875, 15827843.75, 15827909.375, 15828375.0, 15829437.5, 15843809.375, 15844125.0, 15848131.25, 15869804.6875, 15869875.0, 15870053.125, 15870101.5625, 15876262.5, 15887776.5625, 15905564.0625, 15909437.5, 15911107.8125, 15912131.25, 15912246.875, 15912675.0, 15913689.0625, 15916478.125, 15916548.4375, 15916995.3125, 15917353.125, 15917425.0, 15917817.1875, 15924162.5, 15934145.3125, 15934557.8125, 15934676.5625, 15935028.125, 15935171.875, 15935187.5, 15935210.9375, 15935243.75, 15935318.75, 15935378.125, 15935514.0625, 15935834.375, 15935839.0625, 15935857.8125, 15936004.6875, 15936306.25, 15936420.3125, 15936690.625, 15936737.5, 15939706.25, 15944571.875, 15951662.5, 16002962.5, 16003620.3125, 16006571.875, 16007175.0, 16016734.375, 16021112.5, 16022276.5625, 16027360.9375, 16029414.0625, 16030732.8125, 16030782.8125, 16030848.4375, 16031760.9375, 16032610.9375, 16033679.6875, 16039229.6875, 16039271.875, 16039820.3125, 16041323.4375, 16041645.3125, 16050042.1875, 16125295.3125, 16130775.0, 16134340.625, 16137309.375, 16137332.8125, 16137453.125, 16137478.125, 16209567.1875, 16209628.125, 16210070.3125, 16221350.0, 16354768.75, 16363923.4375, 16364046.875, 16366632.8125, 16368596.875, 16402381.25, 16486526.5625, 16502485.9375, 16507492.1875, 16512137.5, 16524232.8125, 16602504.6875, 16682701.5625, 16687015.625, 16695037.5, 16735682.8125, 16741026.5625, 16768529.6875, 16789253.125, 16815209.375, 16836545.3125, 16905770.3125, 17432898.4375, 17463182.8125, 17526520.3125, 17642045.3125, 17680365.625, 17706306.25, 17884212.5, 17884928.125, 17927818.75, 392946265.625, 392946275.0], [8.453166696423972, 26.536977560692225, 39.90194252200918, 9.655951727732084, 79.24472790495662, 97.44190252542288, 56.79964454994004, 28.844237711370212, 31.14622806560252, 5.460111706668851, 30.310753701678887, 27.871243708892756, 14.10678394756243, 78.13943085307847, 5.882442348756761, 83.1174206740935, 25.00129282900388, 25.92842916938808, 21.006183577711838, 26.29487102164981, 20.401496758064322, 27.87599294915088, 71.21586632181825, 16.64272463966705, 33.00486094831311, 58.42907547678407, 9.598040070187787, 68.8314446528036, 33.762822636767744, 32.84806652940006, 75.43161783259441, 31.115479198378154, 57.99273184158538, 62.65719493240454, 15.139061283108164, 6.472463823344517, 18.493047329644767, 111.94831035248902, 61.322832783241665, 29.071534569542173, 53.22375064718709, 6.615510409027321, 33.77278160517544, 22.608071734135073, 60.476508265623416, 24.478470718701285, 83.08652752739297, 15.392694179916045, 25.440333818796006, 10.539894313720358, 9.721653547919807, 5.121711646246591, 79.57096878429662, 18.86652865795004, 11.188591849259094, 73.60882915093535, 21.627027305687452, 70.83823100974433, 28.645845178510896, 15.60636083639848, 61.09562253903684, 7.07519113185592, 11.022151300074244, 22.655196620247327, 66.71389086779257, 33.52241204754771, 76.07454680526797, 27.504342292235705, 62.69187701570814, 15.68530737143109, 103.9339969284274, 12.246131287815496, 80.13881366121682, 47.83584759324417, 49.04889383143994, 85.51424625497218, 7.447793648932642, 73.3032918014771, 65.28526994832146, 40.33860289726659, 8.508999550379633, 75.75454367824268, 60.96988363064821, 37.8313572546033, 39.69502544280526, 39.362192148120755, 12.240201755825003, 11.031896327023743, 49.10428268083327, 18.94886617781517, 98.94505068831612, 18.25031593758292, 8.402892233204287, 73.77750361905395, 46.77596746159618, 18.48361714168005, 166.1472178925835, 23.92257185390555, 30.10453888505919, 72.08438729545581, 29.870630141359875, 32.53719693598926, 82.51353857328992, 6.708191406880539, 11.081696413657632, 42.36375591666895, 6.562958788221412, 6.866059299157531, 29.083988756663715, 58.9176690419372, 27.937985639878193, 45.62098914769049, 44.67377031427444, 25.882658124340814, 25.269150617645728, 8.867890610221297, 20.549348305188268, 13.112942248035749, 5.113937023066655, 49.05653776760213, 11.81853401293698, 5.930031208869171, 47.43910607628553, 41.17342788049811, 56.52803712294216, 14.1949729019315, 13.70636434228027, 18.82778146125429, 5.082644052939631, 30.072684367681397, 34.141660221941656, 22.362897832851484, 10.079364488819015, 12.4254023555076, 5.491603690509163, 30.436767389629367, 10.478423052271875, 19.355529647283415, 75.32566998789302, 26.446794265542017, 12.476660195346621, 11.362523498125242, 73.68460903746771, 24.63163343590966, 104.52124446095137, 51.79910999458531, 18.277679167360688, 17.303619781779084, 48.41599402140776, 63.72827511994436, 44.05750589180167, 122.54288439496385, 48.548245166778905, 15.392471528958625, 33.7835789879913, 40.54557304671756, 67.8063845415912, 13.657855901927919, 33.52927279360999, 101.06174629498088, 6.847980207605431, 11.318218670462606, 21.026531190179774, 7.665436279370709, 16.643597927477515, 5.789178629913994, 14.752918389428508, 5.558134773624935, 25.480531818267313, 9.766358225275775, 66.41638591418754, 57.36750702100487, 38.4693604781877, 36.39814091461869, 17.415308215077577, 46.16400014888655, 12.072092887537075, 6.814249691715464, 17.209450606468074, 26.93042225866469, 18.925840050300014, 60.98206307088308, 65.09790534505284, 14.445091729546554, 10.910367752808405, 5.357964278174881, 32.711546101131376, 49.64344459520861, 18.805387398668998, 7.816480782955335, 27.58600816384407, 48.41443968638817, 75.24792796204476, 58.07987360551192, 13.838289811659045, 86.0814751492484, 37.391765234394654, 5.932706383640577, 20.32953821764536, 5.932834610549975, 12.845404885022027, 11.659721600108542, 24.14548892643468, 15.275860508258027, 81.77986614265544, 42.128068711961646, 24.23393056644538, 77.88559435543607, 10.232270356804294, 5.162829964627915, 23.6071656962404, 47.91260927976064, 12.575428579652348, 56.07037303811579, 34.071402206386175, 55.64260390087376, 42.7353550576335, 26.467832029760377, 60.20610324052811, 234.35585285759112, 9.480676898895481])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([9083195.3125, 10182789.0625, 10376153.125, 10380454.6875, 10569148.4375, 10673773.4375, 10816226.5625, 10850040.625, 11033610.9375, 11107403.125, 11140881.25, 11141178.125, 11159423.4375, 11168787.5, 11169921.875, 11172668.75, 11172676.5625, 11197417.1875, 11269132.8125, 11301321.875, 11308795.3125, 11317831.25, 11317835.9375, 11350587.5, 11361076.5625, 11361085.9375, 11363829.6875, 11378298.4375, 11378325.0, 11382368.75, 11399018.75, 11402039.0625, 11408114.0625, 11413535.9375, 11413635.9375, 11420401.5625, 11421634.375, 11423942.1875, 11423942.1875, 11435407.8125, 11461831.25, 11461851.5625, 11477467.1875, 11492203.125, 11512348.4375, 11514040.625, 11519203.125, 11526326.5625, 11537045.3125, 11537842.1875, 11537850.0, 11537895.3125, 11549679.6875, 11560057.8125, 11567007.8125, 11584696.875, 11584709.375, 11587085.9375, 11594995.3125, 11596992.1875, 11597140.625, 11597176.5625, 11598784.375, 11606035.9375, 11606060.9375, 11622339.0625, 11625998.4375, 11630465.625, 11633134.375, 11644462.5, 11648828.125, 11671965.625, 11672762.5, 11689535.9375, 11700367.1875, 11701787.5, 11707954.6875, 12869506.25, 13720018.75, 13720195.3125, 13826735.9375, 13830353.125, 14553239.0625, 14942653.125, 14979759.375, 14986278.125, 15106514.0625, 15106906.25, 15107076.5625, 15107629.6875, 15109806.25, 15116287.5, 15116296.875, 15265131.25, 15265131.25, 15265501.5625, 15271242.1875, 15281706.25, 15281981.25, 15282120.3125, 15689129.6875, 15703534.375, 15734323.4375, 15743834.375, 15769982.8125, 15806954.6875, 15806967.1875, 15827843.75, 15827909.375, 15828375.0, 15829437.5, 15843809.375, 15844125.0, 15848131.25, 15869804.6875, 15869875.0, 15870053.125, 15870101.5625, 15876262.5, 15887776.5625, 15905564.0625, 15909437.5, 15911107.8125, 15912131.25, 15912246.875, 15912675.0, 15913689.0625, 15916478.125, 15916548.4375, 15916995.3125, 15917353.125, 15917425.0, 15917817.1875, 15924162.5, 15934145.3125, 15934557.8125, 15934676.5625, 15935028.125, 15935171.875, 15935187.5, 15935210.9375, 15935243.75, 15935318.75, 15935378.125, 15935514.0625, 15935834.375, 15935839.0625, 15935857.8125, 15936004.6875, 15936306.25, 15936420.3125, 15936690.625, 15936737.5, 15939706.25, 15944571.875, 15951662.5, 16002962.5, 16003620.3125, 16006571.875, 16007175.0, 16016734.375, 16021112.5, 16022276.5625, 16027360.9375, 16029414.0625, 16030732.8125, 16030782.8125, 16030848.4375, 16031760.9375, 16032610.9375, 16033679.6875, 16039229.6875, 16039271.875, 16039820.3125, 16041323.4375, 16041645.3125, 16050042.1875, 16125295.3125, 16130775.0, 16134340.625, 16137309.375, 16137332.8125, 16137453.125, 16137478.125, 16209567.1875, 16209628.125, 16210070.3125, 16221350.0, 16354768.75, 16363923.4375, 16364046.875, 16366632.8125, 16368596.875, 16402381.25, 16486526.5625, 16502485.9375, 16507492.1875, 16512137.5, 16524232.8125, 16602504.6875, 16682701.5625, 16687015.625, 16695037.5, 16735682.8125, 16741026.5625, 16768529.6875, 16789253.125, 16815209.375, 16836545.3125, 16905770.3125, 17432898.4375, 17463182.8125, 17526520.3125, 17642045.3125, 17680365.625, 17706306.25, 17884212.5, 17884928.125, 17927818.75, 392946265.625, 392946275.0], [8.453166696423972, 26.536977560692225, 39.90194252200918, 9.655951727732084, 79.24472790495662, 97.44190252542288, 56.79964454994004, 28.844237711370212, 31.14622806560252, 5.460111706668851, 30.310753701678887, 27.871243708892756, 14.10678394756243, 78.13943085307847, 5.882442348756761, 83.1174206740935, 25.00129282900388, 25.92842916938808, 21.006183577711838, 26.29487102164981, 20.401496758064322, 27.87599294915088, 71.21586632181825, 16.64272463966705, 33.00486094831311, 58.42907547678407, 9.598040070187787, 68.8314446528036, 33.762822636767744, 32.84806652940006, 75.43161783259441, 31.115479198378154, 57.99273184158538, 62.65719493240454, 15.139061283108164, 6.472463823344517, 18.493047329644767, 111.94831035248902, 61.322832783241665, 29.071534569542173, 53.22375064718709, 6.615510409027321, 33.77278160517544, 22.608071734135073, 60.476508265623416, 24.478470718701285, 83.08652752739297, 15.392694179916045, 25.440333818796006, 10.539894313720358, 9.721653547919807, 5.121711646246591, 79.57096878429662, 18.86652865795004, 11.188591849259094, 73.60882915093535, 21.627027305687452, 70.83823100974433, 28.645845178510896, 15.60636083639848, 61.09562253903684, 7.07519113185592, 11.022151300074244, 22.655196620247327, 66.71389086779257, 33.52241204754771, 76.07454680526797, 27.504342292235705, 62.69187701570814, 15.68530737143109, 103.9339969284274, 12.246131287815496, 80.13881366121682, 47.83584759324417, 49.04889383143994, 85.51424625497218, 7.447793648932642, 73.3032918014771, 65.28526994832146, 40.33860289726659, 8.508999550379633, 75.75454367824268, 60.96988363064821, 37.8313572546033, 39.69502544280526, 39.362192148120755, 12.240201755825003, 11.031896327023743, 49.10428268083327, 18.94886617781517, 98.94505068831612, 18.25031593758292, 8.402892233204287, 73.77750361905395, 46.77596746159618, 18.48361714168005, 166.1472178925835, 23.92257185390555, 30.10453888505919, 72.08438729545581, 29.870630141359875, 32.53719693598926, 82.51353857328992, 6.708191406880539, 11.081696413657632, 42.36375591666895, 6.562958788221412, 6.866059299157531, 29.083988756663715, 58.9176690419372, 27.937985639878193, 45.62098914769049, 44.67377031427444, 25.882658124340814, 25.269150617645728, 8.867890610221297, 20.549348305188268, 13.112942248035749, 5.113937023066655, 49.05653776760213, 11.81853401293698, 5.930031208869171, 47.43910607628553, 41.17342788049811, 56.52803712294216, 14.1949729019315, 13.70636434228027, 18.82778146125429, 5.082644052939631, 30.072684367681397, 34.141660221941656, 22.362897832851484, 10.079364488819015, 12.4254023555076, 5.491603690509163, 30.436767389629367, 10.478423052271875, 19.355529647283415, 75.32566998789302, 26.446794265542017, 12.476660195346621, 11.362523498125242, 73.68460903746771, 24.63163343590966, 104.52124446095137, 51.79910999458531, 18.277679167360688, 17.303619781779084, 48.41599402140776, 63.72827511994436, 44.05750589180167, 122.54288439496385, 48.548245166778905, 15.392471528958625, 33.7835789879913, 40.54557304671756, 67.8063845415912, 13.657855901927919, 33.52927279360999, 101.06174629498088, 6.847980207605431, 11.318218670462606, 21.026531190179774, 7.665436279370709, 16.643597927477515, 5.789178629913994, 14.752918389428508, 5.558134773624935, 25.480531818267313, 9.766358225275775, 66.41638591418754, 57.36750702100487, 38.4693604781877, 36.39814091461869, 17.415308215077577, 46.16400014888655, 12.072092887537075, 6.814249691715464, 17.209450606468074, 26.93042225866469, 18.925840050300014, 60.98206307088308, 65.09790534505284, 14.445091729546554, 10.910367752808405, 5.357964278174881, 32.711546101131376, 49.64344459520861, 18.805387398668998, 7.816480782955335, 27.58600816384407, 48.41443968638817, 75.24792796204476, 58.07987360551192, 13.838289811659045, 86.0814751492484, 37.391765234394654, 5.932706383640577, 20.32953821764536, 5.932834610549975, 12.845404885022027, 11.659721600108542, 24.14548892643468, 15.275860508258027, 81.77986614265544, 42.128068711961646, 24.23393056644538, 77.88559435543607, 10.232270356804294, 5.162829964627915, 23.6071656962404, 47.91260927976064, 12.575428579652348, 56.07037303811579, 34.071402206386175, 55.64260390087376, 42.7353550576335, 26.467832029760377, 60.20610324052811, 234.35585285759112, 9.480676898895481])
caption, T_hit,count = 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, count, caption);
([9083195.3125, 10182789.0625, 10376153.125, 10380454.6875, 10569148.4375, 10673773.4375, 10816226.5625, 10850040.625, 11033610.9375, 11107403.125, 11140881.25, 11141178.125, 11159423.4375, 11168787.5, 11169921.875, 11172668.75, 11172676.5625, 11197417.1875, 11269132.8125, 11301321.875, 11308795.3125, 11317831.25, 11317835.9375, 11350587.5, 11361076.5625, 11361085.9375, 11363829.6875, 11378298.4375, 11378325.0, 11382368.75, 11399018.75, 11402039.0625, 11408114.0625, 11413535.9375, 11413635.9375, 11420401.5625, 11421634.375, 11423942.1875, 11423942.1875, 11435407.8125, 11461831.25, 11461851.5625, 11477467.1875, 11492203.125, 11512348.4375, 11514040.625, 11519203.125, 11526326.5625, 11537045.3125, 11537842.1875, 11537850.0, 11537895.3125, 11549679.6875, 11560057.8125, 11567007.8125, 11584696.875, 11584709.375, 11587085.9375, 11594995.3125, 11596992.1875, 11597140.625, 11597176.5625, 11598784.375, 11606035.9375, 11606060.9375, 11622339.0625, 11625998.4375, 11630465.625, 11633134.375, 11644462.5, 11648828.125, 11671965.625, 11672762.5, 11689535.9375, 11700367.1875, 11701787.5, 11707954.6875, 12869506.25, 13720018.75, 13720195.3125, 13826735.9375, 13830353.125, 14553239.0625, 14942653.125, 14979759.375, 14986278.125, 15106514.0625, 15106906.25, 15107076.5625, 15107629.6875, 15109806.25, 15116287.5, 15116296.875, 15265131.25, 15265131.25, 15265501.5625, 15271242.1875, 15281706.25, 15281981.25, 15282120.3125, 15689129.6875, 15703534.375, 15734323.4375, 15743834.375, 15769982.8125, 15806954.6875, 15806967.1875, 15827843.75, 15827909.375, 15828375.0, 15829437.5, 15843809.375, 15844125.0, 15848131.25, 15869804.6875, 15869875.0, 15870053.125, 15870101.5625, 15876262.5, 15887776.5625, 15905564.0625, 15909437.5, 15911107.8125, 15912131.25, 15912246.875, 15912675.0, 15913689.0625, 15916478.125, 15916548.4375, 15916995.3125, 15917353.125, 15917425.0, 15917817.1875, 15924162.5, 15934145.3125, 15934557.8125, 15934676.5625, 15935028.125, 15935171.875, 15935187.5, 15935210.9375, 15935243.75, 15935318.75, 15935378.125, 15935514.0625, 15935834.375, 15935839.0625, 15935857.8125, 15936004.6875, 15936306.25, 15936420.3125, 15936690.625, 15936737.5, 15939706.25, 15944571.875, 15951662.5, 16002962.5, 16003620.3125, 16006571.875, 16007175.0, 16016734.375, 16021112.5, 16022276.5625, 16027360.9375, 16029414.0625, 16030732.8125, 16030782.8125, 16030848.4375, 16031760.9375, 16032610.9375, 16033679.6875, 16039229.6875, 16039271.875, 16039820.3125, 16041323.4375, 16041645.3125, 16050042.1875, 16125295.3125, 16130775.0, 16134340.625, 16137309.375, 16137332.8125, 16137453.125, 16137478.125, 16209567.1875, 16209628.125, 16210070.3125, 16221350.0, 16354768.75, 16363923.4375, 16364046.875, 16366632.8125, 16368596.875, 16402381.25, 16486526.5625, 16502485.9375, 16507492.1875, 16512137.5, 16524232.8125, 16602504.6875, 16682701.5625, 16687015.625, 16695037.5, 16735682.8125, 16741026.5625, 16768529.6875, 16789253.125, 16815209.375, 16836545.3125, 16905770.3125, 17432898.4375, 17463182.8125, 17526520.3125, 17642045.3125, 17680365.625, 17706306.25, 17884212.5, 17884928.125, 17927818.75, 392946265.625, 392946275.0], [8.453166696423972, 26.536977560692225, 39.90194252200918, 9.655951727732084, 79.24472790495662, 97.44190252542288, 56.79964454994004, 28.844237711370212, 31.14622806560252, 5.460111706668851, 30.310753701678887, 27.871243708892756, 14.10678394756243, 78.13943085307847, 5.882442348756761, 83.1174206740935, 25.00129282900388, 25.92842916938808, 21.006183577711838, 26.29487102164981, 20.401496758064322, 27.87599294915088, 71.21586632181825, 16.64272463966705, 33.00486094831311, 58.42907547678407, 9.598040070187787, 68.8314446528036, 33.762822636767744, 32.84806652940006, 75.43161783259441, 31.115479198378154, 57.99273184158538, 62.65719493240454, 15.139061283108164, 6.472463823344517, 18.493047329644767, 111.94831035248902, 61.322832783241665, 29.071534569542173, 53.22375064718709, 6.615510409027321, 33.77278160517544, 22.608071734135073, 60.476508265623416, 24.478470718701285, 83.08652752739297, 15.392694179916045, 25.440333818796006, 10.539894313720358, 9.721653547919807, 5.121711646246591, 79.57096878429662, 18.86652865795004, 11.188591849259094, 73.60882915093535, 21.627027305687452, 70.83823100974433, 28.645845178510896, 15.60636083639848, 61.09562253903684, 7.07519113185592, 11.022151300074244, 22.655196620247327, 66.71389086779257, 33.52241204754771, 76.07454680526797, 27.504342292235705, 62.69187701570814, 15.68530737143109, 103.9339969284274, 12.246131287815496, 80.13881366121682, 47.83584759324417, 49.04889383143994, 85.51424625497218, 7.447793648932642, 73.3032918014771, 65.28526994832146, 40.33860289726659, 8.508999550379633, 75.75454367824268, 60.96988363064821, 37.8313572546033, 39.69502544280526, 39.362192148120755, 12.240201755825003, 11.031896327023743, 49.10428268083327, 18.94886617781517, 98.94505068831612, 18.25031593758292, 8.402892233204287, 73.77750361905395, 46.77596746159618, 18.48361714168005, 166.1472178925835, 23.92257185390555, 30.10453888505919, 72.08438729545581, 29.870630141359875, 32.53719693598926, 82.51353857328992, 6.708191406880539, 11.081696413657632, 42.36375591666895, 6.562958788221412, 6.866059299157531, 29.083988756663715, 58.9176690419372, 27.937985639878193, 45.62098914769049, 44.67377031427444, 25.882658124340814, 25.269150617645728, 8.867890610221297, 20.549348305188268, 13.112942248035749, 5.113937023066655, 49.05653776760213, 11.81853401293698, 5.930031208869171, 47.43910607628553, 41.17342788049811, 56.52803712294216, 14.1949729019315, 13.70636434228027, 18.82778146125429, 5.082644052939631, 30.072684367681397, 34.141660221941656, 22.362897832851484, 10.079364488819015, 12.4254023555076, 5.491603690509163, 30.436767389629367, 10.478423052271875, 19.355529647283415, 75.32566998789302, 26.446794265542017, 12.476660195346621, 11.362523498125242, 73.68460903746771, 24.63163343590966, 104.52124446095137, 51.79910999458531, 18.277679167360688, 17.303619781779084, 48.41599402140776, 63.72827511994436, 44.05750589180167, 122.54288439496385, 48.548245166778905, 15.392471528958625, 33.7835789879913, 40.54557304671756, 67.8063845415912, 13.657855901927919, 33.52927279360999, 101.06174629498088, 6.847980207605431, 11.318218670462606, 21.026531190179774, 7.665436279370709, 16.643597927477515, 5.789178629913994, 14.752918389428508, 5.558134773624935, 25.480531818267313, 9.766358225275775, 66.41638591418754, 57.36750702100487, 38.4693604781877, 36.39814091461869, 17.415308215077577, 46.16400014888655, 12.072092887537075, 6.814249691715464, 17.209450606468074, 26.93042225866469, 18.925840050300014, 60.98206307088308, 65.09790534505284, 14.445091729546554, 10.910367752808405, 5.357964278174881, 32.711546101131376, 49.64344459520861, 18.805387398668998, 7.816480782955335, 27.58600816384407, 48.41443968638817, 75.24792796204476, 58.07987360551192, 13.838289811659045, 86.0814751492484, 37.391765234394654, 5.932706383640577, 20.32953821764536, 5.932834610549975, 12.845404885022027, 11.659721600108542, 24.14548892643468, 15.275860508258027, 81.77986614265544, 42.128068711961646, 24.23393056644538, 77.88559435543607, 10.232270356804294, 5.162829964627915, 23.6071656962404, 47.91260927976064, 12.575428579652348, 56.07037303811579, 34.071402206386175, 55.64260390087376, 42.7353550576335, 26.467832029760377, 60.20610324052811, 234.35585285759112, 9.480676898895481])
Detected energies during the discharge + Energy spectrum
multiplot(icon_fig, T_int_first,E,xle,Etot)