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 = 43934
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);
([4975517.1875, 5538985.9375, 5868509.375, 5989235.9375, 5998567.1875, 6048039.0625, 6125868.75, 6177615.625, 6180579.6875, 6180585.9375, 6180673.4375, 6189184.375, 6246660.9375, 6292414.0625, 6357865.625, 6411896.875, 6459968.75, 6530726.5625, 6531326.5625, 6562910.9375, 6567898.4375, 6579478.125, 6579489.0625, 6584587.5, 6624571.875, 6721454.6875, 6731523.4375, 6749887.5, 6763726.5625, 6772865.625, 6773839.0625, 6776714.0625, 6776989.0625, 6777057.8125, 6778220.3125, 6867539.0625, 6893815.625, 6930190.625, 6962859.375, 6993120.3125, 6993689.0625, 6996912.5, 7027967.1875, 7045651.5625, 7062406.25, 7063042.1875, 7066300.0, 7086451.5625, 7121289.0625, 7141043.75, 7142178.125, 7165532.8125, 7168423.4375, 7184635.9375, 7184659.375, 7189259.375, 7190114.0625, 7191862.5, 7192293.75, 7193106.25, 7212032.8125, 7218154.6875, 7230906.25, 7232870.3125, 7236190.625, 7240434.375, 7249050.0, 7249468.75, 7249837.5, 7250028.125, 7255595.3125, 7274440.625, 7274545.3125, 7275440.625, 7309229.6875, 7310814.0625, 7313307.8125, 7313468.75, 7313693.75, 7314529.6875, 7314890.625, 7317381.25, 7414946.875, 7700614.0625, 7708926.5625, 7709200.0, 7735568.75, 7965271.875, 7968545.3125, 7970562.5, 8049285.9375, 8051253.125, 8263325.0, 8347753.125, 8361234.375, 8361898.4375, 8402368.75, 8471493.75, 8472750.0, 8473246.875, 8481565.625, 8482807.8125, 8483193.75, 8490667.1875, 8534084.375, 8546700.0, 8576859.375, 8592812.5, 8595153.125, 8600431.25, 8610378.125, 8695423.4375, 8717903.125, 8754657.8125, 8810448.4375, 8872057.8125, 8910245.3125, 8930732.8125, 8985303.125, 9038712.5, 9056056.25, 9150265.625, 9205842.1875, 9206595.3125, 9210360.9375, 9224882.8125, 9227021.875, 9227695.3125, 9232031.25, 9240171.875, 9291871.875, 9313584.375, 9314432.8125, 9315001.5625, 9315351.5625, 9315567.1875, 9315671.875, 9315846.875, 9316570.3125, 9316856.25, 9317123.4375, 9317173.4375, 9317401.5625, 9317585.9375, 9318176.5625, 9318651.5625, 9318821.875, 9318900.0, 9319110.9375, 9319479.6875, 9320010.9375, 9320062.5, 9320212.5, 9320309.375, 9320504.6875, 9320565.625, 9320571.875, 9320603.125, 9321207.8125, 9321239.0625, 9321454.6875, 9321664.0625, 9323007.8125, 9323714.0625, 9323745.3125, 9324637.5, 9326273.4375, 9326434.375, 9326931.25, 9327328.125, 9327414.0625, 9327846.875, 9327968.75, 9328142.1875, 9328270.3125, 9328321.875, 9328660.9375, 9328825.0, 9328918.75, 9329060.9375, 9329432.8125, 9329732.8125, 9331014.0625, 9331415.625, 9331692.1875, 9331745.3125, 9333165.625, 9333245.3125, 9333339.0625, 9333437.5, 9333928.125, 9333959.375, 9334096.875, 9334250.0, 9334934.375, 9335101.5625, 9335318.75, 9335537.5, 9335728.125, 9335732.8125, 9336006.25, 9336260.9375, 9336440.625, 9337343.75, 9337493.75, 9337945.3125, 9339365.625, 9339478.125, 9340043.75, 9340223.4375, 9340543.75, 9340920.3125, 9341232.8125, 9341473.4375, 9342200.0, 9342518.75, 9342973.4375, 9343635.9375, 9343701.5625, 9344629.6875, 9345368.75, 9345642.1875, 9345650.0, 9345706.25, 9346053.125, 9346654.6875, 9346729.6875, 9346935.9375, 9347764.0625, 9348617.1875, 9348721.875, 9348817.1875, 9350246.875, 9350387.5, 9350698.4375, 9351012.5, 9351068.75, 9351504.6875, 9351879.6875, 9352345.3125, 9352507.8125, 9354245.3125, 9354775.0, 9354867.1875, 9355568.75, 9355756.25, 9355984.375, 9356012.5, 9356250.0, 9356428.125, 9356617.1875, 9357548.4375, 9359996.875, 9360189.0625, 9360259.375, 9361218.75, 9361732.8125, 9371170.3125, 9371745.3125, 9372304.6875, 9373350.0, 9376279.6875, 9379448.4375, 9387385.9375, 9389678.125, 9389681.25, 9389901.5625, 9390585.9375], [25.84719655312814, 19.950215922338863, 40.6684310363489, 21.221751131814393, 17.448928357645595, 16.941884812611217, 24.894072236157776, 113.99029385739553, 102.10678344881642, 42.20495631538471, 5.181036067061646, 11.776060498010839, 83.61527223508128, 45.27290470910006, 16.124462569359743, 185.10358061895482, 25.469735189657303, 8.625276072701825, 35.9266386471182, 62.00606617517457, 123.65154845635513, 178.72988137280728, 11.61872863252002, 12.499343048628146, 121.66933907252391, 31.19228135647156, 32.77344002788323, 9.884757465978442, 22.642258696050046, 107.13922085960004, 14.142577706971553, 20.186133842884924, 35.44116707975643, 30.507339299117746, 20.201762895865695, 14.728247915703452, 171.3108235406716, 49.41471136114882, 29.647467910366064, 26.426368517643066, 41.738410811342675, 14.449689162221048, 6.3981386343076325, 15.722583585042148, 45.53515646602532, 48.13014247895244, 8.82853053432161, 18.104364995154405, 63.499092427041994, 13.230301891591317, 14.730390027119766, 29.83056835318274, 27.861650839810995, 92.5162388790145, 20.94587843354077, 212.22600347374672, 7.588281741839941, 127.73387445002318, 22.139933979863237, 25.016356925211838, 26.652582652792503, 34.99947970762929, 31.73468694667585, 25.509053362926025, 10.348044152552253, 143.7682584312618, 8.913291381279372, 246.92209690710573, 62.068258007667254, 45.380119548110414, 128.53898863853698, 31.251624350049, 63.23066361576056, 14.325237156679474, 14.299866975795581, 78.10192950020401, 9.829550920211977, 32.850905671153804, 86.28841318594213, 78.10317992681829, 113.593965830088, 38.06068812239209, 6.188842777491548, 24.456827598862834, 123.44707809175932, 112.1465027086069, 89.1464723553814, 135.62709377015796, 76.66495434960375, 18.87490461864944, 38.8419621831549, 14.568408920729183, 105.33572913489625, 61.29496411793497, 11.454372105357649, 31.450035692797478, 62.18038626226722, 48.829136224805616, 264.78476992427056, 28.228141384977054, 19.365336344748197, 62.47320196283348, 76.1247095731443, 5.040846108762472, 34.37034309477079, 66.30530142718817, 31.635514921815087, 86.72672419671738, 41.14856803373344, 59.995654149039375, 25.63093661641715, 18.575134068589215, 23.180915684852856, 95.92521045766219, 14.91940542390592, 33.45764435015893, 249.65095454381049, 57.551037055090646, 19.55013681962363, 34.07244248314405, 79.55101209714978, 45.03391696541681, 20.364646828590356, 24.278587586546365, 69.33562339382175, 40.530934514544796, 22.392871665356168, 41.740509827822045, 30.871237874987447, 18.982893729576556, 17.657100034219724, 21.718565868835377, 8.02462762406903, 38.573442657385485, 19.449582329856668, 55.65985892286129, 36.09042163403225, 61.51946160212269, 19.63001301624473, 26.259315330448636, 26.552536642471857, 34.83300130996247, 18.868661934192986, 5.420286265564564, 55.444746532226304, 9.740560921640279, 74.60557140153799, 5.141416775166258, 18.57285620674824, 5.78767478403112, 9.688962200714762, 70.40653854287241, 45.47773964124998, 69.32390590585135, 38.615656184886916, 5.33055580989109, 17.570826541052455, 48.85437417188607, 15.606539888314021, 5.616591715810312, 76.81159621314835, 95.84351349096504, 62.56512480799759, 35.422713351660015, 131.81752009897963, 8.156874635824908, 18.639235544594623, 11.28697469093522, 13.640261586008519, 38.711129692819554, 14.885473391466062, 12.49230369556959, 62.074360937788626, 14.866410559767846, 8.198198761518539, 5.403480442399335, 15.72987824413751, 39.3883772118952, 193.5169403746244, 75.50424709525923, 97.14445513181829, 6.145759083297389, 34.27223023249812, 65.96375901733268, 68.42984266366811, 18.33332504664663, 119.49076117408767, 5.111721521780926, 7.065080217452233, 12.493062390141889, 8.977155353530588, 7.211560202604766, 21.54522528988402, 32.97599652081089, 6.075419243910942, 78.44391492712083, 12.715870755423216, 47.24032178995697, 33.559662124581564, 30.849351491365375, 71.22849584480943, 54.184001790812935, 24.028532837156998, 22.27150139544348, 15.358690499529356, 86.04588345432617, 12.504760413120266, 45.040267750566606, 24.134975007537392, 33.94118822799506, 52.98676832588629, 8.519445301145282, 55.68519117031635, 93.24933178184085, 30.58077190606862, 5.865398287929361, 12.113847755125589, 12.33092878969046, 24.10006589326929, 8.325239270221134, 85.36863024505763, 37.48094588457354, 17.123513249264807, 19.310472863483824, 80.56839524415346, 55.312652887576284, 23.81168323386899, 45.218468371397165, 6.503217309255719, 81.96193443763099, 14.261717606035244, 13.610464923151772, 20.466772060071065, 8.630358249074622, 9.27664967633824, 8.017639054690164, 9.379519348607975, 32.577734008302095, 12.866075909651535, 9.15417214005155, 89.38951774151107, 6.5168707369093175, 76.85850551786709, 5.131594935106798, 51.651371677219004, 20.73986738271627, 29.085046031046428, 16.092180959908823, 6.966655248526111, 26.62462334355432, 21.447556766932, 8.584460758012275, 8.245999924577138, 21.36943417055882, 30.517617779304352, 6.0085951326850475, 47.97361779963042, 48.06407847222705, 26.768887941996518, 9.790216915890813, 78.7762842910874, 21.090904338705293, 6.482749898963597, 9.203884631154823, 8.793859439051815, 55.213409494640565, 9.182994598741873, 95.81055071583589])
caption, xmean,count, xle, Etot = energy_spectrum(E_tot)
hist_file(E_hist, xmean, count, caption);
([4975517.1875, 5538985.9375, 5868509.375, 5989235.9375, 5998567.1875, 6048039.0625, 6125868.75, 6177615.625, 6180579.6875, 6180585.9375, 6180673.4375, 6189184.375, 6246660.9375, 6292414.0625, 6357865.625, 6411896.875, 6459968.75, 6530726.5625, 6531326.5625, 6562910.9375, 6567898.4375, 6579478.125, 6579489.0625, 6584587.5, 6624571.875, 6721454.6875, 6731523.4375, 6749887.5, 6763726.5625, 6772865.625, 6773839.0625, 6776714.0625, 6776989.0625, 6777057.8125, 6778220.3125, 6867539.0625, 6893815.625, 6930190.625, 6962859.375, 6993120.3125, 6993689.0625, 6996912.5, 7027967.1875, 7045651.5625, 7062406.25, 7063042.1875, 7066300.0, 7086451.5625, 7121289.0625, 7141043.75, 7142178.125, 7165532.8125, 7168423.4375, 7184635.9375, 7184659.375, 7189259.375, 7190114.0625, 7191862.5, 7192293.75, 7193106.25, 7212032.8125, 7218154.6875, 7230906.25, 7232870.3125, 7236190.625, 7240434.375, 7249050.0, 7249468.75, 7249837.5, 7250028.125, 7255595.3125, 7274440.625, 7274545.3125, 7275440.625, 7309229.6875, 7310814.0625, 7313307.8125, 7313468.75, 7313693.75, 7314529.6875, 7314890.625, 7317381.25, 7414946.875, 7700614.0625, 7708926.5625, 7709200.0, 7735568.75, 7965271.875, 7968545.3125, 7970562.5, 8049285.9375, 8051253.125, 8263325.0, 8347753.125, 8361234.375, 8361898.4375, 8402368.75, 8471493.75, 8472750.0, 8473246.875, 8481565.625, 8482807.8125, 8483193.75, 8490667.1875, 8534084.375, 8546700.0, 8576859.375, 8592812.5, 8595153.125, 8600431.25, 8610378.125, 8695423.4375, 8717903.125, 8754657.8125, 8810448.4375, 8872057.8125, 8910245.3125, 8930732.8125, 8985303.125, 9038712.5, 9056056.25, 9150265.625, 9205842.1875, 9206595.3125, 9210360.9375, 9224882.8125, 9227021.875, 9227695.3125, 9232031.25, 9240171.875, 9291871.875, 9313584.375, 9314432.8125, 9315001.5625, 9315351.5625, 9315567.1875, 9315671.875, 9315846.875, 9316570.3125, 9316856.25, 9317123.4375, 9317173.4375, 9317401.5625, 9317585.9375, 9318176.5625, 9318651.5625, 9318821.875, 9318900.0, 9319110.9375, 9319479.6875, 9320010.9375, 9320062.5, 9320212.5, 9320309.375, 9320504.6875, 9320565.625, 9320571.875, 9320603.125, 9321207.8125, 9321239.0625, 9321454.6875, 9321664.0625, 9323007.8125, 9323714.0625, 9323745.3125, 9324637.5, 9326273.4375, 9326434.375, 9326931.25, 9327328.125, 9327414.0625, 9327846.875, 9327968.75, 9328142.1875, 9328270.3125, 9328321.875, 9328660.9375, 9328825.0, 9328918.75, 9329060.9375, 9329432.8125, 9329732.8125, 9331014.0625, 9331415.625, 9331692.1875, 9331745.3125, 9333165.625, 9333245.3125, 9333339.0625, 9333437.5, 9333928.125, 9333959.375, 9334096.875, 9334250.0, 9334934.375, 9335101.5625, 9335318.75, 9335537.5, 9335728.125, 9335732.8125, 9336006.25, 9336260.9375, 9336440.625, 9337343.75, 9337493.75, 9337945.3125, 9339365.625, 9339478.125, 9340043.75, 9340223.4375, 9340543.75, 9340920.3125, 9341232.8125, 9341473.4375, 9342200.0, 9342518.75, 9342973.4375, 9343635.9375, 9343701.5625, 9344629.6875, 9345368.75, 9345642.1875, 9345650.0, 9345706.25, 9346053.125, 9346654.6875, 9346729.6875, 9346935.9375, 9347764.0625, 9348617.1875, 9348721.875, 9348817.1875, 9350246.875, 9350387.5, 9350698.4375, 9351012.5, 9351068.75, 9351504.6875, 9351879.6875, 9352345.3125, 9352507.8125, 9354245.3125, 9354775.0, 9354867.1875, 9355568.75, 9355756.25, 9355984.375, 9356012.5, 9356250.0, 9356428.125, 9356617.1875, 9357548.4375, 9359996.875, 9360189.0625, 9360259.375, 9361218.75, 9361732.8125, 9371170.3125, 9371745.3125, 9372304.6875, 9373350.0, 9376279.6875, 9379448.4375, 9387385.9375, 9389678.125, 9389681.25, 9389901.5625, 9390585.9375], [25.84719655312814, 19.950215922338863, 40.6684310363489, 21.221751131814393, 17.448928357645595, 16.941884812611217, 24.894072236157776, 113.99029385739553, 102.10678344881642, 42.20495631538471, 5.181036067061646, 11.776060498010839, 83.61527223508128, 45.27290470910006, 16.124462569359743, 185.10358061895482, 25.469735189657303, 8.625276072701825, 35.9266386471182, 62.00606617517457, 123.65154845635513, 178.72988137280728, 11.61872863252002, 12.499343048628146, 121.66933907252391, 31.19228135647156, 32.77344002788323, 9.884757465978442, 22.642258696050046, 107.13922085960004, 14.142577706971553, 20.186133842884924, 35.44116707975643, 30.507339299117746, 20.201762895865695, 14.728247915703452, 171.3108235406716, 49.41471136114882, 29.647467910366064, 26.426368517643066, 41.738410811342675, 14.449689162221048, 6.3981386343076325, 15.722583585042148, 45.53515646602532, 48.13014247895244, 8.82853053432161, 18.104364995154405, 63.499092427041994, 13.230301891591317, 14.730390027119766, 29.83056835318274, 27.861650839810995, 92.5162388790145, 20.94587843354077, 212.22600347374672, 7.588281741839941, 127.73387445002318, 22.139933979863237, 25.016356925211838, 26.652582652792503, 34.99947970762929, 31.73468694667585, 25.509053362926025, 10.348044152552253, 143.7682584312618, 8.913291381279372, 246.92209690710573, 62.068258007667254, 45.380119548110414, 128.53898863853698, 31.251624350049, 63.23066361576056, 14.325237156679474, 14.299866975795581, 78.10192950020401, 9.829550920211977, 32.850905671153804, 86.28841318594213, 78.10317992681829, 113.593965830088, 38.06068812239209, 6.188842777491548, 24.456827598862834, 123.44707809175932, 112.1465027086069, 89.1464723553814, 135.62709377015796, 76.66495434960375, 18.87490461864944, 38.8419621831549, 14.568408920729183, 105.33572913489625, 61.29496411793497, 11.454372105357649, 31.450035692797478, 62.18038626226722, 48.829136224805616, 264.78476992427056, 28.228141384977054, 19.365336344748197, 62.47320196283348, 76.1247095731443, 5.040846108762472, 34.37034309477079, 66.30530142718817, 31.635514921815087, 86.72672419671738, 41.14856803373344, 59.995654149039375, 25.63093661641715, 18.575134068589215, 23.180915684852856, 95.92521045766219, 14.91940542390592, 33.45764435015893, 249.65095454381049, 57.551037055090646, 19.55013681962363, 34.07244248314405, 79.55101209714978, 45.03391696541681, 20.364646828590356, 24.278587586546365, 69.33562339382175, 40.530934514544796, 22.392871665356168, 41.740509827822045, 30.871237874987447, 18.982893729576556, 17.657100034219724, 21.718565868835377, 8.02462762406903, 38.573442657385485, 19.449582329856668, 55.65985892286129, 36.09042163403225, 61.51946160212269, 19.63001301624473, 26.259315330448636, 26.552536642471857, 34.83300130996247, 18.868661934192986, 5.420286265564564, 55.444746532226304, 9.740560921640279, 74.60557140153799, 5.141416775166258, 18.57285620674824, 5.78767478403112, 9.688962200714762, 70.40653854287241, 45.47773964124998, 69.32390590585135, 38.615656184886916, 5.33055580989109, 17.570826541052455, 48.85437417188607, 15.606539888314021, 5.616591715810312, 76.81159621314835, 95.84351349096504, 62.56512480799759, 35.422713351660015, 131.81752009897963, 8.156874635824908, 18.639235544594623, 11.28697469093522, 13.640261586008519, 38.711129692819554, 14.885473391466062, 12.49230369556959, 62.074360937788626, 14.866410559767846, 8.198198761518539, 5.403480442399335, 15.72987824413751, 39.3883772118952, 193.5169403746244, 75.50424709525923, 97.14445513181829, 6.145759083297389, 34.27223023249812, 65.96375901733268, 68.42984266366811, 18.33332504664663, 119.49076117408767, 5.111721521780926, 7.065080217452233, 12.493062390141889, 8.977155353530588, 7.211560202604766, 21.54522528988402, 32.97599652081089, 6.075419243910942, 78.44391492712083, 12.715870755423216, 47.24032178995697, 33.559662124581564, 30.849351491365375, 71.22849584480943, 54.184001790812935, 24.028532837156998, 22.27150139544348, 15.358690499529356, 86.04588345432617, 12.504760413120266, 45.040267750566606, 24.134975007537392, 33.94118822799506, 52.98676832588629, 8.519445301145282, 55.68519117031635, 93.24933178184085, 30.58077190606862, 5.865398287929361, 12.113847755125589, 12.33092878969046, 24.10006589326929, 8.325239270221134, 85.36863024505763, 37.48094588457354, 17.123513249264807, 19.310472863483824, 80.56839524415346, 55.312652887576284, 23.81168323386899, 45.218468371397165, 6.503217309255719, 81.96193443763099, 14.261717606035244, 13.610464923151772, 20.466772060071065, 8.630358249074622, 9.27664967633824, 8.017639054690164, 9.379519348607975, 32.577734008302095, 12.866075909651535, 9.15417214005155, 89.38951774151107, 6.5168707369093175, 76.85850551786709, 5.131594935106798, 51.651371677219004, 20.73986738271627, 29.085046031046428, 16.092180959908823, 6.966655248526111, 26.62462334355432, 21.447556766932, 8.584460758012275, 8.245999924577138, 21.36943417055882, 30.517617779304352, 6.0085951326850475, 47.97361779963042, 48.06407847222705, 26.768887941996518, 9.790216915890813, 78.7762842910874, 21.090904338705293, 6.482749898963597, 9.203884631154823, 8.793859439051815, 55.213409494640565, 9.182994598741873, 95.81055071583589])
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);
([4975517.1875, 5538985.9375, 5868509.375, 5989235.9375, 5998567.1875, 6048039.0625, 6125868.75, 6177615.625, 6180579.6875, 6180585.9375, 6180673.4375, 6189184.375, 6246660.9375, 6292414.0625, 6357865.625, 6411896.875, 6459968.75, 6530726.5625, 6531326.5625, 6562910.9375, 6567898.4375, 6579478.125, 6579489.0625, 6584587.5, 6624571.875, 6721454.6875, 6731523.4375, 6749887.5, 6763726.5625, 6772865.625, 6773839.0625, 6776714.0625, 6776989.0625, 6777057.8125, 6778220.3125, 6867539.0625, 6893815.625, 6930190.625, 6962859.375, 6993120.3125, 6993689.0625, 6996912.5, 7027967.1875, 7045651.5625, 7062406.25, 7063042.1875, 7066300.0, 7086451.5625, 7121289.0625, 7141043.75, 7142178.125, 7165532.8125, 7168423.4375, 7184635.9375, 7184659.375, 7189259.375, 7190114.0625, 7191862.5, 7192293.75, 7193106.25, 7212032.8125, 7218154.6875, 7230906.25, 7232870.3125, 7236190.625, 7240434.375, 7249050.0, 7249468.75, 7249837.5, 7250028.125, 7255595.3125, 7274440.625, 7274545.3125, 7275440.625, 7309229.6875, 7310814.0625, 7313307.8125, 7313468.75, 7313693.75, 7314529.6875, 7314890.625, 7317381.25, 7414946.875, 7700614.0625, 7708926.5625, 7709200.0, 7735568.75, 7965271.875, 7968545.3125, 7970562.5, 8049285.9375, 8051253.125, 8263325.0, 8347753.125, 8361234.375, 8361898.4375, 8402368.75, 8471493.75, 8472750.0, 8473246.875, 8481565.625, 8482807.8125, 8483193.75, 8490667.1875, 8534084.375, 8546700.0, 8576859.375, 8592812.5, 8595153.125, 8600431.25, 8610378.125, 8695423.4375, 8717903.125, 8754657.8125, 8810448.4375, 8872057.8125, 8910245.3125, 8930732.8125, 8985303.125, 9038712.5, 9056056.25, 9150265.625, 9205842.1875, 9206595.3125, 9210360.9375, 9224882.8125, 9227021.875, 9227695.3125, 9232031.25, 9240171.875, 9291871.875, 9313584.375, 9314432.8125, 9315001.5625, 9315351.5625, 9315567.1875, 9315671.875, 9315846.875, 9316570.3125, 9316856.25, 9317123.4375, 9317173.4375, 9317401.5625, 9317585.9375, 9318176.5625, 9318651.5625, 9318821.875, 9318900.0, 9319110.9375, 9319479.6875, 9320010.9375, 9320062.5, 9320212.5, 9320309.375, 9320504.6875, 9320565.625, 9320571.875, 9320603.125, 9321207.8125, 9321239.0625, 9321454.6875, 9321664.0625, 9323007.8125, 9323714.0625, 9323745.3125, 9324637.5, 9326273.4375, 9326434.375, 9326931.25, 9327328.125, 9327414.0625, 9327846.875, 9327968.75, 9328142.1875, 9328270.3125, 9328321.875, 9328660.9375, 9328825.0, 9328918.75, 9329060.9375, 9329432.8125, 9329732.8125, 9331014.0625, 9331415.625, 9331692.1875, 9331745.3125, 9333165.625, 9333245.3125, 9333339.0625, 9333437.5, 9333928.125, 9333959.375, 9334096.875, 9334250.0, 9334934.375, 9335101.5625, 9335318.75, 9335537.5, 9335728.125, 9335732.8125, 9336006.25, 9336260.9375, 9336440.625, 9337343.75, 9337493.75, 9337945.3125, 9339365.625, 9339478.125, 9340043.75, 9340223.4375, 9340543.75, 9340920.3125, 9341232.8125, 9341473.4375, 9342200.0, 9342518.75, 9342973.4375, 9343635.9375, 9343701.5625, 9344629.6875, 9345368.75, 9345642.1875, 9345650.0, 9345706.25, 9346053.125, 9346654.6875, 9346729.6875, 9346935.9375, 9347764.0625, 9348617.1875, 9348721.875, 9348817.1875, 9350246.875, 9350387.5, 9350698.4375, 9351012.5, 9351068.75, 9351504.6875, 9351879.6875, 9352345.3125, 9352507.8125, 9354245.3125, 9354775.0, 9354867.1875, 9355568.75, 9355756.25, 9355984.375, 9356012.5, 9356250.0, 9356428.125, 9356617.1875, 9357548.4375, 9359996.875, 9360189.0625, 9360259.375, 9361218.75, 9361732.8125, 9371170.3125, 9371745.3125, 9372304.6875, 9373350.0, 9376279.6875, 9379448.4375, 9387385.9375, 9389678.125, 9389681.25, 9389901.5625, 9390585.9375], [25.84719655312814, 19.950215922338863, 40.6684310363489, 21.221751131814393, 17.448928357645595, 16.941884812611217, 24.894072236157776, 113.99029385739553, 102.10678344881642, 42.20495631538471, 5.181036067061646, 11.776060498010839, 83.61527223508128, 45.27290470910006, 16.124462569359743, 185.10358061895482, 25.469735189657303, 8.625276072701825, 35.9266386471182, 62.00606617517457, 123.65154845635513, 178.72988137280728, 11.61872863252002, 12.499343048628146, 121.66933907252391, 31.19228135647156, 32.77344002788323, 9.884757465978442, 22.642258696050046, 107.13922085960004, 14.142577706971553, 20.186133842884924, 35.44116707975643, 30.507339299117746, 20.201762895865695, 14.728247915703452, 171.3108235406716, 49.41471136114882, 29.647467910366064, 26.426368517643066, 41.738410811342675, 14.449689162221048, 6.3981386343076325, 15.722583585042148, 45.53515646602532, 48.13014247895244, 8.82853053432161, 18.104364995154405, 63.499092427041994, 13.230301891591317, 14.730390027119766, 29.83056835318274, 27.861650839810995, 92.5162388790145, 20.94587843354077, 212.22600347374672, 7.588281741839941, 127.73387445002318, 22.139933979863237, 25.016356925211838, 26.652582652792503, 34.99947970762929, 31.73468694667585, 25.509053362926025, 10.348044152552253, 143.7682584312618, 8.913291381279372, 246.92209690710573, 62.068258007667254, 45.380119548110414, 128.53898863853698, 31.251624350049, 63.23066361576056, 14.325237156679474, 14.299866975795581, 78.10192950020401, 9.829550920211977, 32.850905671153804, 86.28841318594213, 78.10317992681829, 113.593965830088, 38.06068812239209, 6.188842777491548, 24.456827598862834, 123.44707809175932, 112.1465027086069, 89.1464723553814, 135.62709377015796, 76.66495434960375, 18.87490461864944, 38.8419621831549, 14.568408920729183, 105.33572913489625, 61.29496411793497, 11.454372105357649, 31.450035692797478, 62.18038626226722, 48.829136224805616, 264.78476992427056, 28.228141384977054, 19.365336344748197, 62.47320196283348, 76.1247095731443, 5.040846108762472, 34.37034309477079, 66.30530142718817, 31.635514921815087, 86.72672419671738, 41.14856803373344, 59.995654149039375, 25.63093661641715, 18.575134068589215, 23.180915684852856, 95.92521045766219, 14.91940542390592, 33.45764435015893, 249.65095454381049, 57.551037055090646, 19.55013681962363, 34.07244248314405, 79.55101209714978, 45.03391696541681, 20.364646828590356, 24.278587586546365, 69.33562339382175, 40.530934514544796, 22.392871665356168, 41.740509827822045, 30.871237874987447, 18.982893729576556, 17.657100034219724, 21.718565868835377, 8.02462762406903, 38.573442657385485, 19.449582329856668, 55.65985892286129, 36.09042163403225, 61.51946160212269, 19.63001301624473, 26.259315330448636, 26.552536642471857, 34.83300130996247, 18.868661934192986, 5.420286265564564, 55.444746532226304, 9.740560921640279, 74.60557140153799, 5.141416775166258, 18.57285620674824, 5.78767478403112, 9.688962200714762, 70.40653854287241, 45.47773964124998, 69.32390590585135, 38.615656184886916, 5.33055580989109, 17.570826541052455, 48.85437417188607, 15.606539888314021, 5.616591715810312, 76.81159621314835, 95.84351349096504, 62.56512480799759, 35.422713351660015, 131.81752009897963, 8.156874635824908, 18.639235544594623, 11.28697469093522, 13.640261586008519, 38.711129692819554, 14.885473391466062, 12.49230369556959, 62.074360937788626, 14.866410559767846, 8.198198761518539, 5.403480442399335, 15.72987824413751, 39.3883772118952, 193.5169403746244, 75.50424709525923, 97.14445513181829, 6.145759083297389, 34.27223023249812, 65.96375901733268, 68.42984266366811, 18.33332504664663, 119.49076117408767, 5.111721521780926, 7.065080217452233, 12.493062390141889, 8.977155353530588, 7.211560202604766, 21.54522528988402, 32.97599652081089, 6.075419243910942, 78.44391492712083, 12.715870755423216, 47.24032178995697, 33.559662124581564, 30.849351491365375, 71.22849584480943, 54.184001790812935, 24.028532837156998, 22.27150139544348, 15.358690499529356, 86.04588345432617, 12.504760413120266, 45.040267750566606, 24.134975007537392, 33.94118822799506, 52.98676832588629, 8.519445301145282, 55.68519117031635, 93.24933178184085, 30.58077190606862, 5.865398287929361, 12.113847755125589, 12.33092878969046, 24.10006589326929, 8.325239270221134, 85.36863024505763, 37.48094588457354, 17.123513249264807, 19.310472863483824, 80.56839524415346, 55.312652887576284, 23.81168323386899, 45.218468371397165, 6.503217309255719, 81.96193443763099, 14.261717606035244, 13.610464923151772, 20.466772060071065, 8.630358249074622, 9.27664967633824, 8.017639054690164, 9.379519348607975, 32.577734008302095, 12.866075909651535, 9.15417214005155, 89.38951774151107, 6.5168707369093175, 76.85850551786709, 5.131594935106798, 51.651371677219004, 20.73986738271627, 29.085046031046428, 16.092180959908823, 6.966655248526111, 26.62462334355432, 21.447556766932, 8.584460758012275, 8.245999924577138, 21.36943417055882, 30.517617779304352, 6.0085951326850475, 47.97361779963042, 48.06407847222705, 26.768887941996518, 9.790216915890813, 78.7762842910874, 21.090904338705293, 6.482749898963597, 9.203884631154823, 8.793859439051815, 55.213409494640565, 9.182994598741873, 95.81055071583589])
Detected energies during the discharge + Energy spectrum
multiplot(icon_fig, T_int_first,E,xle,Etot)