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 = 44446
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);
([6358073.4375, 6435709.375, 6484148.4375, 6598348.4375, 6600890.625, 6600945.3125, 6647037.5, 6673809.375, 6678973.4375, 6707450.0, 6708618.75, 6831785.9375, 6833401.5625, 6833406.25, 6965945.3125, 6978017.1875, 6983868.75, 7034984.375, 7041014.0625, 7044326.5625, 7044675.0, 7138043.75, 7142015.625, 7142557.8125, 7195750.0, 7258928.125, 7384542.1875, 7421771.875, 7421806.25, 7455517.1875, 7588762.5, 7671893.75, 7680470.3125, 7687437.5, 7696115.625, 7728604.6875, 7749879.6875, 7751690.625, 7765807.8125, 7772042.1875, 7772803.125, 7774431.25, 7776556.25, 7777942.1875, 7777985.9375, 7780078.125, 7785306.25, 7786910.9375, 7786910.9375, 7801354.6875, 7844490.625, 7845703.125, 7845717.1875, 7846140.625, 7846579.6875, 7846759.375, 7846989.0625, 7847193.75, 7847950.0, 7848106.25, 7848812.5, 7852820.3125, 7856081.25, 7865395.3125, 7872168.75, 7901573.4375, 7908026.5625, 7909978.125, 7909993.75, 7912715.625, 7919978.125, 7932250.0, 7933553.125, 7967206.25, 7970778.125, 7999731.25, 8016292.1875, 8023735.9375, 8035300.0, 8036776.5625, 8038178.125, 8038581.25, 8038634.375, 8039648.4375, 8040723.4375, 8042845.3125, 8043287.5, 8046892.1875, 8062251.5625, 8093439.0625, 8094532.8125, 8095362.5, 8103195.3125, 8115714.0625, 8128812.5, 8138079.6875, 8138848.4375, 8143029.6875, 8143801.5625, 8144978.125, 8146125.0, 8148179.6875, 8152456.25, 8158140.625, 8162942.1875, 8167050.0, 8181657.8125, 8183340.625, 8184410.9375, 8184490.625, 8197404.6875, 8202475.0, 8222409.375, 8222410.9375, 8225423.4375, 8240339.0625, 8241373.4375, 8242756.25, 8243159.375, 8243362.5, 8243626.5625, 8243815.625, 8245596.875, 8260904.6875, 8261617.1875, 8262284.375, 8263357.8125, 8263365.625, 8320471.875, 8342853.125, 8387807.8125, 8421251.5625, 8429417.1875, 8609148.4375, 8609834.375, 8639284.375, 8640320.3125, 8641200.0, 8662815.625, 8663004.6875, 8683456.25, 8690648.4375, 8739337.5, 8740223.4375, 8763428.125, 8805425.0, 8805789.0625, 8950689.0625, 9043981.25, 9049443.75, 9144267.1875, 9190985.9375, 9620378.125, 9634859.375, 9687642.1875, 9687693.75, 9745059.375, 9746300.0, 9746873.4375, 9755567.1875, 9770085.9375, 9868484.375, 9954162.5, 9991789.0625, 10006079.6875, 10022607.8125, 10062576.5625, 10064610.9375, 10066435.9375, 10069179.6875, 10082926.5625, 10085739.0625, 10085748.4375, 10109107.8125, 10168037.5, 10170065.625, 10210140.625, 10210218.75, 10210584.375, 10210603.125, 10210625.0, 10211095.3125, 10213245.3125, 10213285.9375, 10213373.4375, 10214409.375, 10215590.625, 10216060.9375, 10216612.5, 10235678.125, 10238071.875, 10238981.25, 10240590.625, 10240882.8125, 10240965.625, 10243881.25, 10246946.875, 10248104.6875, 10249720.3125, 10250539.0625, 10251081.25, 10255437.5, 10257667.1875, 10259406.25, 10261015.625, 10261082.8125, 10264173.4375, 10265537.5, 10267659.375, 10275234.375, 10314062.5, 10321390.625, 10321781.25, 10333431.25, 10353990.625, 10370710.9375, 10437317.1875, 10439275.0, 10442265.625, 10446371.875, 10668957.8125, 10669575.0, 10676150.0, 10703642.1875, 10704664.0625, 10705651.5625, 10708582.8125, 10708609.375, 10708623.4375, 10714921.875, 10766234.375, 10890743.75, 10985459.375, 11152543.75, 11152584.375, 11153150.0, 11153504.6875, 11153950.0, 11157117.1875, 11157804.6875, 11160126.5625, 11160143.75, 11160495.3125, 11160946.875, 11161484.375, 11161834.375, 11162150.0, 11163440.625, 11164914.0625, 11165018.75, 11166976.5625, 11167365.625, 11167443.75, 11167484.375, 11167781.25, 11168132.8125, 11168356.25, 11168715.625, 11169632.8125, 11169640.625, 11169723.4375, 11170037.5, 11170132.8125, 11170143.75, 11170354.6875, 11170471.875, 11171012.5, 11171076.5625, 11171178.125, 11171318.75, 11171848.4375, 11171884.375, 11172106.25, 11172746.875, 11173600.0, 11174268.75, 11176579.6875, 11179081.25, 11181759.375, 11185832.8125, 11185837.5, 11186825.0, 11187043.75, 11187171.875, 11193360.9375, 11196365.625, 11198039.0625, 11198640.625, 11200275.0, 11200301.5625, 11213581.25, 11214498.4375, 11255245.3125, 11263623.4375, 11265545.3125, 11265565.625, 11268270.3125, 11269151.5625, 11273237.5, 11274525.0, 11279232.8125, 11279471.875, 11279720.3125, 11281896.875, 11282190.625, 11283620.3125, 11283628.125, 11283717.1875, 11284334.375, 11284646.875, 11284993.75, 11286642.1875, 11286662.5, 11286854.6875, 11287725.0, 11290289.0625, 11290312.5, 11294567.1875, 11296106.25, 11298396.875, 11301212.5, 11306125.0, 11310229.6875, 11313368.75, 11313962.5, 11315485.9375, 11317081.25], [37.32818134805943, 22.207568423281344, 17.649062215639432, 24.730017127282935, 20.617653705835945, 53.83061728573724, 106.93578596310338, 32.212905113718755, 53.23858907038292, 10.750448938273202, 20.828207049762973, 162.04547557694127, 18.696758870557407, 8.182968454496057, 70.73801286969791, 28.469501666516972, 116.01227024588104, 9.632201034186998, 16.294460656076737, 45.1444249351111, 9.46850212357533, 15.808525342083739, 57.02593044959571, 7.371877345484636, 119.44655583599943, 42.74503824761466, 81.92653818149779, 30.13124824038399, 80.86093629457547, 173.99762310918265, 106.05228365651273, 41.57073688669942, 23.990322535716167, 29.05106522988823, 50.60895058927331, 46.52631065516628, 45.89360025593325, 25.653480847986916, 21.36541206476006, 6.38103610980343, 16.92175051255868, 38.09616346115052, 43.597901025076375, 21.91976859563466, 7.106619221537574, 16.647843875468503, 23.44128318056239, 180.73050800100947, 88.06243045367131, 5.246040075661661, 15.42829101734357, 18.319463243868476, 18.443318921450288, 21.87890118935981, 17.023327757736542, 20.547156627916227, 9.178730375535027, 66.16373862572037, 22.194177495646084, 121.94009053422309, 55.68068474981056, 104.03599473120488, 15.464861582300209, 15.091633633030975, 14.500767420247929, 14.016659969346644, 60.76432273924707, 34.74427740368521, 11.337302629013992, 8.356433939932288, 68.19026475610605, 30.203771911223523, 45.60354184522731, 26.12891967544893, 11.205061077461458, 111.81926636737643, 46.9280901288447, 62.55180502689525, 7.511180995275685, 23.387181395707433, 23.845119968174327, 90.11775276838064, 20.860393323872227, 23.748551324987222, 41.000653207242415, 11.694224343263375, 15.964644030226875, 36.0708460195469, 12.710598546699668, 41.19150163616883, 12.380597438292153, 20.392412417437694, 72.99418629698798, 40.57351160218532, 102.22021173624455, 7.490569924078292, 8.943011533100627, 5.321689285461998, 25.35972925720865, 88.87030785995566, 24.962670160631518, 14.8295555089065, 5.4936941623723845, 199.17665581079586, 68.21224544759039, 27.449074682026275, 21.50925603053715, 78.48623736550667, 20.242705557323283, 11.96668555041086, 62.19156499898894, 65.69526778397903, 27.962399740758617, 38.07465925257998, 53.38444202767124, 12.710675216510294, 8.164948131176162, 33.17287666953581, 10.356737028957955, 14.323685764529426, 27.15159537857819, 6.9405796101501664, 18.371485244963097, 19.859049337890195, 11.25961663688377, 9.240583279591922, 8.317323452009068, 51.5406471547394, 16.31875998936409, 11.06317374628227, 39.6963049809447, 11.235393179163191, 48.63248889274642, 46.65179236688118, 71.29623103921932, 9.165649690184754, 20.466557288147413, 13.568625799410665, 54.53857692160549, 91.25300216602784, 76.18727748899046, 29.023891644270964, 5.134238104183643, 5.699367199121428, 152.36970024783406, 21.88280133527799, 78.94393784028628, 10.958420268682442, 19.244892109205257, 17.948836735417412, 58.3321870319001, 60.49298525416554, 82.94736502644933, 36.920159913090025, 109.36291891491554, 5.255830613646266, 9.141859081187127, 29.801298463971182, 37.68839787763422, 37.00507770814083, 73.5840906729255, 93.38797533562241, 22.190023630392627, 15.862270683216591, 9.233426129638861, 12.57956243706144, 74.07551062214651, 50.10320212377219, 85.22745902078648, 7.820321297585226, 118.29795904816224, 10.908776112632596, 26.040532062802146, 5.251584300965833, 29.71699488131624, 15.385623461694971, 29.935858800470406, 89.7079746295419, 6.097451470123728, 25.85355653993568, 5.247076682528115, 8.699699051671363, 61.73882087954302, 10.576908523321377, 35.07563312567156, 20.76430649664772, 63.944582408118684, 108.03235185447372, 61.66896345632955, 6.103131331847318, 64.35374762159361, 35.9886799234859, 32.26678887956648, 61.149080855757674, 20.244152136646893, 18.682789792690567, 9.021311362231074, 44.613851501383714, 75.90713787959436, 11.382353582327038, 12.941840899148998, 102.89833845598592, 58.18474419910194, 40.3640651656344, 41.802284696765454, 5.318631638021162, 74.88914145731977, 58.55998950649543, 6.055045681222442, 9.14088080719034, 14.870964488501222, 45.489551683284006, 111.35254547687249, 32.51070431849186, 113.62556457394001, 255.56737021910666, 67.50503492766225, 75.91842483802998, 12.720318149634792, 78.44790098479989, 39.39750406734645, 54.81917172781924, 36.593089857949714, 7.830998372612207, 7.11717491654386, 16.6919479812776, 19.110174568884368, 12.528526068424851, 5.372598307581479, 18.04337428290462, 71.85290488396946, 26.810780733106363, 72.72965303484177, 84.71264102489819, 21.09826340697957, 8.351944910376861, 9.152207465686182, 15.26674774500616, 34.72732986018034, 91.55536165048329, 16.92241959891782, 83.2787199676758, 53.18490065826128, 7.722908709376182, 23.214230397758875, 24.915003162215413, 25.936581727160423, 98.92709665040384, 41.625203144131405, 120.30380739659742, 36.13846104636383, 93.25238271687591, 16.719626686652383, 18.71800070465694, 8.525368283725681, 23.237502903092768, 20.768530440744268, 63.42294540568436, 82.13155999128449, 7.824361164510735, 15.988390311938668, 84.95631028982524, 5.087523116125723, 68.77993673587905, 29.64685862361511, 94.90077626876352, 24.971809219804033, 95.71663345923321, 45.04217631447851, 37.838254889872786, 92.12040274533689, 5.911071941205464, 35.72283492600655, 30.565375246575016, 9.515170908903192, 19.720158925973482, 5.524845627777527, 33.798387545471925, 39.597227397994025, 11.628006561041614, 29.076557914651556, 15.144063031731733, 7.816484620011777, 33.65959561123706, 14.174182492367192, 13.486355077434462, 74.74736067057677, 8.321500630962655, 16.24335092358201, 86.5745830692509, 9.842005239507266, 12.110895345146767, 81.11779215299642, 7.112072450513363, 14.178944776880105, 104.50871105960084, 84.20042249073585, 14.95414396474505, 35.46581098167692, 14.074285914951583, 5.411755457560655, 41.006670748756235, 8.53162902626074, 95.63483205021362, 20.28988222864472, 26.065182771713424, 26.461990634598056, 30.08940751343367, 23.287769866312626, 95.24300137629649, 67.07753906922828, 16.98006788397769, 5.98653802832733, 77.001187177246, 96.95065416091228, 8.982576912515313, 10.350531196013122, 44.26171851855159, 79.24178246291208, 12.227105345152761, 63.23822902125151, 43.886438750429356, 61.43904939032493, 28.485179097726224, 7.723793114642506, 57.105252760983404, 72.84116840157161])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([6358073.4375, 6435709.375, 6484148.4375, 6598348.4375, 6600890.625, 6600945.3125, 6647037.5, 6673809.375, 6678973.4375, 6707450.0, 6708618.75, 6831785.9375, 6833401.5625, 6833406.25, 6965945.3125, 6978017.1875, 6983868.75, 7034984.375, 7041014.0625, 7044326.5625, 7044675.0, 7138043.75, 7142015.625, 7142557.8125, 7195750.0, 7258928.125, 7384542.1875, 7421771.875, 7421806.25, 7455517.1875, 7588762.5, 7671893.75, 7680470.3125, 7687437.5, 7696115.625, 7728604.6875, 7749879.6875, 7751690.625, 7765807.8125, 7772042.1875, 7772803.125, 7774431.25, 7776556.25, 7777942.1875, 7777985.9375, 7780078.125, 7785306.25, 7786910.9375, 7786910.9375, 7801354.6875, 7844490.625, 7845703.125, 7845717.1875, 7846140.625, 7846579.6875, 7846759.375, 7846989.0625, 7847193.75, 7847950.0, 7848106.25, 7848812.5, 7852820.3125, 7856081.25, 7865395.3125, 7872168.75, 7901573.4375, 7908026.5625, 7909978.125, 7909993.75, 7912715.625, 7919978.125, 7932250.0, 7933553.125, 7967206.25, 7970778.125, 7999731.25, 8016292.1875, 8023735.9375, 8035300.0, 8036776.5625, 8038178.125, 8038581.25, 8038634.375, 8039648.4375, 8040723.4375, 8042845.3125, 8043287.5, 8046892.1875, 8062251.5625, 8093439.0625, 8094532.8125, 8095362.5, 8103195.3125, 8115714.0625, 8128812.5, 8138079.6875, 8138848.4375, 8143029.6875, 8143801.5625, 8144978.125, 8146125.0, 8148179.6875, 8152456.25, 8158140.625, 8162942.1875, 8167050.0, 8181657.8125, 8183340.625, 8184410.9375, 8184490.625, 8197404.6875, 8202475.0, 8222409.375, 8222410.9375, 8225423.4375, 8240339.0625, 8241373.4375, 8242756.25, 8243159.375, 8243362.5, 8243626.5625, 8243815.625, 8245596.875, 8260904.6875, 8261617.1875, 8262284.375, 8263357.8125, 8263365.625, 8320471.875, 8342853.125, 8387807.8125, 8421251.5625, 8429417.1875, 8609148.4375, 8609834.375, 8639284.375, 8640320.3125, 8641200.0, 8662815.625, 8663004.6875, 8683456.25, 8690648.4375, 8739337.5, 8740223.4375, 8763428.125, 8805425.0, 8805789.0625, 8950689.0625, 9043981.25, 9049443.75, 9144267.1875, 9190985.9375, 9620378.125, 9634859.375, 9687642.1875, 9687693.75, 9745059.375, 9746300.0, 9746873.4375, 9755567.1875, 9770085.9375, 9868484.375, 9954162.5, 9991789.0625, 10006079.6875, 10022607.8125, 10062576.5625, 10064610.9375, 10066435.9375, 10069179.6875, 10082926.5625, 10085739.0625, 10085748.4375, 10109107.8125, 10168037.5, 10170065.625, 10210140.625, 10210218.75, 10210584.375, 10210603.125, 10210625.0, 10211095.3125, 10213245.3125, 10213285.9375, 10213373.4375, 10214409.375, 10215590.625, 10216060.9375, 10216612.5, 10235678.125, 10238071.875, 10238981.25, 10240590.625, 10240882.8125, 10240965.625, 10243881.25, 10246946.875, 10248104.6875, 10249720.3125, 10250539.0625, 10251081.25, 10255437.5, 10257667.1875, 10259406.25, 10261015.625, 10261082.8125, 10264173.4375, 10265537.5, 10267659.375, 10275234.375, 10314062.5, 10321390.625, 10321781.25, 10333431.25, 10353990.625, 10370710.9375, 10437317.1875, 10439275.0, 10442265.625, 10446371.875, 10668957.8125, 10669575.0, 10676150.0, 10703642.1875, 10704664.0625, 10705651.5625, 10708582.8125, 10708609.375, 10708623.4375, 10714921.875, 10766234.375, 10890743.75, 10985459.375, 11152543.75, 11152584.375, 11153150.0, 11153504.6875, 11153950.0, 11157117.1875, 11157804.6875, 11160126.5625, 11160143.75, 11160495.3125, 11160946.875, 11161484.375, 11161834.375, 11162150.0, 11163440.625, 11164914.0625, 11165018.75, 11166976.5625, 11167365.625, 11167443.75, 11167484.375, 11167781.25, 11168132.8125, 11168356.25, 11168715.625, 11169632.8125, 11169640.625, 11169723.4375, 11170037.5, 11170132.8125, 11170143.75, 11170354.6875, 11170471.875, 11171012.5, 11171076.5625, 11171178.125, 11171318.75, 11171848.4375, 11171884.375, 11172106.25, 11172746.875, 11173600.0, 11174268.75, 11176579.6875, 11179081.25, 11181759.375, 11185832.8125, 11185837.5, 11186825.0, 11187043.75, 11187171.875, 11193360.9375, 11196365.625, 11198039.0625, 11198640.625, 11200275.0, 11200301.5625, 11213581.25, 11214498.4375, 11255245.3125, 11263623.4375, 11265545.3125, 11265565.625, 11268270.3125, 11269151.5625, 11273237.5, 11274525.0, 11279232.8125, 11279471.875, 11279720.3125, 11281896.875, 11282190.625, 11283620.3125, 11283628.125, 11283717.1875, 11284334.375, 11284646.875, 11284993.75, 11286642.1875, 11286662.5, 11286854.6875, 11287725.0, 11290289.0625, 11290312.5, 11294567.1875, 11296106.25, 11298396.875, 11301212.5, 11306125.0, 11310229.6875, 11313368.75, 11313962.5, 11315485.9375, 11317081.25], [37.32818134805943, 22.207568423281344, 17.649062215639432, 24.730017127282935, 20.617653705835945, 53.83061728573724, 106.93578596310338, 32.212905113718755, 53.23858907038292, 10.750448938273202, 20.828207049762973, 162.04547557694127, 18.696758870557407, 8.182968454496057, 70.73801286969791, 28.469501666516972, 116.01227024588104, 9.632201034186998, 16.294460656076737, 45.1444249351111, 9.46850212357533, 15.808525342083739, 57.02593044959571, 7.371877345484636, 119.44655583599943, 42.74503824761466, 81.92653818149779, 30.13124824038399, 80.86093629457547, 173.99762310918265, 106.05228365651273, 41.57073688669942, 23.990322535716167, 29.05106522988823, 50.60895058927331, 46.52631065516628, 45.89360025593325, 25.653480847986916, 21.36541206476006, 6.38103610980343, 16.92175051255868, 38.09616346115052, 43.597901025076375, 21.91976859563466, 7.106619221537574, 16.647843875468503, 23.44128318056239, 180.73050800100947, 88.06243045367131, 5.246040075661661, 15.42829101734357, 18.319463243868476, 18.443318921450288, 21.87890118935981, 17.023327757736542, 20.547156627916227, 9.178730375535027, 66.16373862572037, 22.194177495646084, 121.94009053422309, 55.68068474981056, 104.03599473120488, 15.464861582300209, 15.091633633030975, 14.500767420247929, 14.016659969346644, 60.76432273924707, 34.74427740368521, 11.337302629013992, 8.356433939932288, 68.19026475610605, 30.203771911223523, 45.60354184522731, 26.12891967544893, 11.205061077461458, 111.81926636737643, 46.9280901288447, 62.55180502689525, 7.511180995275685, 23.387181395707433, 23.845119968174327, 90.11775276838064, 20.860393323872227, 23.748551324987222, 41.000653207242415, 11.694224343263375, 15.964644030226875, 36.0708460195469, 12.710598546699668, 41.19150163616883, 12.380597438292153, 20.392412417437694, 72.99418629698798, 40.57351160218532, 102.22021173624455, 7.490569924078292, 8.943011533100627, 5.321689285461998, 25.35972925720865, 88.87030785995566, 24.962670160631518, 14.8295555089065, 5.4936941623723845, 199.17665581079586, 68.21224544759039, 27.449074682026275, 21.50925603053715, 78.48623736550667, 20.242705557323283, 11.96668555041086, 62.19156499898894, 65.69526778397903, 27.962399740758617, 38.07465925257998, 53.38444202767124, 12.710675216510294, 8.164948131176162, 33.17287666953581, 10.356737028957955, 14.323685764529426, 27.15159537857819, 6.9405796101501664, 18.371485244963097, 19.859049337890195, 11.25961663688377, 9.240583279591922, 8.317323452009068, 51.5406471547394, 16.31875998936409, 11.06317374628227, 39.6963049809447, 11.235393179163191, 48.63248889274642, 46.65179236688118, 71.29623103921932, 9.165649690184754, 20.466557288147413, 13.568625799410665, 54.53857692160549, 91.25300216602784, 76.18727748899046, 29.023891644270964, 5.134238104183643, 5.699367199121428, 152.36970024783406, 21.88280133527799, 78.94393784028628, 10.958420268682442, 19.244892109205257, 17.948836735417412, 58.3321870319001, 60.49298525416554, 82.94736502644933, 36.920159913090025, 109.36291891491554, 5.255830613646266, 9.141859081187127, 29.801298463971182, 37.68839787763422, 37.00507770814083, 73.5840906729255, 93.38797533562241, 22.190023630392627, 15.862270683216591, 9.233426129638861, 12.57956243706144, 74.07551062214651, 50.10320212377219, 85.22745902078648, 7.820321297585226, 118.29795904816224, 10.908776112632596, 26.040532062802146, 5.251584300965833, 29.71699488131624, 15.385623461694971, 29.935858800470406, 89.7079746295419, 6.097451470123728, 25.85355653993568, 5.247076682528115, 8.699699051671363, 61.73882087954302, 10.576908523321377, 35.07563312567156, 20.76430649664772, 63.944582408118684, 108.03235185447372, 61.66896345632955, 6.103131331847318, 64.35374762159361, 35.9886799234859, 32.26678887956648, 61.149080855757674, 20.244152136646893, 18.682789792690567, 9.021311362231074, 44.613851501383714, 75.90713787959436, 11.382353582327038, 12.941840899148998, 102.89833845598592, 58.18474419910194, 40.3640651656344, 41.802284696765454, 5.318631638021162, 74.88914145731977, 58.55998950649543, 6.055045681222442, 9.14088080719034, 14.870964488501222, 45.489551683284006, 111.35254547687249, 32.51070431849186, 113.62556457394001, 255.56737021910666, 67.50503492766225, 75.91842483802998, 12.720318149634792, 78.44790098479989, 39.39750406734645, 54.81917172781924, 36.593089857949714, 7.830998372612207, 7.11717491654386, 16.6919479812776, 19.110174568884368, 12.528526068424851, 5.372598307581479, 18.04337428290462, 71.85290488396946, 26.810780733106363, 72.72965303484177, 84.71264102489819, 21.09826340697957, 8.351944910376861, 9.152207465686182, 15.26674774500616, 34.72732986018034, 91.55536165048329, 16.92241959891782, 83.2787199676758, 53.18490065826128, 7.722908709376182, 23.214230397758875, 24.915003162215413, 25.936581727160423, 98.92709665040384, 41.625203144131405, 120.30380739659742, 36.13846104636383, 93.25238271687591, 16.719626686652383, 18.71800070465694, 8.525368283725681, 23.237502903092768, 20.768530440744268, 63.42294540568436, 82.13155999128449, 7.824361164510735, 15.988390311938668, 84.95631028982524, 5.087523116125723, 68.77993673587905, 29.64685862361511, 94.90077626876352, 24.971809219804033, 95.71663345923321, 45.04217631447851, 37.838254889872786, 92.12040274533689, 5.911071941205464, 35.72283492600655, 30.565375246575016, 9.515170908903192, 19.720158925973482, 5.524845627777527, 33.798387545471925, 39.597227397994025, 11.628006561041614, 29.076557914651556, 15.144063031731733, 7.816484620011777, 33.65959561123706, 14.174182492367192, 13.486355077434462, 74.74736067057677, 8.321500630962655, 16.24335092358201, 86.5745830692509, 9.842005239507266, 12.110895345146767, 81.11779215299642, 7.112072450513363, 14.178944776880105, 104.50871105960084, 84.20042249073585, 14.95414396474505, 35.46581098167692, 14.074285914951583, 5.411755457560655, 41.006670748756235, 8.53162902626074, 95.63483205021362, 20.28988222864472, 26.065182771713424, 26.461990634598056, 30.08940751343367, 23.287769866312626, 95.24300137629649, 67.07753906922828, 16.98006788397769, 5.98653802832733, 77.001187177246, 96.95065416091228, 8.982576912515313, 10.350531196013122, 44.26171851855159, 79.24178246291208, 12.227105345152761, 63.23822902125151, 43.886438750429356, 61.43904939032493, 28.485179097726224, 7.723793114642506, 57.105252760983404, 72.84116840157161])
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);
([6358073.4375, 6435709.375, 6484148.4375, 6598348.4375, 6600890.625, 6600945.3125, 6647037.5, 6673809.375, 6678973.4375, 6707450.0, 6708618.75, 6831785.9375, 6833401.5625, 6833406.25, 6965945.3125, 6978017.1875, 6983868.75, 7034984.375, 7041014.0625, 7044326.5625, 7044675.0, 7138043.75, 7142015.625, 7142557.8125, 7195750.0, 7258928.125, 7384542.1875, 7421771.875, 7421806.25, 7455517.1875, 7588762.5, 7671893.75, 7680470.3125, 7687437.5, 7696115.625, 7728604.6875, 7749879.6875, 7751690.625, 7765807.8125, 7772042.1875, 7772803.125, 7774431.25, 7776556.25, 7777942.1875, 7777985.9375, 7780078.125, 7785306.25, 7786910.9375, 7786910.9375, 7801354.6875, 7844490.625, 7845703.125, 7845717.1875, 7846140.625, 7846579.6875, 7846759.375, 7846989.0625, 7847193.75, 7847950.0, 7848106.25, 7848812.5, 7852820.3125, 7856081.25, 7865395.3125, 7872168.75, 7901573.4375, 7908026.5625, 7909978.125, 7909993.75, 7912715.625, 7919978.125, 7932250.0, 7933553.125, 7967206.25, 7970778.125, 7999731.25, 8016292.1875, 8023735.9375, 8035300.0, 8036776.5625, 8038178.125, 8038581.25, 8038634.375, 8039648.4375, 8040723.4375, 8042845.3125, 8043287.5, 8046892.1875, 8062251.5625, 8093439.0625, 8094532.8125, 8095362.5, 8103195.3125, 8115714.0625, 8128812.5, 8138079.6875, 8138848.4375, 8143029.6875, 8143801.5625, 8144978.125, 8146125.0, 8148179.6875, 8152456.25, 8158140.625, 8162942.1875, 8167050.0, 8181657.8125, 8183340.625, 8184410.9375, 8184490.625, 8197404.6875, 8202475.0, 8222409.375, 8222410.9375, 8225423.4375, 8240339.0625, 8241373.4375, 8242756.25, 8243159.375, 8243362.5, 8243626.5625, 8243815.625, 8245596.875, 8260904.6875, 8261617.1875, 8262284.375, 8263357.8125, 8263365.625, 8320471.875, 8342853.125, 8387807.8125, 8421251.5625, 8429417.1875, 8609148.4375, 8609834.375, 8639284.375, 8640320.3125, 8641200.0, 8662815.625, 8663004.6875, 8683456.25, 8690648.4375, 8739337.5, 8740223.4375, 8763428.125, 8805425.0, 8805789.0625, 8950689.0625, 9043981.25, 9049443.75, 9144267.1875, 9190985.9375, 9620378.125, 9634859.375, 9687642.1875, 9687693.75, 9745059.375, 9746300.0, 9746873.4375, 9755567.1875, 9770085.9375, 9868484.375, 9954162.5, 9991789.0625, 10006079.6875, 10022607.8125, 10062576.5625, 10064610.9375, 10066435.9375, 10069179.6875, 10082926.5625, 10085739.0625, 10085748.4375, 10109107.8125, 10168037.5, 10170065.625, 10210140.625, 10210218.75, 10210584.375, 10210603.125, 10210625.0, 10211095.3125, 10213245.3125, 10213285.9375, 10213373.4375, 10214409.375, 10215590.625, 10216060.9375, 10216612.5, 10235678.125, 10238071.875, 10238981.25, 10240590.625, 10240882.8125, 10240965.625, 10243881.25, 10246946.875, 10248104.6875, 10249720.3125, 10250539.0625, 10251081.25, 10255437.5, 10257667.1875, 10259406.25, 10261015.625, 10261082.8125, 10264173.4375, 10265537.5, 10267659.375, 10275234.375, 10314062.5, 10321390.625, 10321781.25, 10333431.25, 10353990.625, 10370710.9375, 10437317.1875, 10439275.0, 10442265.625, 10446371.875, 10668957.8125, 10669575.0, 10676150.0, 10703642.1875, 10704664.0625, 10705651.5625, 10708582.8125, 10708609.375, 10708623.4375, 10714921.875, 10766234.375, 10890743.75, 10985459.375, 11152543.75, 11152584.375, 11153150.0, 11153504.6875, 11153950.0, 11157117.1875, 11157804.6875, 11160126.5625, 11160143.75, 11160495.3125, 11160946.875, 11161484.375, 11161834.375, 11162150.0, 11163440.625, 11164914.0625, 11165018.75, 11166976.5625, 11167365.625, 11167443.75, 11167484.375, 11167781.25, 11168132.8125, 11168356.25, 11168715.625, 11169632.8125, 11169640.625, 11169723.4375, 11170037.5, 11170132.8125, 11170143.75, 11170354.6875, 11170471.875, 11171012.5, 11171076.5625, 11171178.125, 11171318.75, 11171848.4375, 11171884.375, 11172106.25, 11172746.875, 11173600.0, 11174268.75, 11176579.6875, 11179081.25, 11181759.375, 11185832.8125, 11185837.5, 11186825.0, 11187043.75, 11187171.875, 11193360.9375, 11196365.625, 11198039.0625, 11198640.625, 11200275.0, 11200301.5625, 11213581.25, 11214498.4375, 11255245.3125, 11263623.4375, 11265545.3125, 11265565.625, 11268270.3125, 11269151.5625, 11273237.5, 11274525.0, 11279232.8125, 11279471.875, 11279720.3125, 11281896.875, 11282190.625, 11283620.3125, 11283628.125, 11283717.1875, 11284334.375, 11284646.875, 11284993.75, 11286642.1875, 11286662.5, 11286854.6875, 11287725.0, 11290289.0625, 11290312.5, 11294567.1875, 11296106.25, 11298396.875, 11301212.5, 11306125.0, 11310229.6875, 11313368.75, 11313962.5, 11315485.9375, 11317081.25], [37.32818134805943, 22.207568423281344, 17.649062215639432, 24.730017127282935, 20.617653705835945, 53.83061728573724, 106.93578596310338, 32.212905113718755, 53.23858907038292, 10.750448938273202, 20.828207049762973, 162.04547557694127, 18.696758870557407, 8.182968454496057, 70.73801286969791, 28.469501666516972, 116.01227024588104, 9.632201034186998, 16.294460656076737, 45.1444249351111, 9.46850212357533, 15.808525342083739, 57.02593044959571, 7.371877345484636, 119.44655583599943, 42.74503824761466, 81.92653818149779, 30.13124824038399, 80.86093629457547, 173.99762310918265, 106.05228365651273, 41.57073688669942, 23.990322535716167, 29.05106522988823, 50.60895058927331, 46.52631065516628, 45.89360025593325, 25.653480847986916, 21.36541206476006, 6.38103610980343, 16.92175051255868, 38.09616346115052, 43.597901025076375, 21.91976859563466, 7.106619221537574, 16.647843875468503, 23.44128318056239, 180.73050800100947, 88.06243045367131, 5.246040075661661, 15.42829101734357, 18.319463243868476, 18.443318921450288, 21.87890118935981, 17.023327757736542, 20.547156627916227, 9.178730375535027, 66.16373862572037, 22.194177495646084, 121.94009053422309, 55.68068474981056, 104.03599473120488, 15.464861582300209, 15.091633633030975, 14.500767420247929, 14.016659969346644, 60.76432273924707, 34.74427740368521, 11.337302629013992, 8.356433939932288, 68.19026475610605, 30.203771911223523, 45.60354184522731, 26.12891967544893, 11.205061077461458, 111.81926636737643, 46.9280901288447, 62.55180502689525, 7.511180995275685, 23.387181395707433, 23.845119968174327, 90.11775276838064, 20.860393323872227, 23.748551324987222, 41.000653207242415, 11.694224343263375, 15.964644030226875, 36.0708460195469, 12.710598546699668, 41.19150163616883, 12.380597438292153, 20.392412417437694, 72.99418629698798, 40.57351160218532, 102.22021173624455, 7.490569924078292, 8.943011533100627, 5.321689285461998, 25.35972925720865, 88.87030785995566, 24.962670160631518, 14.8295555089065, 5.4936941623723845, 199.17665581079586, 68.21224544759039, 27.449074682026275, 21.50925603053715, 78.48623736550667, 20.242705557323283, 11.96668555041086, 62.19156499898894, 65.69526778397903, 27.962399740758617, 38.07465925257998, 53.38444202767124, 12.710675216510294, 8.164948131176162, 33.17287666953581, 10.356737028957955, 14.323685764529426, 27.15159537857819, 6.9405796101501664, 18.371485244963097, 19.859049337890195, 11.25961663688377, 9.240583279591922, 8.317323452009068, 51.5406471547394, 16.31875998936409, 11.06317374628227, 39.6963049809447, 11.235393179163191, 48.63248889274642, 46.65179236688118, 71.29623103921932, 9.165649690184754, 20.466557288147413, 13.568625799410665, 54.53857692160549, 91.25300216602784, 76.18727748899046, 29.023891644270964, 5.134238104183643, 5.699367199121428, 152.36970024783406, 21.88280133527799, 78.94393784028628, 10.958420268682442, 19.244892109205257, 17.948836735417412, 58.3321870319001, 60.49298525416554, 82.94736502644933, 36.920159913090025, 109.36291891491554, 5.255830613646266, 9.141859081187127, 29.801298463971182, 37.68839787763422, 37.00507770814083, 73.5840906729255, 93.38797533562241, 22.190023630392627, 15.862270683216591, 9.233426129638861, 12.57956243706144, 74.07551062214651, 50.10320212377219, 85.22745902078648, 7.820321297585226, 118.29795904816224, 10.908776112632596, 26.040532062802146, 5.251584300965833, 29.71699488131624, 15.385623461694971, 29.935858800470406, 89.7079746295419, 6.097451470123728, 25.85355653993568, 5.247076682528115, 8.699699051671363, 61.73882087954302, 10.576908523321377, 35.07563312567156, 20.76430649664772, 63.944582408118684, 108.03235185447372, 61.66896345632955, 6.103131331847318, 64.35374762159361, 35.9886799234859, 32.26678887956648, 61.149080855757674, 20.244152136646893, 18.682789792690567, 9.021311362231074, 44.613851501383714, 75.90713787959436, 11.382353582327038, 12.941840899148998, 102.89833845598592, 58.18474419910194, 40.3640651656344, 41.802284696765454, 5.318631638021162, 74.88914145731977, 58.55998950649543, 6.055045681222442, 9.14088080719034, 14.870964488501222, 45.489551683284006, 111.35254547687249, 32.51070431849186, 113.62556457394001, 255.56737021910666, 67.50503492766225, 75.91842483802998, 12.720318149634792, 78.44790098479989, 39.39750406734645, 54.81917172781924, 36.593089857949714, 7.830998372612207, 7.11717491654386, 16.6919479812776, 19.110174568884368, 12.528526068424851, 5.372598307581479, 18.04337428290462, 71.85290488396946, 26.810780733106363, 72.72965303484177, 84.71264102489819, 21.09826340697957, 8.351944910376861, 9.152207465686182, 15.26674774500616, 34.72732986018034, 91.55536165048329, 16.92241959891782, 83.2787199676758, 53.18490065826128, 7.722908709376182, 23.214230397758875, 24.915003162215413, 25.936581727160423, 98.92709665040384, 41.625203144131405, 120.30380739659742, 36.13846104636383, 93.25238271687591, 16.719626686652383, 18.71800070465694, 8.525368283725681, 23.237502903092768, 20.768530440744268, 63.42294540568436, 82.13155999128449, 7.824361164510735, 15.988390311938668, 84.95631028982524, 5.087523116125723, 68.77993673587905, 29.64685862361511, 94.90077626876352, 24.971809219804033, 95.71663345923321, 45.04217631447851, 37.838254889872786, 92.12040274533689, 5.911071941205464, 35.72283492600655, 30.565375246575016, 9.515170908903192, 19.720158925973482, 5.524845627777527, 33.798387545471925, 39.597227397994025, 11.628006561041614, 29.076557914651556, 15.144063031731733, 7.816484620011777, 33.65959561123706, 14.174182492367192, 13.486355077434462, 74.74736067057677, 8.321500630962655, 16.24335092358201, 86.5745830692509, 9.842005239507266, 12.110895345146767, 81.11779215299642, 7.112072450513363, 14.178944776880105, 104.50871105960084, 84.20042249073585, 14.95414396474505, 35.46581098167692, 14.074285914951583, 5.411755457560655, 41.006670748756235, 8.53162902626074, 95.63483205021362, 20.28988222864472, 26.065182771713424, 26.461990634598056, 30.08940751343367, 23.287769866312626, 95.24300137629649, 67.07753906922828, 16.98006788397769, 5.98653802832733, 77.001187177246, 96.95065416091228, 8.982576912515313, 10.350531196013122, 44.26171851855159, 79.24178246291208, 12.227105345152761, 63.23822902125151, 43.886438750429356, 61.43904939032493, 28.485179097726224, 7.723793114642506, 57.105252760983404, 72.84116840157161])
Detected energies during the discharge + Energy spectrum
multiplot(icon_fig, T_int_first,E,xle,Etot)