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 = 44438
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);
([6466340.625, 6615543.75, 6649151.5625, 6840976.5625, 6914831.25, 7565776.5625, 7582012.5, 7648306.25, 7690275.0, 7699118.75, 7714276.5625, 7728575.0, 7729081.25, 7765801.5625, 7820562.5, 7839132.8125, 7840398.4375, 7841095.3125, 7886643.75, 7890546.875, 7911487.5, 7916532.8125, 7934685.9375, 7980656.25, 7990506.25, 7993712.5, 7993760.9375, 8005057.8125, 8020810.9375, 8021820.3125, 8024515.625, 8029170.3125, 8049590.625, 8095581.25, 8095656.25, 8132785.9375, 8197934.375, 8197945.3125, 8260025.0, 8342768.75, 8419853.125, 8448026.5625, 8657896.875, 8671067.1875, 8698325.0, 8705428.125, 8739968.75, 8833204.6875, 8835712.5, 8840787.5, 8876525.0, 8909371.875, 8911460.9375, 8916040.625, 8916345.3125, 8916510.9375, 8916560.9375, 8916564.0625, 8916798.4375, 8919960.9375, 8920614.0625, 8921525.0, 9000350.0, 9029842.1875, 9032067.1875, 9051978.125, 9107589.0625, 9127482.8125, 9127729.6875, 9191765.625, 9193004.6875, 9195767.1875, 9196003.125, 9196553.125, 9196554.6875, 9197707.8125, 9198178.125, 9199192.1875, 9227795.3125, 9232642.1875, 9233775.0, 9235454.6875, 9236400.0, 9236828.125, 9237334.375, 9237548.4375, 9238062.5, 9243784.375, 9256279.6875, 9258935.9375, 9259378.125, 9260042.1875, 9261671.875, 9261681.25, 9262940.625, 9263971.875, 9263973.4375, 9265840.625, 9272440.625, 9272442.1875, 9273473.4375, 9275165.625, 9288385.9375, 9289051.5625, 9289559.375, 9291309.375, 9291335.9375, 9291668.75, 9291779.6875, 9291921.875, 9299004.6875, 9299259.375, 9302326.5625, 9302334.375, 9310814.0625, 9310820.3125, 9311396.875, 9312312.5, 9312342.1875, 9318371.875, 9318703.125, 9320653.125, 9322739.0625, 9324271.875, 9330426.5625, 9331846.875, 9332570.3125, 9333667.1875, 9355784.375, 9356954.6875, 9357660.9375, 9360584.375, 9362307.8125, 9369595.3125, 9390503.125, 9415626.5625, 9418490.625, 9425282.8125, 9425537.5, 9426793.75, 9426809.375, 9426820.3125, 9426873.4375, 9430768.75, 9441601.5625, 9459657.8125, 9459839.0625, 9472385.9375, 9487689.0625, 9500845.3125, 9509481.25, 9530750.0, 9554404.6875, 9592101.5625, 9631603.125, 9640107.8125, 9728684.375, 9732204.6875, 9732260.9375, 9770793.75, 9772656.25, 9853509.375, 9856096.875, 9914909.375, 9947720.3125, 9948976.5625, 9950985.9375, 9951189.0625, 9951257.8125, 9953314.0625, 9953384.375, 9954407.8125, 9955862.5, 9962479.6875, 9968593.75, 9968678.125, 9968870.3125, 9969126.5625, 9969259.375, 9969400.0, 9969445.3125, 9969665.625, 9969932.8125, 9969942.1875, 9970153.125, 9970265.625, 9970365.625, 9970504.6875, 9970612.5, 9970914.0625, 9970942.1875, 9971712.5, 9972084.375, 9972142.1875, 9972262.5, 9972315.625, 9972362.5, 9972371.875, 9972685.9375, 9972881.25, 9973531.25, 9974492.1875, 9975259.375, 10004835.9375, 10026435.9375, 10028696.875, 10087737.5, 10140034.375, 10216982.8125, 10285946.875, 10973500.0, 10977032.8125, 11059956.25, 11067434.375], [10.964829298313587, 12.982502694458148, 55.29147787363387, 35.939670282915685, 169.21583365152543, 11.259540519725222, 63.49151252891786, 24.407124169179376, 129.30301479134826, 7.581041984175839, 6.045892400661027, 52.21822934688707, 39.35074390730773, 23.79200248117857, 38.62636150938136, 116.69750678373744, 53.5684224344787, 169.81908225083546, 28.50005707445531, 5.5182660640760135, 5.587113231890935, 64.71904891948772, 26.239955853214134, 17.555121265713368, 86.32039066074401, 117.9563140797974, 6.730211353385614, 48.723524128240726, 102.44200565006672, 38.67614397777627, 18.35616405956167, 49.25195733924225, 12.87919840847424, 124.09575085584703, 5.278311890966839, 17.937979025001265, 7.304875979864757, 14.767264563817026, 19.357532782509768, 9.331379365988871, 20.95263800429381, 83.48266486496473, 5.165825243480652, 20.333247486020863, 21.973094879536948, 42.30755618919146, 12.283125037719662, 64.68769345855965, 6.8110419302586696, 67.50385661374777, 87.48166919563464, 121.68395588743357, 32.787022094086744, 172.11457853589738, 12.94655488291462, 26.21053007351098, 74.13079478293733, 11.141537791708204, 8.788347565194046, 59.08253853199984, 24.839388504597302, 38.967267320968, 10.852991999843013, 5.492063967769327, 15.719754276829356, 24.63437501958312, 36.76375811969855, 87.20256386894468, 82.15819888831608, 151.13755291968508, 24.243485782432316, 21.429090661098382, 30.41633322355873, 39.594957190058274, 13.298705365310376, 70.26560713331449, 26.037037663261003, 16.280447297545727, 76.47726173133064, 176.75645745805932, 12.035306560664715, 77.31236231851307, 6.591778530260079, 15.111468579059252, 28.66740124582327, 42.57418982571969, 31.70529415209825, 35.08367391545758, 94.17988270495435, 77.29061088533143, 7.211259669418873, 30.23085025504621, 44.27838845319478, 45.105429179320524, 21.519017919266425, 28.07686986225354, 24.81077599760839, 6.876578484026267, 31.351721165080153, 18.568701835251353, 77.46078315904428, 43.84761924575198, 23.74548454128718, 12.72682609229532, 31.481693942704812, 14.242502961419811, 59.54625765099101, 64.16768668250347, 14.219064296638384, 203.06939916668006, 68.65995360191575, 12.965777218098824, 19.997016561015972, 10.743152768447107, 10.140967484069982, 6.170270801664606, 6.032737584701313, 25.681227534359746, 18.27212823663364, 16.296224025655285, 104.56964527610106, 6.255774462697255, 24.57869931501549, 54.679410937452516, 23.560146179966452, 71.6258595757795, 51.080145589345705, 8.590984871818739, 65.36318346813994, 29.328112274067024, 53.09606216046438, 55.59956250922295, 23.774689066036398, 14.174121511343058, 11.06653682706528, 78.45484688865591, 19.150545478232917, 76.01807383920965, 110.45442623863336, 14.233877688750479, 58.52639803536681, 11.65718897808606, 22.15650670727657, 11.752045284778141, 14.46130723629254, 6.83835516352798, 9.24052721916051, 96.25623824673897, 8.49035150267721, 18.011043522796086, 69.27578173470691, 97.15544834132358, 125.8557874389971, 113.47541042443014, 43.94310291871262, 97.32517867108085, 13.624127292790229, 113.14518765201784, 5.549959815099961, 29.144051599126037, 48.74697592373904, 9.431573954688519, 56.19293161731434, 18.486871077683194, 50.825395941076145, 65.86795314872522, 33.78330522113612, 11.997541680198823, 11.46837681322537, 108.03019125061579, 49.63213772166013, 14.622328810613402, 39.40077316100249, 34.46063345629298, 61.93024614124691, 32.728664841892055, 12.70722658195599, 54.4406801073697, 16.899315738159014, 109.15002318633069, 18.00625264154397, 10.630325724761189, 10.284922293516637, 49.2152097717347, 8.452882767620375, 40.24160400946238, 7.1792658052900435, 32.9771442881706, 104.46623412884733, 59.87548421375322, 144.01718483278788, 165.60533339665486, 57.952530487301225, 5.187785653410899, 17.512259237364873, 14.57117928200292, 28.898485198295496, 18.956005694819247, 36.12213831717665, 8.945322719506862, 109.01453810162576, 75.470414560887, 19.166154895957714, 108.05931533012514, 119.3073838469603, 49.82264729785439, 82.36877592315544, 14.783079383639356, 37.169762247149265, 104.75454883340814, 61.99619728584585, 5.945541886143548, 69.51040573401258, 8.128716918221047])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([6466340.625, 6615543.75, 6649151.5625, 6840976.5625, 6914831.25, 7565776.5625, 7582012.5, 7648306.25, 7690275.0, 7699118.75, 7714276.5625, 7728575.0, 7729081.25, 7765801.5625, 7820562.5, 7839132.8125, 7840398.4375, 7841095.3125, 7886643.75, 7890546.875, 7911487.5, 7916532.8125, 7934685.9375, 7980656.25, 7990506.25, 7993712.5, 7993760.9375, 8005057.8125, 8020810.9375, 8021820.3125, 8024515.625, 8029170.3125, 8049590.625, 8095581.25, 8095656.25, 8132785.9375, 8197934.375, 8197945.3125, 8260025.0, 8342768.75, 8419853.125, 8448026.5625, 8657896.875, 8671067.1875, 8698325.0, 8705428.125, 8739968.75, 8833204.6875, 8835712.5, 8840787.5, 8876525.0, 8909371.875, 8911460.9375, 8916040.625, 8916345.3125, 8916510.9375, 8916560.9375, 8916564.0625, 8916798.4375, 8919960.9375, 8920614.0625, 8921525.0, 9000350.0, 9029842.1875, 9032067.1875, 9051978.125, 9107589.0625, 9127482.8125, 9127729.6875, 9191765.625, 9193004.6875, 9195767.1875, 9196003.125, 9196553.125, 9196554.6875, 9197707.8125, 9198178.125, 9199192.1875, 9227795.3125, 9232642.1875, 9233775.0, 9235454.6875, 9236400.0, 9236828.125, 9237334.375, 9237548.4375, 9238062.5, 9243784.375, 9256279.6875, 9258935.9375, 9259378.125, 9260042.1875, 9261671.875, 9261681.25, 9262940.625, 9263971.875, 9263973.4375, 9265840.625, 9272440.625, 9272442.1875, 9273473.4375, 9275165.625, 9288385.9375, 9289051.5625, 9289559.375, 9291309.375, 9291335.9375, 9291668.75, 9291779.6875, 9291921.875, 9299004.6875, 9299259.375, 9302326.5625, 9302334.375, 9310814.0625, 9310820.3125, 9311396.875, 9312312.5, 9312342.1875, 9318371.875, 9318703.125, 9320653.125, 9322739.0625, 9324271.875, 9330426.5625, 9331846.875, 9332570.3125, 9333667.1875, 9355784.375, 9356954.6875, 9357660.9375, 9360584.375, 9362307.8125, 9369595.3125, 9390503.125, 9415626.5625, 9418490.625, 9425282.8125, 9425537.5, 9426793.75, 9426809.375, 9426820.3125, 9426873.4375, 9430768.75, 9441601.5625, 9459657.8125, 9459839.0625, 9472385.9375, 9487689.0625, 9500845.3125, 9509481.25, 9530750.0, 9554404.6875, 9592101.5625, 9631603.125, 9640107.8125, 9728684.375, 9732204.6875, 9732260.9375, 9770793.75, 9772656.25, 9853509.375, 9856096.875, 9914909.375, 9947720.3125, 9948976.5625, 9950985.9375, 9951189.0625, 9951257.8125, 9953314.0625, 9953384.375, 9954407.8125, 9955862.5, 9962479.6875, 9968593.75, 9968678.125, 9968870.3125, 9969126.5625, 9969259.375, 9969400.0, 9969445.3125, 9969665.625, 9969932.8125, 9969942.1875, 9970153.125, 9970265.625, 9970365.625, 9970504.6875, 9970612.5, 9970914.0625, 9970942.1875, 9971712.5, 9972084.375, 9972142.1875, 9972262.5, 9972315.625, 9972362.5, 9972371.875, 9972685.9375, 9972881.25, 9973531.25, 9974492.1875, 9975259.375, 10004835.9375, 10026435.9375, 10028696.875, 10087737.5, 10140034.375, 10216982.8125, 10285946.875, 10973500.0, 10977032.8125, 11059956.25, 11067434.375], [10.964829298313587, 12.982502694458148, 55.29147787363387, 35.939670282915685, 169.21583365152543, 11.259540519725222, 63.49151252891786, 24.407124169179376, 129.30301479134826, 7.581041984175839, 6.045892400661027, 52.21822934688707, 39.35074390730773, 23.79200248117857, 38.62636150938136, 116.69750678373744, 53.5684224344787, 169.81908225083546, 28.50005707445531, 5.5182660640760135, 5.587113231890935, 64.71904891948772, 26.239955853214134, 17.555121265713368, 86.32039066074401, 117.9563140797974, 6.730211353385614, 48.723524128240726, 102.44200565006672, 38.67614397777627, 18.35616405956167, 49.25195733924225, 12.87919840847424, 124.09575085584703, 5.278311890966839, 17.937979025001265, 7.304875979864757, 14.767264563817026, 19.357532782509768, 9.331379365988871, 20.95263800429381, 83.48266486496473, 5.165825243480652, 20.333247486020863, 21.973094879536948, 42.30755618919146, 12.283125037719662, 64.68769345855965, 6.8110419302586696, 67.50385661374777, 87.48166919563464, 121.68395588743357, 32.787022094086744, 172.11457853589738, 12.94655488291462, 26.21053007351098, 74.13079478293733, 11.141537791708204, 8.788347565194046, 59.08253853199984, 24.839388504597302, 38.967267320968, 10.852991999843013, 5.492063967769327, 15.719754276829356, 24.63437501958312, 36.76375811969855, 87.20256386894468, 82.15819888831608, 151.13755291968508, 24.243485782432316, 21.429090661098382, 30.41633322355873, 39.594957190058274, 13.298705365310376, 70.26560713331449, 26.037037663261003, 16.280447297545727, 76.47726173133064, 176.75645745805932, 12.035306560664715, 77.31236231851307, 6.591778530260079, 15.111468579059252, 28.66740124582327, 42.57418982571969, 31.70529415209825, 35.08367391545758, 94.17988270495435, 77.29061088533143, 7.211259669418873, 30.23085025504621, 44.27838845319478, 45.105429179320524, 21.519017919266425, 28.07686986225354, 24.81077599760839, 6.876578484026267, 31.351721165080153, 18.568701835251353, 77.46078315904428, 43.84761924575198, 23.74548454128718, 12.72682609229532, 31.481693942704812, 14.242502961419811, 59.54625765099101, 64.16768668250347, 14.219064296638384, 203.06939916668006, 68.65995360191575, 12.965777218098824, 19.997016561015972, 10.743152768447107, 10.140967484069982, 6.170270801664606, 6.032737584701313, 25.681227534359746, 18.27212823663364, 16.296224025655285, 104.56964527610106, 6.255774462697255, 24.57869931501549, 54.679410937452516, 23.560146179966452, 71.6258595757795, 51.080145589345705, 8.590984871818739, 65.36318346813994, 29.328112274067024, 53.09606216046438, 55.59956250922295, 23.774689066036398, 14.174121511343058, 11.06653682706528, 78.45484688865591, 19.150545478232917, 76.01807383920965, 110.45442623863336, 14.233877688750479, 58.52639803536681, 11.65718897808606, 22.15650670727657, 11.752045284778141, 14.46130723629254, 6.83835516352798, 9.24052721916051, 96.25623824673897, 8.49035150267721, 18.011043522796086, 69.27578173470691, 97.15544834132358, 125.8557874389971, 113.47541042443014, 43.94310291871262, 97.32517867108085, 13.624127292790229, 113.14518765201784, 5.549959815099961, 29.144051599126037, 48.74697592373904, 9.431573954688519, 56.19293161731434, 18.486871077683194, 50.825395941076145, 65.86795314872522, 33.78330522113612, 11.997541680198823, 11.46837681322537, 108.03019125061579, 49.63213772166013, 14.622328810613402, 39.40077316100249, 34.46063345629298, 61.93024614124691, 32.728664841892055, 12.70722658195599, 54.4406801073697, 16.899315738159014, 109.15002318633069, 18.00625264154397, 10.630325724761189, 10.284922293516637, 49.2152097717347, 8.452882767620375, 40.24160400946238, 7.1792658052900435, 32.9771442881706, 104.46623412884733, 59.87548421375322, 144.01718483278788, 165.60533339665486, 57.952530487301225, 5.187785653410899, 17.512259237364873, 14.57117928200292, 28.898485198295496, 18.956005694819247, 36.12213831717665, 8.945322719506862, 109.01453810162576, 75.470414560887, 19.166154895957714, 108.05931533012514, 119.3073838469603, 49.82264729785439, 82.36877592315544, 14.783079383639356, 37.169762247149265, 104.75454883340814, 61.99619728584585, 5.945541886143548, 69.51040573401258, 8.128716918221047])
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);
([6466340.625, 6615543.75, 6649151.5625, 6840976.5625, 6914831.25, 7565776.5625, 7582012.5, 7648306.25, 7690275.0, 7699118.75, 7714276.5625, 7728575.0, 7729081.25, 7765801.5625, 7820562.5, 7839132.8125, 7840398.4375, 7841095.3125, 7886643.75, 7890546.875, 7911487.5, 7916532.8125, 7934685.9375, 7980656.25, 7990506.25, 7993712.5, 7993760.9375, 8005057.8125, 8020810.9375, 8021820.3125, 8024515.625, 8029170.3125, 8049590.625, 8095581.25, 8095656.25, 8132785.9375, 8197934.375, 8197945.3125, 8260025.0, 8342768.75, 8419853.125, 8448026.5625, 8657896.875, 8671067.1875, 8698325.0, 8705428.125, 8739968.75, 8833204.6875, 8835712.5, 8840787.5, 8876525.0, 8909371.875, 8911460.9375, 8916040.625, 8916345.3125, 8916510.9375, 8916560.9375, 8916564.0625, 8916798.4375, 8919960.9375, 8920614.0625, 8921525.0, 9000350.0, 9029842.1875, 9032067.1875, 9051978.125, 9107589.0625, 9127482.8125, 9127729.6875, 9191765.625, 9193004.6875, 9195767.1875, 9196003.125, 9196553.125, 9196554.6875, 9197707.8125, 9198178.125, 9199192.1875, 9227795.3125, 9232642.1875, 9233775.0, 9235454.6875, 9236400.0, 9236828.125, 9237334.375, 9237548.4375, 9238062.5, 9243784.375, 9256279.6875, 9258935.9375, 9259378.125, 9260042.1875, 9261671.875, 9261681.25, 9262940.625, 9263971.875, 9263973.4375, 9265840.625, 9272440.625, 9272442.1875, 9273473.4375, 9275165.625, 9288385.9375, 9289051.5625, 9289559.375, 9291309.375, 9291335.9375, 9291668.75, 9291779.6875, 9291921.875, 9299004.6875, 9299259.375, 9302326.5625, 9302334.375, 9310814.0625, 9310820.3125, 9311396.875, 9312312.5, 9312342.1875, 9318371.875, 9318703.125, 9320653.125, 9322739.0625, 9324271.875, 9330426.5625, 9331846.875, 9332570.3125, 9333667.1875, 9355784.375, 9356954.6875, 9357660.9375, 9360584.375, 9362307.8125, 9369595.3125, 9390503.125, 9415626.5625, 9418490.625, 9425282.8125, 9425537.5, 9426793.75, 9426809.375, 9426820.3125, 9426873.4375, 9430768.75, 9441601.5625, 9459657.8125, 9459839.0625, 9472385.9375, 9487689.0625, 9500845.3125, 9509481.25, 9530750.0, 9554404.6875, 9592101.5625, 9631603.125, 9640107.8125, 9728684.375, 9732204.6875, 9732260.9375, 9770793.75, 9772656.25, 9853509.375, 9856096.875, 9914909.375, 9947720.3125, 9948976.5625, 9950985.9375, 9951189.0625, 9951257.8125, 9953314.0625, 9953384.375, 9954407.8125, 9955862.5, 9962479.6875, 9968593.75, 9968678.125, 9968870.3125, 9969126.5625, 9969259.375, 9969400.0, 9969445.3125, 9969665.625, 9969932.8125, 9969942.1875, 9970153.125, 9970265.625, 9970365.625, 9970504.6875, 9970612.5, 9970914.0625, 9970942.1875, 9971712.5, 9972084.375, 9972142.1875, 9972262.5, 9972315.625, 9972362.5, 9972371.875, 9972685.9375, 9972881.25, 9973531.25, 9974492.1875, 9975259.375, 10004835.9375, 10026435.9375, 10028696.875, 10087737.5, 10140034.375, 10216982.8125, 10285946.875, 10973500.0, 10977032.8125, 11059956.25, 11067434.375], [10.964829298313587, 12.982502694458148, 55.29147787363387, 35.939670282915685, 169.21583365152543, 11.259540519725222, 63.49151252891786, 24.407124169179376, 129.30301479134826, 7.581041984175839, 6.045892400661027, 52.21822934688707, 39.35074390730773, 23.79200248117857, 38.62636150938136, 116.69750678373744, 53.5684224344787, 169.81908225083546, 28.50005707445531, 5.5182660640760135, 5.587113231890935, 64.71904891948772, 26.239955853214134, 17.555121265713368, 86.32039066074401, 117.9563140797974, 6.730211353385614, 48.723524128240726, 102.44200565006672, 38.67614397777627, 18.35616405956167, 49.25195733924225, 12.87919840847424, 124.09575085584703, 5.278311890966839, 17.937979025001265, 7.304875979864757, 14.767264563817026, 19.357532782509768, 9.331379365988871, 20.95263800429381, 83.48266486496473, 5.165825243480652, 20.333247486020863, 21.973094879536948, 42.30755618919146, 12.283125037719662, 64.68769345855965, 6.8110419302586696, 67.50385661374777, 87.48166919563464, 121.68395588743357, 32.787022094086744, 172.11457853589738, 12.94655488291462, 26.21053007351098, 74.13079478293733, 11.141537791708204, 8.788347565194046, 59.08253853199984, 24.839388504597302, 38.967267320968, 10.852991999843013, 5.492063967769327, 15.719754276829356, 24.63437501958312, 36.76375811969855, 87.20256386894468, 82.15819888831608, 151.13755291968508, 24.243485782432316, 21.429090661098382, 30.41633322355873, 39.594957190058274, 13.298705365310376, 70.26560713331449, 26.037037663261003, 16.280447297545727, 76.47726173133064, 176.75645745805932, 12.035306560664715, 77.31236231851307, 6.591778530260079, 15.111468579059252, 28.66740124582327, 42.57418982571969, 31.70529415209825, 35.08367391545758, 94.17988270495435, 77.29061088533143, 7.211259669418873, 30.23085025504621, 44.27838845319478, 45.105429179320524, 21.519017919266425, 28.07686986225354, 24.81077599760839, 6.876578484026267, 31.351721165080153, 18.568701835251353, 77.46078315904428, 43.84761924575198, 23.74548454128718, 12.72682609229532, 31.481693942704812, 14.242502961419811, 59.54625765099101, 64.16768668250347, 14.219064296638384, 203.06939916668006, 68.65995360191575, 12.965777218098824, 19.997016561015972, 10.743152768447107, 10.140967484069982, 6.170270801664606, 6.032737584701313, 25.681227534359746, 18.27212823663364, 16.296224025655285, 104.56964527610106, 6.255774462697255, 24.57869931501549, 54.679410937452516, 23.560146179966452, 71.6258595757795, 51.080145589345705, 8.590984871818739, 65.36318346813994, 29.328112274067024, 53.09606216046438, 55.59956250922295, 23.774689066036398, 14.174121511343058, 11.06653682706528, 78.45484688865591, 19.150545478232917, 76.01807383920965, 110.45442623863336, 14.233877688750479, 58.52639803536681, 11.65718897808606, 22.15650670727657, 11.752045284778141, 14.46130723629254, 6.83835516352798, 9.24052721916051, 96.25623824673897, 8.49035150267721, 18.011043522796086, 69.27578173470691, 97.15544834132358, 125.8557874389971, 113.47541042443014, 43.94310291871262, 97.32517867108085, 13.624127292790229, 113.14518765201784, 5.549959815099961, 29.144051599126037, 48.74697592373904, 9.431573954688519, 56.19293161731434, 18.486871077683194, 50.825395941076145, 65.86795314872522, 33.78330522113612, 11.997541680198823, 11.46837681322537, 108.03019125061579, 49.63213772166013, 14.622328810613402, 39.40077316100249, 34.46063345629298, 61.93024614124691, 32.728664841892055, 12.70722658195599, 54.4406801073697, 16.899315738159014, 109.15002318633069, 18.00625264154397, 10.630325724761189, 10.284922293516637, 49.2152097717347, 8.452882767620375, 40.24160400946238, 7.1792658052900435, 32.9771442881706, 104.46623412884733, 59.87548421375322, 144.01718483278788, 165.60533339665486, 57.952530487301225, 5.187785653410899, 17.512259237364873, 14.57117928200292, 28.898485198295496, 18.956005694819247, 36.12213831717665, 8.945322719506862, 109.01453810162576, 75.470414560887, 19.166154895957714, 108.05931533012514, 119.3073838469603, 49.82264729785439, 82.36877592315544, 14.783079383639356, 37.169762247149265, 104.75454883340814, 61.99619728584585, 5.945541886143548, 69.51040573401258, 8.128716918221047])
Detected energies during the discharge + Energy spectrum
multiplot(icon_fig, T_int_first,E,xle,Etot)