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 = 44401
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);
([3834512.5, 3917800.0, 3918670.3125, 3920931.25, 3957435.9375, 3958721.875, 3959410.9375, 3961029.6875, 3961568.75, 3963787.5, 3964084.375, 3966550.0, 4000242.1875, 4007804.6875, 4010793.75, 4023703.125, 4027806.25, 4028543.75, 4028545.3125, 4031776.5625, 4034278.125, 4035223.4375, 4036334.375, 4047578.125, 4047700.0, 4048014.0625, 4051753.125, 4053048.4375, 4057712.5, 4058896.875, 4059550.0, 4061289.0625, 4062640.625, 4062682.8125, 4065512.5, 4065593.75, 4067859.375, 4070018.75, 4094818.75, 4101978.125, 4102284.375, 4102990.625, 4103781.25, 4105573.4375, 4107657.8125, 4111114.0625, 4111851.5625, 4111920.3125, 4119071.875, 4142865.625, 4144796.875, 4147406.25, 4162062.5, 4169123.4375, 4172865.625, 4197876.5625, 4197939.0625, 4199457.8125, 4199689.0625, 4202975.0, 4204929.6875, 4204960.9375, 4207864.0625, 4215523.4375, 4224632.8125, 4235264.0625, 4237282.8125, 4238671.875, 4243678.125, 4243767.1875, 4272471.875, 4282859.375, 4296650.0, 4304270.3125, 4305860.9375, 4308075.0, 4315667.1875, 4317798.4375, 4321640.625, 4325117.1875, 4337292.1875, 4345670.3125, 4350210.9375, 4370200.0, 4378818.75, 4387156.25, 4406679.6875, 4418225.0, 4422820.3125, 4422857.8125, 4426798.4375, 4442595.3125, 4448660.9375, 4448667.1875, 4450775.0, 4465239.0625, 4468121.875, 4473260.9375, 4474839.0625, 4515917.1875, 4521576.5625, 4526615.625, 4531145.3125, 4538592.1875, 4543850.0, 4544265.625, 4549582.8125, 4550004.6875, 4554059.375, 4559662.5, 4574032.8125, 4579070.3125, 4580795.3125, 4580804.6875, 4581342.1875, 4582087.5, 4584385.9375, 4584881.25, 4588967.1875, 4601703.125, 4605346.875, 4605446.875, 4606176.5625, 4606476.5625, 4609562.5, 4610871.875, 4621525.0, 4636026.5625, 4665871.875, 4670603.125, 4680237.5, 4681114.0625, 4686032.8125, 4686875.0, 4693018.75, 4694448.4375, 4710740.625, 4716345.3125, 4731534.375, 4732837.5, 4733431.25, 4738228.125, 4738781.25, 4739056.25, 4744540.625, 4746201.5625, 4748865.625, 4749543.75, 4752195.3125, 4753492.1875, 4761123.4375, 4764553.125, 4786640.625, 4803250.0, 4816406.25, 4818640.625, 4818728.125, 4824912.5, 4829068.75, 4861593.75, 4894976.5625, 4896626.5625, 4908739.0625, 4919403.125, 4934945.3125, 4941953.125, 4954945.3125, 4964045.3125, 4972671.875, 4997987.5, 5002778.125, 5006420.3125, 5015173.4375, 5018148.4375, 5177853.125, 5615060.9375, 5622062.5, 5796357.8125, 5796395.3125, 8276298.4375], [42.65730189550065, 6.701980373539772, 27.892551346922215, 11.000823016695872, 6.700948086920296, 57.396679511443566, 14.210925352787143, 53.94294716321903, 48.25343563560581, 9.279397058814778, 22.765316589606776, 34.93217846114086, 66.39696926910509, 43.63748528156386, 34.0340281452312, 54.999339256177414, 14.297876240679267, 11.087819473140604, 11.154539371321162, 5.330683797674293, 21.14169672921108, 45.74421962128528, 53.13152207108401, 52.24746555401655, 16.48552159756242, 18.016633065606918, 5.653372624039594, 5.747463805509213, 6.011707405083474, 33.073234305183895, 41.857304994889475, 7.501859028719831, 40.718835189556245, 92.140272824525, 47.79027917160562, 24.251605687428846, 59.59318179372187, 7.874594634818003, 26.94006424708756, 62.924268202405415, 5.366431166862817, 5.353084624495261, 16.15463317367083, 12.237498190596733, 42.6799838634229, 60.262401151243324, 7.513609223978689, 52.01112327626161, 64.95023168173469, 8.112119537387764, 10.424720445434273, 53.818828861607905, 72.42738855574824, 16.883735680029393, 13.09860725644401, 50.24053723880016, 5.077217790220589, 50.39724233256396, 55.39736174034644, 8.954022364437378, 16.24235608597736, 12.87117363750897, 5.467761170076013, 29.47687155689561, 39.75808432623791, 21.601085763031413, 8.691278182946839, 52.05474095514337, 75.27736526587759, 19.724005129956502, 6.657396017693184, 5.088387618080069, 58.02594494145526, 78.21571007066719, 13.215409572504061, 11.986435626890959, 10.51218828040741, 56.061346993129256, 12.412520138624995, 59.561891134233086, 11.04050284279097, 8.946330510944618, 16.28395245393409, 52.73951229210318, 51.848233348108415, 5.3875077868487695, 84.92667116753509, 50.965002950176, 45.22789933369535, 5.38743755809286, 11.760551023293134, 47.35367522552449, 17.067213880206975, 14.497088275686393, 11.39420970348703, 6.97249064890443, 98.11106541130103, 23.033685025682097, 10.66647497829483, 14.139910177518395, 75.46178059509212, 8.168535733359942, 13.990414306350464, 81.55870527879938, 38.8056190894588, 20.970438902353877, 5.292135067698038, 44.44443070180711, 24.948777033424808, 8.454693247644538, 60.69595564499167, 24.30326919225534, 11.297406301366815, 14.194797464837714, 71.67892259128523, 9.494111985293783, 8.919847938353394, 5.971366082312689, 55.0432436513788, 18.987478952330623, 5.417702883584555, 68.18655255930936, 23.896457409692502, 11.673424840897479, 70.01157202161828, 61.37118864916345, 87.3807384511726, 51.82318762487179, 62.619806710120784, 17.573150474605846, 34.83211188584373, 14.774078201989566, 8.58876615905702, 81.71606350943011, 15.076592833144494, 37.665280631725935, 94.74326967154872, 28.54715727712141, 14.515113867004503, 98.80368738423967, 53.609013575942114, 9.906146593331856, 17.367804343845062, 24.9903651179346, 6.749082004063637, 39.762600486207724, 14.736170124679166, 23.63191785406357, 45.252776678538986, 16.127890282240042, 63.519088384931635, 98.14486741407163, 77.43608432983109, 49.20765389359299, 7.364422858323399, 48.92884120369242, 6.074128129576664, 14.37857246133744, 44.02531591109067, 24.28560533954145, 9.87269453923996, 5.386793660075579, 25.809373114156855, 21.396317212896864, 104.11996003977104, 62.91172969643565, 21.483149784612124, 22.211344977344748, 37.4965868842627, 18.518608198914396, 21.493134079106067, 18.1680172928914, 42.98606829803312, 35.839105910857434, 6.227488675429892, 20.672348391738666, 80.24198287729034, 26.949847782450004, 84.38251762406979, 52.496879729104194])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([3834512.5, 3917800.0, 3918670.3125, 3920931.25, 3957435.9375, 3958721.875, 3959410.9375, 3961029.6875, 3961568.75, 3963787.5, 3964084.375, 3966550.0, 4000242.1875, 4007804.6875, 4010793.75, 4023703.125, 4027806.25, 4028543.75, 4028545.3125, 4031776.5625, 4034278.125, 4035223.4375, 4036334.375, 4047578.125, 4047700.0, 4048014.0625, 4051753.125, 4053048.4375, 4057712.5, 4058896.875, 4059550.0, 4061289.0625, 4062640.625, 4062682.8125, 4065512.5, 4065593.75, 4067859.375, 4070018.75, 4094818.75, 4101978.125, 4102284.375, 4102990.625, 4103781.25, 4105573.4375, 4107657.8125, 4111114.0625, 4111851.5625, 4111920.3125, 4119071.875, 4142865.625, 4144796.875, 4147406.25, 4162062.5, 4169123.4375, 4172865.625, 4197876.5625, 4197939.0625, 4199457.8125, 4199689.0625, 4202975.0, 4204929.6875, 4204960.9375, 4207864.0625, 4215523.4375, 4224632.8125, 4235264.0625, 4237282.8125, 4238671.875, 4243678.125, 4243767.1875, 4272471.875, 4282859.375, 4296650.0, 4304270.3125, 4305860.9375, 4308075.0, 4315667.1875, 4317798.4375, 4321640.625, 4325117.1875, 4337292.1875, 4345670.3125, 4350210.9375, 4370200.0, 4378818.75, 4387156.25, 4406679.6875, 4418225.0, 4422820.3125, 4422857.8125, 4426798.4375, 4442595.3125, 4448660.9375, 4448667.1875, 4450775.0, 4465239.0625, 4468121.875, 4473260.9375, 4474839.0625, 4515917.1875, 4521576.5625, 4526615.625, 4531145.3125, 4538592.1875, 4543850.0, 4544265.625, 4549582.8125, 4550004.6875, 4554059.375, 4559662.5, 4574032.8125, 4579070.3125, 4580795.3125, 4580804.6875, 4581342.1875, 4582087.5, 4584385.9375, 4584881.25, 4588967.1875, 4601703.125, 4605346.875, 4605446.875, 4606176.5625, 4606476.5625, 4609562.5, 4610871.875, 4621525.0, 4636026.5625, 4665871.875, 4670603.125, 4680237.5, 4681114.0625, 4686032.8125, 4686875.0, 4693018.75, 4694448.4375, 4710740.625, 4716345.3125, 4731534.375, 4732837.5, 4733431.25, 4738228.125, 4738781.25, 4739056.25, 4744540.625, 4746201.5625, 4748865.625, 4749543.75, 4752195.3125, 4753492.1875, 4761123.4375, 4764553.125, 4786640.625, 4803250.0, 4816406.25, 4818640.625, 4818728.125, 4824912.5, 4829068.75, 4861593.75, 4894976.5625, 4896626.5625, 4908739.0625, 4919403.125, 4934945.3125, 4941953.125, 4954945.3125, 4964045.3125, 4972671.875, 4997987.5, 5002778.125, 5006420.3125, 5015173.4375, 5018148.4375, 5177853.125, 5615060.9375, 5622062.5, 5796357.8125, 5796395.3125, 8276298.4375], [42.65730189550065, 6.701980373539772, 27.892551346922215, 11.000823016695872, 6.700948086920296, 57.396679511443566, 14.210925352787143, 53.94294716321903, 48.25343563560581, 9.279397058814778, 22.765316589606776, 34.93217846114086, 66.39696926910509, 43.63748528156386, 34.0340281452312, 54.999339256177414, 14.297876240679267, 11.087819473140604, 11.154539371321162, 5.330683797674293, 21.14169672921108, 45.74421962128528, 53.13152207108401, 52.24746555401655, 16.48552159756242, 18.016633065606918, 5.653372624039594, 5.747463805509213, 6.011707405083474, 33.073234305183895, 41.857304994889475, 7.501859028719831, 40.718835189556245, 92.140272824525, 47.79027917160562, 24.251605687428846, 59.59318179372187, 7.874594634818003, 26.94006424708756, 62.924268202405415, 5.366431166862817, 5.353084624495261, 16.15463317367083, 12.237498190596733, 42.6799838634229, 60.262401151243324, 7.513609223978689, 52.01112327626161, 64.95023168173469, 8.112119537387764, 10.424720445434273, 53.818828861607905, 72.42738855574824, 16.883735680029393, 13.09860725644401, 50.24053723880016, 5.077217790220589, 50.39724233256396, 55.39736174034644, 8.954022364437378, 16.24235608597736, 12.87117363750897, 5.467761170076013, 29.47687155689561, 39.75808432623791, 21.601085763031413, 8.691278182946839, 52.05474095514337, 75.27736526587759, 19.724005129956502, 6.657396017693184, 5.088387618080069, 58.02594494145526, 78.21571007066719, 13.215409572504061, 11.986435626890959, 10.51218828040741, 56.061346993129256, 12.412520138624995, 59.561891134233086, 11.04050284279097, 8.946330510944618, 16.28395245393409, 52.73951229210318, 51.848233348108415, 5.3875077868487695, 84.92667116753509, 50.965002950176, 45.22789933369535, 5.38743755809286, 11.760551023293134, 47.35367522552449, 17.067213880206975, 14.497088275686393, 11.39420970348703, 6.97249064890443, 98.11106541130103, 23.033685025682097, 10.66647497829483, 14.139910177518395, 75.46178059509212, 8.168535733359942, 13.990414306350464, 81.55870527879938, 38.8056190894588, 20.970438902353877, 5.292135067698038, 44.44443070180711, 24.948777033424808, 8.454693247644538, 60.69595564499167, 24.30326919225534, 11.297406301366815, 14.194797464837714, 71.67892259128523, 9.494111985293783, 8.919847938353394, 5.971366082312689, 55.0432436513788, 18.987478952330623, 5.417702883584555, 68.18655255930936, 23.896457409692502, 11.673424840897479, 70.01157202161828, 61.37118864916345, 87.3807384511726, 51.82318762487179, 62.619806710120784, 17.573150474605846, 34.83211188584373, 14.774078201989566, 8.58876615905702, 81.71606350943011, 15.076592833144494, 37.665280631725935, 94.74326967154872, 28.54715727712141, 14.515113867004503, 98.80368738423967, 53.609013575942114, 9.906146593331856, 17.367804343845062, 24.9903651179346, 6.749082004063637, 39.762600486207724, 14.736170124679166, 23.63191785406357, 45.252776678538986, 16.127890282240042, 63.519088384931635, 98.14486741407163, 77.43608432983109, 49.20765389359299, 7.364422858323399, 48.92884120369242, 6.074128129576664, 14.37857246133744, 44.02531591109067, 24.28560533954145, 9.87269453923996, 5.386793660075579, 25.809373114156855, 21.396317212896864, 104.11996003977104, 62.91172969643565, 21.483149784612124, 22.211344977344748, 37.4965868842627, 18.518608198914396, 21.493134079106067, 18.1680172928914, 42.98606829803312, 35.839105910857434, 6.227488675429892, 20.672348391738666, 80.24198287729034, 26.949847782450004, 84.38251762406979, 52.496879729104194])
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);
([3834512.5, 3917800.0, 3918670.3125, 3920931.25, 3957435.9375, 3958721.875, 3959410.9375, 3961029.6875, 3961568.75, 3963787.5, 3964084.375, 3966550.0, 4000242.1875, 4007804.6875, 4010793.75, 4023703.125, 4027806.25, 4028543.75, 4028545.3125, 4031776.5625, 4034278.125, 4035223.4375, 4036334.375, 4047578.125, 4047700.0, 4048014.0625, 4051753.125, 4053048.4375, 4057712.5, 4058896.875, 4059550.0, 4061289.0625, 4062640.625, 4062682.8125, 4065512.5, 4065593.75, 4067859.375, 4070018.75, 4094818.75, 4101978.125, 4102284.375, 4102990.625, 4103781.25, 4105573.4375, 4107657.8125, 4111114.0625, 4111851.5625, 4111920.3125, 4119071.875, 4142865.625, 4144796.875, 4147406.25, 4162062.5, 4169123.4375, 4172865.625, 4197876.5625, 4197939.0625, 4199457.8125, 4199689.0625, 4202975.0, 4204929.6875, 4204960.9375, 4207864.0625, 4215523.4375, 4224632.8125, 4235264.0625, 4237282.8125, 4238671.875, 4243678.125, 4243767.1875, 4272471.875, 4282859.375, 4296650.0, 4304270.3125, 4305860.9375, 4308075.0, 4315667.1875, 4317798.4375, 4321640.625, 4325117.1875, 4337292.1875, 4345670.3125, 4350210.9375, 4370200.0, 4378818.75, 4387156.25, 4406679.6875, 4418225.0, 4422820.3125, 4422857.8125, 4426798.4375, 4442595.3125, 4448660.9375, 4448667.1875, 4450775.0, 4465239.0625, 4468121.875, 4473260.9375, 4474839.0625, 4515917.1875, 4521576.5625, 4526615.625, 4531145.3125, 4538592.1875, 4543850.0, 4544265.625, 4549582.8125, 4550004.6875, 4554059.375, 4559662.5, 4574032.8125, 4579070.3125, 4580795.3125, 4580804.6875, 4581342.1875, 4582087.5, 4584385.9375, 4584881.25, 4588967.1875, 4601703.125, 4605346.875, 4605446.875, 4606176.5625, 4606476.5625, 4609562.5, 4610871.875, 4621525.0, 4636026.5625, 4665871.875, 4670603.125, 4680237.5, 4681114.0625, 4686032.8125, 4686875.0, 4693018.75, 4694448.4375, 4710740.625, 4716345.3125, 4731534.375, 4732837.5, 4733431.25, 4738228.125, 4738781.25, 4739056.25, 4744540.625, 4746201.5625, 4748865.625, 4749543.75, 4752195.3125, 4753492.1875, 4761123.4375, 4764553.125, 4786640.625, 4803250.0, 4816406.25, 4818640.625, 4818728.125, 4824912.5, 4829068.75, 4861593.75, 4894976.5625, 4896626.5625, 4908739.0625, 4919403.125, 4934945.3125, 4941953.125, 4954945.3125, 4964045.3125, 4972671.875, 4997987.5, 5002778.125, 5006420.3125, 5015173.4375, 5018148.4375, 5177853.125, 5615060.9375, 5622062.5, 5796357.8125, 5796395.3125, 8276298.4375], [42.65730189550065, 6.701980373539772, 27.892551346922215, 11.000823016695872, 6.700948086920296, 57.396679511443566, 14.210925352787143, 53.94294716321903, 48.25343563560581, 9.279397058814778, 22.765316589606776, 34.93217846114086, 66.39696926910509, 43.63748528156386, 34.0340281452312, 54.999339256177414, 14.297876240679267, 11.087819473140604, 11.154539371321162, 5.330683797674293, 21.14169672921108, 45.74421962128528, 53.13152207108401, 52.24746555401655, 16.48552159756242, 18.016633065606918, 5.653372624039594, 5.747463805509213, 6.011707405083474, 33.073234305183895, 41.857304994889475, 7.501859028719831, 40.718835189556245, 92.140272824525, 47.79027917160562, 24.251605687428846, 59.59318179372187, 7.874594634818003, 26.94006424708756, 62.924268202405415, 5.366431166862817, 5.353084624495261, 16.15463317367083, 12.237498190596733, 42.6799838634229, 60.262401151243324, 7.513609223978689, 52.01112327626161, 64.95023168173469, 8.112119537387764, 10.424720445434273, 53.818828861607905, 72.42738855574824, 16.883735680029393, 13.09860725644401, 50.24053723880016, 5.077217790220589, 50.39724233256396, 55.39736174034644, 8.954022364437378, 16.24235608597736, 12.87117363750897, 5.467761170076013, 29.47687155689561, 39.75808432623791, 21.601085763031413, 8.691278182946839, 52.05474095514337, 75.27736526587759, 19.724005129956502, 6.657396017693184, 5.088387618080069, 58.02594494145526, 78.21571007066719, 13.215409572504061, 11.986435626890959, 10.51218828040741, 56.061346993129256, 12.412520138624995, 59.561891134233086, 11.04050284279097, 8.946330510944618, 16.28395245393409, 52.73951229210318, 51.848233348108415, 5.3875077868487695, 84.92667116753509, 50.965002950176, 45.22789933369535, 5.38743755809286, 11.760551023293134, 47.35367522552449, 17.067213880206975, 14.497088275686393, 11.39420970348703, 6.97249064890443, 98.11106541130103, 23.033685025682097, 10.66647497829483, 14.139910177518395, 75.46178059509212, 8.168535733359942, 13.990414306350464, 81.55870527879938, 38.8056190894588, 20.970438902353877, 5.292135067698038, 44.44443070180711, 24.948777033424808, 8.454693247644538, 60.69595564499167, 24.30326919225534, 11.297406301366815, 14.194797464837714, 71.67892259128523, 9.494111985293783, 8.919847938353394, 5.971366082312689, 55.0432436513788, 18.987478952330623, 5.417702883584555, 68.18655255930936, 23.896457409692502, 11.673424840897479, 70.01157202161828, 61.37118864916345, 87.3807384511726, 51.82318762487179, 62.619806710120784, 17.573150474605846, 34.83211188584373, 14.774078201989566, 8.58876615905702, 81.71606350943011, 15.076592833144494, 37.665280631725935, 94.74326967154872, 28.54715727712141, 14.515113867004503, 98.80368738423967, 53.609013575942114, 9.906146593331856, 17.367804343845062, 24.9903651179346, 6.749082004063637, 39.762600486207724, 14.736170124679166, 23.63191785406357, 45.252776678538986, 16.127890282240042, 63.519088384931635, 98.14486741407163, 77.43608432983109, 49.20765389359299, 7.364422858323399, 48.92884120369242, 6.074128129576664, 14.37857246133744, 44.02531591109067, 24.28560533954145, 9.87269453923996, 5.386793660075579, 25.809373114156855, 21.396317212896864, 104.11996003977104, 62.91172969643565, 21.483149784612124, 22.211344977344748, 37.4965868842627, 18.518608198914396, 21.493134079106067, 18.1680172928914, 42.98606829803312, 35.839105910857434, 6.227488675429892, 20.672348391738666, 80.24198287729034, 26.949847782450004, 84.38251762406979, 52.496879729104194])
Detected energies during the discharge + Energy spectrum
multiplot(icon_fig, T_int_first,E,xle,Etot)