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 = 44440
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);
([7222690.625, 7222710.9375, 7782487.5, 7939170.3125, 7957723.4375, 8002425.0, 8003343.75, 8029742.1875, 8035868.75, 8036464.0625, 8044503.125, 8045364.0625, 8065301.5625, 8079314.0625, 8080493.75, 8093339.0625, 8102673.4375, 8104157.8125, 8106215.625, 8106915.625, 8107323.4375, 8110551.5625, 8155075.0, 8155098.4375, 8162831.25, 8175834.375, 8185165.625, 8199889.0625, 8217214.0625, 8224896.875, 8225084.375, 8228195.3125, 8231610.9375, 8233014.0625, 8234057.8125, 8236915.625, 8258640.625, 8314543.75, 8316631.25, 8318645.3125, 8319279.6875, 8321006.25, 8323854.6875, 8324457.8125, 8324606.25, 8327953.125, 8355681.25, 8375571.875, 8381584.375, 8436653.125, 8443956.25, 8474212.5, 8475382.8125, 8479462.5, 8505939.0625, 8507109.375, 8510400.0, 8512410.9375, 8512457.8125, 8512768.75, 8521040.625, 8521375.0, 8523321.875, 8528273.4375, 8528293.75, 8544014.0625, 8553157.8125, 8553715.625, 8555017.1875, 8556200.0, 8581360.9375, 8615962.5, 8615976.5625, 8628879.6875, 8630654.6875, 8633420.3125, 8641423.4375, 8642737.5, 8647290.625, 8647314.0625, 8649462.5, 8652128.125, 8652279.6875, 8653962.5, 8655706.25, 8655992.1875, 8656410.9375, 8658323.4375, 8660142.1875, 8660290.625, 8662539.0625, 8663543.75, 8674667.1875, 8676589.0625, 8681626.5625, 8685815.625, 8686514.0625, 8686618.75, 8687382.8125, 8688229.6875, 8691660.9375, 8693520.3125, 8693823.4375, 8694390.625, 8695040.625, 8695165.625, 8705792.1875, 8714126.5625, 8721728.125, 8722078.125, 8723871.875, 8725134.375, 8725503.125, 8730407.8125, 8731415.625, 8732360.9375, 8732778.125, 8736526.5625, 8750370.3125, 8750985.9375, 8751337.5, 8752073.4375, 8753109.375, 8755139.0625, 8755175.0, 8755176.5625, 8757950.0, 8759042.1875, 8774501.5625, 8775843.75, 8776131.25, 8776176.5625, 8777504.6875, 8778620.3125, 8779315.625, 8779342.1875, 8782006.25, 8788775.0, 8788798.4375, 8799475.0, 8800679.6875, 8825878.125, 8826142.1875, 8826439.0625, 8830545.3125, 8850582.8125, 8854860.9375, 8855450.0, 8869715.625, 8870170.3125, 8881575.0, 8883412.5, 8889673.4375, 8890287.5, 8891701.5625, 8891940.625, 8892476.5625, 8893582.8125, 8896279.6875, 8901092.1875, 8902142.1875, 8904496.875, 8904643.75, 8906667.1875, 8907581.25, 8907656.25, 8908778.125, 8909198.4375, 8919895.3125, 8924735.9375, 8930115.625, 8930248.4375, 8930520.3125, 8932943.75, 8934642.1875, 8934645.3125, 8935000.0, 8936182.8125, 8953471.875, 8954145.3125, 8956670.3125, 8979507.8125, 8980626.5625, 8990135.9375, 8991582.8125, 8991676.5625, 9010579.6875, 9011332.8125, 9011521.875, 9013765.625, 9014504.6875, 9015348.4375, 9016509.375, 9016634.375, 9016650.0, 9020342.1875, 9033762.5, 9033807.8125, 9044646.875, 9044671.875, 9045568.75, 9046998.4375, 9058281.25, 9058840.625, 9059542.1875, 9066779.6875, 9068576.5625, 9068648.4375, 9070617.1875, 9084465.625, 9105070.3125, 9111625.0, 9120806.25, 9143251.5625, 9146262.5, 9146464.0625, 9146465.625, 9148414.0625, 9152996.875, 9153106.25, 9154621.875, 9186750.0, 9191145.3125, 9369500.0, 9369506.25, 9397035.9375, 9420517.1875, 9480623.4375, 9483428.125, 9764282.8125, 9766665.625, 9773759.375, 9786145.3125, 9790156.25, 9811782.8125, 9828964.0625, 9833940.625, 9836900.0, 9860187.5, 9895707.8125, 9925978.125, 9963040.625, 9999162.5, 10004800.0, 10007876.5625, 10015054.6875, 10024079.6875, 10074845.3125, 10074968.75, 10076145.3125, 10078871.875, 10087079.6875, 10088965.625, 10103271.875, 10103950.0, 10109232.8125, 10134259.375, 10210343.75, 10210357.8125, 10211928.125, 10216801.5625, 10242235.9375, 10289709.375, 10306195.3125, 10346012.5, 10346078.125, 10485781.25, 10888176.5625, 10912312.5, 10914170.3125, 10915254.6875, 10916003.125, 10916610.9375, 10916620.3125, 10916662.5, 10917710.9375, 10917907.8125, 10918300.0, 10919909.375, 10925604.6875, 10925632.8125, 10926600.0, 10926806.25, 10926851.5625, 10937257.8125, 10937320.3125, 10942028.125, 10947945.3125, 10952495.3125], [30.890433777398737, 10.548363510170729, 39.844537958538496, 33.02821516835109, 11.636795160605544, 49.83818098642715, 12.315959224946688, 34.85212248093043, 6.899224837724228, 28.33711922250459, 89.7579556385943, 28.66396831728563, 28.98903946072959, 7.646050361293399, 36.676104071223676, 95.5404777507576, 12.273985225520013, 26.880257246139177, 77.73619701653085, 42.27394134125774, 27.27805306922723, 155.90984466665515, 48.280676214757065, 60.72035537966346, 13.92982329437374, 80.56455053212358, 61.2222564687327, 57.52731379033357, 17.523482957641647, 41.296153410962816, 6.081222551141978, 16.33736231199932, 36.1649617111457, 14.95625110748746, 34.991424650294164, 11.042544795252999, 20.133396756930306, 36.613271012597835, 11.384429277291462, 10.155691181010893, 24.945497726368874, 18.745746852526867, 40.07258331815815, 18.635828080762668, 24.470782073965093, 15.627895555456304, 22.57058224277597, 56.01610472757089, 109.69854474298, 29.859994846417578, 11.671271875213419, 48.09188013097675, 12.898774203526733, 312.1767231781295, 18.051480993176344, 42.24445417518077, 71.87270892067053, 27.370338599324285, 113.63786434638915, 37.08629120876693, 5.458044476437725, 16.71443092833555, 12.752040279437853, 86.1724641449021, 77.60052388659393, 42.211664704770286, 13.652853848367489, 29.12868881805865, 14.427212212731146, 30.642353485374475, 35.7178421823081, 14.407708924974969, 27.87894714380153, 65.78452421748713, 5.193898482446975, 93.42004659949302, 51.590084591916224, 15.717090911810132, 32.28607884867232, 7.497211617074785, 8.670288703729891, 10.221795474635645, 50.098238361826674, 71.45223241906777, 35.792344629678496, 20.87449029590626, 38.10884948978567, 50.477497982653965, 23.806413547376042, 30.829272523074966, 15.808892467439795, 74.06152569901897, 7.595192829114032, 9.542978903187993, 24.889617371882906, 81.86603145754466, 143.41246845949803, 13.28933456008917, 38.19947844276421, 36.42338883425106, 19.451631459097122, 19.96537063438892, 45.72961265220246, 19.205590139450656, 16.389221211983312, 11.974070015218716, 9.64122885792916, 89.26108943424114, 30.739204548261153, 21.976750445377622, 12.730941336882417, 9.48842825458106, 34.21739060924602, 31.38347296804488, 76.57803985407054, 74.6988978687124, 7.950538837374225, 36.478763818291014, 80.26771317642186, 174.46714106690894, 103.97444529325065, 8.558313605721324, 15.613462880406752, 46.95094791927048, 11.290383389178492, 14.637292831196817, 27.05094249487022, 8.388806041624312, 54.08317769367244, 121.57484043345373, 6.324282063041715, 18.179132870175913, 69.57603779858577, 6.6511100973090045, 83.97099428834773, 58.15811537485269, 46.1940953074106, 116.76469935851652, 19.51897682871021, 50.443666386761855, 60.593371687615814, 34.10475866474238, 87.78394144926551, 71.56255313629973, 10.678507777252472, 10.426039909964478, 42.35831335503805, 79.78665597959711, 108.71538250155383, 29.353141894984276, 44.614420774124824, 87.19437838966611, 10.691944083630672, 107.74286922261825, 86.78247950241419, 15.797077184695205, 34.8161864998033, 16.778518866488064, 74.08018384448421, 79.53985152974263, 5.656301631383149, 19.302058876927955, 52.17204052406056, 100.815359994032, 122.86937303122758, 5.526512353841967, 27.21037801494453, 174.0948949688148, 30.068556188272794, 23.501298514351074, 53.81605619017003, 13.830389477029843, 122.76734520457161, 83.1876624983222, 6.979483250869753, 76.84719522295808, 11.912551816545186, 25.19076088279791, 9.814491625396375, 13.342210759933344, 82.37285384016599, 65.86563346182687, 42.8618690885948, 16.212108238359153, 76.20934330756097, 6.871237338401643, 27.89182386363326, 6.191331687007269, 26.524881436194782, 61.7623724276093, 27.326995313756136, 42.96637067744494, 40.44775648673459, 97.39871414702895, 108.84229176144163, 8.653035773218265, 21.80263338395838, 17.65242865609403, 10.261164091249917, 16.81719167659086, 7.0564056477575825, 39.20636873267961, 57.20422746616607, 13.017230714995534, 53.41449463134148, 74.25087944748769, 15.995932235015298, 5.232998043823233, 72.26312606298735, 90.17568334382744, 30.72880011891157, 28.362123704677828, 16.525770282066734, 26.987465219499676, 80.08975682134304, 10.135342414480418, 61.4540417629519, 57.57541280113968, 21.523239054296088, 5.038277483073895, 8.21699888642922, 32.583471865764245, 9.23295421902388, 6.72032031171249, 5.428573299734483, 108.58385025504042, 18.73488459708172, 6.482547798094372, 6.793024665341374, 36.58572887379867, 48.622736873386025, 54.57389157858253, 49.36325641042693, 48.14915516459932, 7.714821969935317, 31.445222635288687, 6.826773756075321, 83.87540896666995, 70.29560841785485, 45.8450119680475, 32.25026549557025, 10.39818158249323, 16.16021111705578, 107.69808519745186, 57.38029945710336, 8.626601969888082, 96.89565977465308, 50.418536097522235, 19.344992802939462, 66.28354412583994, 25.37513801799512, 5.322766438707554, 24.77052862514305, 62.53563225992991, 24.829227848882372, 21.39893160240602, 14.248792993153563, 20.362085641696904, 12.638412261653453, 94.34816860511845, 28.03452293680462, 6.190330863358185, 33.24096102453128, 7.128902255064621, 61.14549881502812, 5.169170636084576, 51.10076470367956, 17.938198194160872, 83.27539041451277, 119.52603714122611, 62.31470076100427, 59.396508181459495, 103.35013902330826, 28.81521852963149, 9.62661202679812, 50.09361705020766, 44.89005263093605, 22.99077316173677, 60.691203834048835, 48.84367112592644, 6.100829223106714, 55.59546474104187, 33.03060921115676, 23.572522533276267, 13.009215708360273, 5.099047918691611, 74.6253321242085, 72.47283197541005, 14.751668303175869])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([7222690.625, 7222710.9375, 7782487.5, 7939170.3125, 7957723.4375, 8002425.0, 8003343.75, 8029742.1875, 8035868.75, 8036464.0625, 8044503.125, 8045364.0625, 8065301.5625, 8079314.0625, 8080493.75, 8093339.0625, 8102673.4375, 8104157.8125, 8106215.625, 8106915.625, 8107323.4375, 8110551.5625, 8155075.0, 8155098.4375, 8162831.25, 8175834.375, 8185165.625, 8199889.0625, 8217214.0625, 8224896.875, 8225084.375, 8228195.3125, 8231610.9375, 8233014.0625, 8234057.8125, 8236915.625, 8258640.625, 8314543.75, 8316631.25, 8318645.3125, 8319279.6875, 8321006.25, 8323854.6875, 8324457.8125, 8324606.25, 8327953.125, 8355681.25, 8375571.875, 8381584.375, 8436653.125, 8443956.25, 8474212.5, 8475382.8125, 8479462.5, 8505939.0625, 8507109.375, 8510400.0, 8512410.9375, 8512457.8125, 8512768.75, 8521040.625, 8521375.0, 8523321.875, 8528273.4375, 8528293.75, 8544014.0625, 8553157.8125, 8553715.625, 8555017.1875, 8556200.0, 8581360.9375, 8615962.5, 8615976.5625, 8628879.6875, 8630654.6875, 8633420.3125, 8641423.4375, 8642737.5, 8647290.625, 8647314.0625, 8649462.5, 8652128.125, 8652279.6875, 8653962.5, 8655706.25, 8655992.1875, 8656410.9375, 8658323.4375, 8660142.1875, 8660290.625, 8662539.0625, 8663543.75, 8674667.1875, 8676589.0625, 8681626.5625, 8685815.625, 8686514.0625, 8686618.75, 8687382.8125, 8688229.6875, 8691660.9375, 8693520.3125, 8693823.4375, 8694390.625, 8695040.625, 8695165.625, 8705792.1875, 8714126.5625, 8721728.125, 8722078.125, 8723871.875, 8725134.375, 8725503.125, 8730407.8125, 8731415.625, 8732360.9375, 8732778.125, 8736526.5625, 8750370.3125, 8750985.9375, 8751337.5, 8752073.4375, 8753109.375, 8755139.0625, 8755175.0, 8755176.5625, 8757950.0, 8759042.1875, 8774501.5625, 8775843.75, 8776131.25, 8776176.5625, 8777504.6875, 8778620.3125, 8779315.625, 8779342.1875, 8782006.25, 8788775.0, 8788798.4375, 8799475.0, 8800679.6875, 8825878.125, 8826142.1875, 8826439.0625, 8830545.3125, 8850582.8125, 8854860.9375, 8855450.0, 8869715.625, 8870170.3125, 8881575.0, 8883412.5, 8889673.4375, 8890287.5, 8891701.5625, 8891940.625, 8892476.5625, 8893582.8125, 8896279.6875, 8901092.1875, 8902142.1875, 8904496.875, 8904643.75, 8906667.1875, 8907581.25, 8907656.25, 8908778.125, 8909198.4375, 8919895.3125, 8924735.9375, 8930115.625, 8930248.4375, 8930520.3125, 8932943.75, 8934642.1875, 8934645.3125, 8935000.0, 8936182.8125, 8953471.875, 8954145.3125, 8956670.3125, 8979507.8125, 8980626.5625, 8990135.9375, 8991582.8125, 8991676.5625, 9010579.6875, 9011332.8125, 9011521.875, 9013765.625, 9014504.6875, 9015348.4375, 9016509.375, 9016634.375, 9016650.0, 9020342.1875, 9033762.5, 9033807.8125, 9044646.875, 9044671.875, 9045568.75, 9046998.4375, 9058281.25, 9058840.625, 9059542.1875, 9066779.6875, 9068576.5625, 9068648.4375, 9070617.1875, 9084465.625, 9105070.3125, 9111625.0, 9120806.25, 9143251.5625, 9146262.5, 9146464.0625, 9146465.625, 9148414.0625, 9152996.875, 9153106.25, 9154621.875, 9186750.0, 9191145.3125, 9369500.0, 9369506.25, 9397035.9375, 9420517.1875, 9480623.4375, 9483428.125, 9764282.8125, 9766665.625, 9773759.375, 9786145.3125, 9790156.25, 9811782.8125, 9828964.0625, 9833940.625, 9836900.0, 9860187.5, 9895707.8125, 9925978.125, 9963040.625, 9999162.5, 10004800.0, 10007876.5625, 10015054.6875, 10024079.6875, 10074845.3125, 10074968.75, 10076145.3125, 10078871.875, 10087079.6875, 10088965.625, 10103271.875, 10103950.0, 10109232.8125, 10134259.375, 10210343.75, 10210357.8125, 10211928.125, 10216801.5625, 10242235.9375, 10289709.375, 10306195.3125, 10346012.5, 10346078.125, 10485781.25, 10888176.5625, 10912312.5, 10914170.3125, 10915254.6875, 10916003.125, 10916610.9375, 10916620.3125, 10916662.5, 10917710.9375, 10917907.8125, 10918300.0, 10919909.375, 10925604.6875, 10925632.8125, 10926600.0, 10926806.25, 10926851.5625, 10937257.8125, 10937320.3125, 10942028.125, 10947945.3125, 10952495.3125], [30.890433777398737, 10.548363510170729, 39.844537958538496, 33.02821516835109, 11.636795160605544, 49.83818098642715, 12.315959224946688, 34.85212248093043, 6.899224837724228, 28.33711922250459, 89.7579556385943, 28.66396831728563, 28.98903946072959, 7.646050361293399, 36.676104071223676, 95.5404777507576, 12.273985225520013, 26.880257246139177, 77.73619701653085, 42.27394134125774, 27.27805306922723, 155.90984466665515, 48.280676214757065, 60.72035537966346, 13.92982329437374, 80.56455053212358, 61.2222564687327, 57.52731379033357, 17.523482957641647, 41.296153410962816, 6.081222551141978, 16.33736231199932, 36.1649617111457, 14.95625110748746, 34.991424650294164, 11.042544795252999, 20.133396756930306, 36.613271012597835, 11.384429277291462, 10.155691181010893, 24.945497726368874, 18.745746852526867, 40.07258331815815, 18.635828080762668, 24.470782073965093, 15.627895555456304, 22.57058224277597, 56.01610472757089, 109.69854474298, 29.859994846417578, 11.671271875213419, 48.09188013097675, 12.898774203526733, 312.1767231781295, 18.051480993176344, 42.24445417518077, 71.87270892067053, 27.370338599324285, 113.63786434638915, 37.08629120876693, 5.458044476437725, 16.71443092833555, 12.752040279437853, 86.1724641449021, 77.60052388659393, 42.211664704770286, 13.652853848367489, 29.12868881805865, 14.427212212731146, 30.642353485374475, 35.7178421823081, 14.407708924974969, 27.87894714380153, 65.78452421748713, 5.193898482446975, 93.42004659949302, 51.590084591916224, 15.717090911810132, 32.28607884867232, 7.497211617074785, 8.670288703729891, 10.221795474635645, 50.098238361826674, 71.45223241906777, 35.792344629678496, 20.87449029590626, 38.10884948978567, 50.477497982653965, 23.806413547376042, 30.829272523074966, 15.808892467439795, 74.06152569901897, 7.595192829114032, 9.542978903187993, 24.889617371882906, 81.86603145754466, 143.41246845949803, 13.28933456008917, 38.19947844276421, 36.42338883425106, 19.451631459097122, 19.96537063438892, 45.72961265220246, 19.205590139450656, 16.389221211983312, 11.974070015218716, 9.64122885792916, 89.26108943424114, 30.739204548261153, 21.976750445377622, 12.730941336882417, 9.48842825458106, 34.21739060924602, 31.38347296804488, 76.57803985407054, 74.6988978687124, 7.950538837374225, 36.478763818291014, 80.26771317642186, 174.46714106690894, 103.97444529325065, 8.558313605721324, 15.613462880406752, 46.95094791927048, 11.290383389178492, 14.637292831196817, 27.05094249487022, 8.388806041624312, 54.08317769367244, 121.57484043345373, 6.324282063041715, 18.179132870175913, 69.57603779858577, 6.6511100973090045, 83.97099428834773, 58.15811537485269, 46.1940953074106, 116.76469935851652, 19.51897682871021, 50.443666386761855, 60.593371687615814, 34.10475866474238, 87.78394144926551, 71.56255313629973, 10.678507777252472, 10.426039909964478, 42.35831335503805, 79.78665597959711, 108.71538250155383, 29.353141894984276, 44.614420774124824, 87.19437838966611, 10.691944083630672, 107.74286922261825, 86.78247950241419, 15.797077184695205, 34.8161864998033, 16.778518866488064, 74.08018384448421, 79.53985152974263, 5.656301631383149, 19.302058876927955, 52.17204052406056, 100.815359994032, 122.86937303122758, 5.526512353841967, 27.21037801494453, 174.0948949688148, 30.068556188272794, 23.501298514351074, 53.81605619017003, 13.830389477029843, 122.76734520457161, 83.1876624983222, 6.979483250869753, 76.84719522295808, 11.912551816545186, 25.19076088279791, 9.814491625396375, 13.342210759933344, 82.37285384016599, 65.86563346182687, 42.8618690885948, 16.212108238359153, 76.20934330756097, 6.871237338401643, 27.89182386363326, 6.191331687007269, 26.524881436194782, 61.7623724276093, 27.326995313756136, 42.96637067744494, 40.44775648673459, 97.39871414702895, 108.84229176144163, 8.653035773218265, 21.80263338395838, 17.65242865609403, 10.261164091249917, 16.81719167659086, 7.0564056477575825, 39.20636873267961, 57.20422746616607, 13.017230714995534, 53.41449463134148, 74.25087944748769, 15.995932235015298, 5.232998043823233, 72.26312606298735, 90.17568334382744, 30.72880011891157, 28.362123704677828, 16.525770282066734, 26.987465219499676, 80.08975682134304, 10.135342414480418, 61.4540417629519, 57.57541280113968, 21.523239054296088, 5.038277483073895, 8.21699888642922, 32.583471865764245, 9.23295421902388, 6.72032031171249, 5.428573299734483, 108.58385025504042, 18.73488459708172, 6.482547798094372, 6.793024665341374, 36.58572887379867, 48.622736873386025, 54.57389157858253, 49.36325641042693, 48.14915516459932, 7.714821969935317, 31.445222635288687, 6.826773756075321, 83.87540896666995, 70.29560841785485, 45.8450119680475, 32.25026549557025, 10.39818158249323, 16.16021111705578, 107.69808519745186, 57.38029945710336, 8.626601969888082, 96.89565977465308, 50.418536097522235, 19.344992802939462, 66.28354412583994, 25.37513801799512, 5.322766438707554, 24.77052862514305, 62.53563225992991, 24.829227848882372, 21.39893160240602, 14.248792993153563, 20.362085641696904, 12.638412261653453, 94.34816860511845, 28.03452293680462, 6.190330863358185, 33.24096102453128, 7.128902255064621, 61.14549881502812, 5.169170636084576, 51.10076470367956, 17.938198194160872, 83.27539041451277, 119.52603714122611, 62.31470076100427, 59.396508181459495, 103.35013902330826, 28.81521852963149, 9.62661202679812, 50.09361705020766, 44.89005263093605, 22.99077316173677, 60.691203834048835, 48.84367112592644, 6.100829223106714, 55.59546474104187, 33.03060921115676, 23.572522533276267, 13.009215708360273, 5.099047918691611, 74.6253321242085, 72.47283197541005, 14.751668303175869])
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);
([7222690.625, 7222710.9375, 7782487.5, 7939170.3125, 7957723.4375, 8002425.0, 8003343.75, 8029742.1875, 8035868.75, 8036464.0625, 8044503.125, 8045364.0625, 8065301.5625, 8079314.0625, 8080493.75, 8093339.0625, 8102673.4375, 8104157.8125, 8106215.625, 8106915.625, 8107323.4375, 8110551.5625, 8155075.0, 8155098.4375, 8162831.25, 8175834.375, 8185165.625, 8199889.0625, 8217214.0625, 8224896.875, 8225084.375, 8228195.3125, 8231610.9375, 8233014.0625, 8234057.8125, 8236915.625, 8258640.625, 8314543.75, 8316631.25, 8318645.3125, 8319279.6875, 8321006.25, 8323854.6875, 8324457.8125, 8324606.25, 8327953.125, 8355681.25, 8375571.875, 8381584.375, 8436653.125, 8443956.25, 8474212.5, 8475382.8125, 8479462.5, 8505939.0625, 8507109.375, 8510400.0, 8512410.9375, 8512457.8125, 8512768.75, 8521040.625, 8521375.0, 8523321.875, 8528273.4375, 8528293.75, 8544014.0625, 8553157.8125, 8553715.625, 8555017.1875, 8556200.0, 8581360.9375, 8615962.5, 8615976.5625, 8628879.6875, 8630654.6875, 8633420.3125, 8641423.4375, 8642737.5, 8647290.625, 8647314.0625, 8649462.5, 8652128.125, 8652279.6875, 8653962.5, 8655706.25, 8655992.1875, 8656410.9375, 8658323.4375, 8660142.1875, 8660290.625, 8662539.0625, 8663543.75, 8674667.1875, 8676589.0625, 8681626.5625, 8685815.625, 8686514.0625, 8686618.75, 8687382.8125, 8688229.6875, 8691660.9375, 8693520.3125, 8693823.4375, 8694390.625, 8695040.625, 8695165.625, 8705792.1875, 8714126.5625, 8721728.125, 8722078.125, 8723871.875, 8725134.375, 8725503.125, 8730407.8125, 8731415.625, 8732360.9375, 8732778.125, 8736526.5625, 8750370.3125, 8750985.9375, 8751337.5, 8752073.4375, 8753109.375, 8755139.0625, 8755175.0, 8755176.5625, 8757950.0, 8759042.1875, 8774501.5625, 8775843.75, 8776131.25, 8776176.5625, 8777504.6875, 8778620.3125, 8779315.625, 8779342.1875, 8782006.25, 8788775.0, 8788798.4375, 8799475.0, 8800679.6875, 8825878.125, 8826142.1875, 8826439.0625, 8830545.3125, 8850582.8125, 8854860.9375, 8855450.0, 8869715.625, 8870170.3125, 8881575.0, 8883412.5, 8889673.4375, 8890287.5, 8891701.5625, 8891940.625, 8892476.5625, 8893582.8125, 8896279.6875, 8901092.1875, 8902142.1875, 8904496.875, 8904643.75, 8906667.1875, 8907581.25, 8907656.25, 8908778.125, 8909198.4375, 8919895.3125, 8924735.9375, 8930115.625, 8930248.4375, 8930520.3125, 8932943.75, 8934642.1875, 8934645.3125, 8935000.0, 8936182.8125, 8953471.875, 8954145.3125, 8956670.3125, 8979507.8125, 8980626.5625, 8990135.9375, 8991582.8125, 8991676.5625, 9010579.6875, 9011332.8125, 9011521.875, 9013765.625, 9014504.6875, 9015348.4375, 9016509.375, 9016634.375, 9016650.0, 9020342.1875, 9033762.5, 9033807.8125, 9044646.875, 9044671.875, 9045568.75, 9046998.4375, 9058281.25, 9058840.625, 9059542.1875, 9066779.6875, 9068576.5625, 9068648.4375, 9070617.1875, 9084465.625, 9105070.3125, 9111625.0, 9120806.25, 9143251.5625, 9146262.5, 9146464.0625, 9146465.625, 9148414.0625, 9152996.875, 9153106.25, 9154621.875, 9186750.0, 9191145.3125, 9369500.0, 9369506.25, 9397035.9375, 9420517.1875, 9480623.4375, 9483428.125, 9764282.8125, 9766665.625, 9773759.375, 9786145.3125, 9790156.25, 9811782.8125, 9828964.0625, 9833940.625, 9836900.0, 9860187.5, 9895707.8125, 9925978.125, 9963040.625, 9999162.5, 10004800.0, 10007876.5625, 10015054.6875, 10024079.6875, 10074845.3125, 10074968.75, 10076145.3125, 10078871.875, 10087079.6875, 10088965.625, 10103271.875, 10103950.0, 10109232.8125, 10134259.375, 10210343.75, 10210357.8125, 10211928.125, 10216801.5625, 10242235.9375, 10289709.375, 10306195.3125, 10346012.5, 10346078.125, 10485781.25, 10888176.5625, 10912312.5, 10914170.3125, 10915254.6875, 10916003.125, 10916610.9375, 10916620.3125, 10916662.5, 10917710.9375, 10917907.8125, 10918300.0, 10919909.375, 10925604.6875, 10925632.8125, 10926600.0, 10926806.25, 10926851.5625, 10937257.8125, 10937320.3125, 10942028.125, 10947945.3125, 10952495.3125], [30.890433777398737, 10.548363510170729, 39.844537958538496, 33.02821516835109, 11.636795160605544, 49.83818098642715, 12.315959224946688, 34.85212248093043, 6.899224837724228, 28.33711922250459, 89.7579556385943, 28.66396831728563, 28.98903946072959, 7.646050361293399, 36.676104071223676, 95.5404777507576, 12.273985225520013, 26.880257246139177, 77.73619701653085, 42.27394134125774, 27.27805306922723, 155.90984466665515, 48.280676214757065, 60.72035537966346, 13.92982329437374, 80.56455053212358, 61.2222564687327, 57.52731379033357, 17.523482957641647, 41.296153410962816, 6.081222551141978, 16.33736231199932, 36.1649617111457, 14.95625110748746, 34.991424650294164, 11.042544795252999, 20.133396756930306, 36.613271012597835, 11.384429277291462, 10.155691181010893, 24.945497726368874, 18.745746852526867, 40.07258331815815, 18.635828080762668, 24.470782073965093, 15.627895555456304, 22.57058224277597, 56.01610472757089, 109.69854474298, 29.859994846417578, 11.671271875213419, 48.09188013097675, 12.898774203526733, 312.1767231781295, 18.051480993176344, 42.24445417518077, 71.87270892067053, 27.370338599324285, 113.63786434638915, 37.08629120876693, 5.458044476437725, 16.71443092833555, 12.752040279437853, 86.1724641449021, 77.60052388659393, 42.211664704770286, 13.652853848367489, 29.12868881805865, 14.427212212731146, 30.642353485374475, 35.7178421823081, 14.407708924974969, 27.87894714380153, 65.78452421748713, 5.193898482446975, 93.42004659949302, 51.590084591916224, 15.717090911810132, 32.28607884867232, 7.497211617074785, 8.670288703729891, 10.221795474635645, 50.098238361826674, 71.45223241906777, 35.792344629678496, 20.87449029590626, 38.10884948978567, 50.477497982653965, 23.806413547376042, 30.829272523074966, 15.808892467439795, 74.06152569901897, 7.595192829114032, 9.542978903187993, 24.889617371882906, 81.86603145754466, 143.41246845949803, 13.28933456008917, 38.19947844276421, 36.42338883425106, 19.451631459097122, 19.96537063438892, 45.72961265220246, 19.205590139450656, 16.389221211983312, 11.974070015218716, 9.64122885792916, 89.26108943424114, 30.739204548261153, 21.976750445377622, 12.730941336882417, 9.48842825458106, 34.21739060924602, 31.38347296804488, 76.57803985407054, 74.6988978687124, 7.950538837374225, 36.478763818291014, 80.26771317642186, 174.46714106690894, 103.97444529325065, 8.558313605721324, 15.613462880406752, 46.95094791927048, 11.290383389178492, 14.637292831196817, 27.05094249487022, 8.388806041624312, 54.08317769367244, 121.57484043345373, 6.324282063041715, 18.179132870175913, 69.57603779858577, 6.6511100973090045, 83.97099428834773, 58.15811537485269, 46.1940953074106, 116.76469935851652, 19.51897682871021, 50.443666386761855, 60.593371687615814, 34.10475866474238, 87.78394144926551, 71.56255313629973, 10.678507777252472, 10.426039909964478, 42.35831335503805, 79.78665597959711, 108.71538250155383, 29.353141894984276, 44.614420774124824, 87.19437838966611, 10.691944083630672, 107.74286922261825, 86.78247950241419, 15.797077184695205, 34.8161864998033, 16.778518866488064, 74.08018384448421, 79.53985152974263, 5.656301631383149, 19.302058876927955, 52.17204052406056, 100.815359994032, 122.86937303122758, 5.526512353841967, 27.21037801494453, 174.0948949688148, 30.068556188272794, 23.501298514351074, 53.81605619017003, 13.830389477029843, 122.76734520457161, 83.1876624983222, 6.979483250869753, 76.84719522295808, 11.912551816545186, 25.19076088279791, 9.814491625396375, 13.342210759933344, 82.37285384016599, 65.86563346182687, 42.8618690885948, 16.212108238359153, 76.20934330756097, 6.871237338401643, 27.89182386363326, 6.191331687007269, 26.524881436194782, 61.7623724276093, 27.326995313756136, 42.96637067744494, 40.44775648673459, 97.39871414702895, 108.84229176144163, 8.653035773218265, 21.80263338395838, 17.65242865609403, 10.261164091249917, 16.81719167659086, 7.0564056477575825, 39.20636873267961, 57.20422746616607, 13.017230714995534, 53.41449463134148, 74.25087944748769, 15.995932235015298, 5.232998043823233, 72.26312606298735, 90.17568334382744, 30.72880011891157, 28.362123704677828, 16.525770282066734, 26.987465219499676, 80.08975682134304, 10.135342414480418, 61.4540417629519, 57.57541280113968, 21.523239054296088, 5.038277483073895, 8.21699888642922, 32.583471865764245, 9.23295421902388, 6.72032031171249, 5.428573299734483, 108.58385025504042, 18.73488459708172, 6.482547798094372, 6.793024665341374, 36.58572887379867, 48.622736873386025, 54.57389157858253, 49.36325641042693, 48.14915516459932, 7.714821969935317, 31.445222635288687, 6.826773756075321, 83.87540896666995, 70.29560841785485, 45.8450119680475, 32.25026549557025, 10.39818158249323, 16.16021111705578, 107.69808519745186, 57.38029945710336, 8.626601969888082, 96.89565977465308, 50.418536097522235, 19.344992802939462, 66.28354412583994, 25.37513801799512, 5.322766438707554, 24.77052862514305, 62.53563225992991, 24.829227848882372, 21.39893160240602, 14.248792993153563, 20.362085641696904, 12.638412261653453, 94.34816860511845, 28.03452293680462, 6.190330863358185, 33.24096102453128, 7.128902255064621, 61.14549881502812, 5.169170636084576, 51.10076470367956, 17.938198194160872, 83.27539041451277, 119.52603714122611, 62.31470076100427, 59.396508181459495, 103.35013902330826, 28.81521852963149, 9.62661202679812, 50.09361705020766, 44.89005263093605, 22.99077316173677, 60.691203834048835, 48.84367112592644, 6.100829223106714, 55.59546474104187, 33.03060921115676, 23.572522533276267, 13.009215708360273, 5.099047918691611, 74.6253321242085, 72.47283197541005, 14.751668303175869])
Detected energies during the discharge + Energy spectrum
multiplot(icon_fig, T_int_first,E,xle,Etot)