Skip to content
Snippets Groups Projects

Add acoustics monitoring

Merged Carlo Guidi requested to merge cguidi/km3mon:undefined into master
Compare and Show latest version
1 file
+ 42
63
Compare changes
  • Side-by-side
  • Inline
+ 42
63
@@ -54,7 +54,7 @@ TIT = 600 # Time Interval between Trains of acoustic pulses)
SSW = 160 # Signal Security Window (Window size with signal)
check = True
while check == True:
while check:
minrun = table["RUN"][len(table["RUN"]) - 1]
ind, = np.where((table["RUN"] == minrun))
@@ -62,7 +62,7 @@ while check == True:
mintime = mintime1.values
maxrun = table["RUN"][len(table["RUN"]) - 1]
now = time.time()
if (now-mintime/1000) < TIT:
if (now - mintime/1000) < TIT:
minrun = table["RUN"][len(table["RUN"]) - 1] - 1
print(now)
@@ -160,8 +160,7 @@ while check == True:
N_Pulses_Indicator_DU.append(-1.5)
except:
stop = []
except (TypeError, ValueError): # TypeError if no data found for a certain piezo, ValueError if there are zero data for a certain piezo
N_Pulses_Indicator_DU.append(-1.5)
N_Pulses_Indicator.append(N_Pulses_Indicator_DU)
@@ -172,23 +171,24 @@ while check == True:
fig = plt.figure()
ax = fig.add_subplot(111)
dom = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13, 14, 15, 16, 17, 18]
l = len(dom)
du1AB1 = 0.9*np.ones(l)
du1AB2 = 1*np.ones(l)
du1AB3 = 1.1*np.ones(l)
du2AB1 = 1.9*np.ones(l)
du2AB2 = 2*np.ones(l)
du2AB3 = 2.1*np.ones(l)
du3AB1 = 2.9*np.ones(l)
du3AB2 = 3*np.ones(l)
du3AB3 = 3.1*np.ones(l)
du4AB1 = 3.9*np.ones(l)
du4AB2 = 4*np.ones(l)
du4AB3 = 4.1*np.ones(l)
du5AB1 = 4.9*np.ones(l)
du5AB2 = 5*np.ones(l)
du5AB3 = 5.1*np.ones(l)
N_doms = 18
doms = range(N_doms + 1)
L = len(doms)
du1AB1 = 0.9*np.ones(L)
du1AB2 = 1*np.ones(L)
du1AB3 = 1.1*np.ones(L)
du2AB1 = 1.9*np.ones(L)
du2AB2 = 2*np.ones(L)
du2AB3 = 2.1*np.ones(L)
du3AB1 = 2.9*np.ones(L)
du3AB2 = 3*np.ones(L)
du3AB3 = 3.1*np.ones(L)
du4AB1 = 3.9*np.ones(L)
du4AB2 = 4*np.ones(L)
du4AB3 = 4.1*np.ones(L)
du5AB1 = 4.9*np.ones(L)
du5AB2 = 5*np.ones(L)
du5AB3 = 5.1*np.ones(L)
@@ -199,31 +199,31 @@ while check == True:
DU5 = np.array(N_Pulses_Indicator[4])
ind = np.where(DU2 < 1000)
iAB1 = np.where(ind[0] < l)
iAB2_up = np.where(ind[0] > (l - 1))
iAB2_down = np.where(ind[0] < 2*l)
iAB1 = np.where(ind[0] < L)
iAB2_up = np.where(ind[0] > (L - 1))
iAB2_down = np.where(ind[0] < 2*L)
iAB2 = np.intersect1d(iAB2_up, iAB2_down)
iAB3 = np.where(ind[0] > (2*l - 1))
iAB3 = np.where(ind[0] > (2*L - 1))
colorsList = [(0, 0, 0),(1, 0.3, 0),(1, 1, 0),(0.2, 0.9, 0)]
CustomCmap = matplotlib.colors.ListedColormap(colorsList)
bounds=[-2, -1, 0, 1, 2]
norma = colors.BoundaryNorm(bounds, CustomCmap.N)
color = ax.scatter(du1AB1, dom, s = 20, c = DU1[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du1AB2, dom, s = 20, c = DU1[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du1AB3, dom, s = 20, c = DU1[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du2AB1, dom, s = 20, c = DU2[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du2AB2, dom, s = 20, c = DU2[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du2AB3, dom, s = 20, c = DU2[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du3AB1, dom, s = 20, c = DU3[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du3AB2, dom, s = 20, c = DU3[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du3AB3, dom, s = 20, c = DU3[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du4AB1, dom, s = 20, c = DU4[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du4AB2, dom, s = 20, c = DU4[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du4AB3, dom, s = 20, c = DU4[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du5AB1, dom, s = 20, c = DU5[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du5AB2, dom, s = 20, c = DU5[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du5AB3, dom, s = 20, c = DU5[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du1AB1, doms, s = 20, c = DU1[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du1AB2, doms, s = 20, c = DU1[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du1AB3, doms, s = 20, c = DU1[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du2AB1, doms, s = 20, c = DU2[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du2AB2, doms, s = 20, c = DU2[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du2AB3, doms, s = 20, c = DU2[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du3AB1, doms, s = 20, c = DU3[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du3AB2, doms, s = 20, c = DU3[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du3AB3, doms, s = 20, c = DU3[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du4AB1, doms, s = 20, c = DU4[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du4AB2, doms, s = 20, c = DU4[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du4AB3, doms, s = 20, c = DU4[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du5AB1, doms, s = 20, c = DU5[iAB1], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du5AB2, doms, s = 20, c = DU5[iAB2], norm=norma, marker = 's', cmap = CustomCmap);
color = ax.scatter(du5AB3, doms, s = 20, c = DU5[iAB3], norm=norma, marker = 's', cmap = CustomCmap);
cbar = plt.colorbar(color)
@@ -252,32 +252,11 @@ while check == True:
print(time.time())
check=False
check = False
check_time=time.time() - now
print(check_time)
time.sleep(abs(TIT - check_time))
check=True
check = True
Loading