improve ultrasound plot clients
- make plot window not to raise to the front on replot - chmod +x
This commit is contained in:
14
bin/peus-plot
Normal file → Executable file
14
bin/peus-plot
Normal file → Executable file
@ -1,19 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from pathlib import Path
|
||||
# Add import path for inplace usage
|
||||
sys.path.insert(0, str(Path(__file__).absolute().parents[1]))
|
||||
|
||||
from frappy.client.interactive import Client
|
||||
from frappy_psi.iqplot import Plot
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage: python peusplot.py <maxY>')
|
||||
print('Usage: peus-plot <maxY>')
|
||||
|
||||
|
||||
def get_modules(name):
|
||||
return list(filter(None, (globals().get(name % i) for i in range(10))))
|
||||
|
||||
|
||||
secnode = Client('localhost:5000')
|
||||
secnode = Client('pc13252:5000')
|
||||
time_size = {'time', 'size'}
|
||||
int_mods = [u] + get_modules('roi%d')
|
||||
t_rois = get_modules('roi%d')
|
||||
@ -35,12 +40,11 @@ try:
|
||||
while True:
|
||||
curves = np.array(u.get_curves())
|
||||
iqplot.plot(curves,
|
||||
rois=[(r.time, r.time + r.size) for r in int_mods],
|
||||
rois=[(r.time - r.size * 0.5, r.time + r.size * 0.5) for r in int_mods],
|
||||
average=([r.time for r in t_rois],
|
||||
[r.value for r in i_rois],
|
||||
[r.value for r in q_rois]))
|
||||
plt.pause(0.5)
|
||||
if iqplot.fig is None: # graph window closed
|
||||
if not iqplot.pause(0.5):
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
iqplot.close()
|
||||
|
10
bin/us-plot
Normal file → Executable file
10
bin/us-plot
Normal file → Executable file
@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from pathlib import Path
|
||||
# Add import path for inplace usage
|
||||
sys.path.insert(0, str(Path(__file__).absolute().parents[1]))
|
||||
|
||||
from frappy.client.interactive import Client
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from frappy.iqplot import Pause
|
||||
|
||||
Client('pc13252:5000')
|
||||
|
||||
@ -40,7 +45,7 @@ else:
|
||||
npoints = float(sys.argv[3])
|
||||
|
||||
fig, ax = plt.subplots(figsize=(15,3))
|
||||
fig.canvas.mpl_connect('close_event', on_close)
|
||||
pause = Pause(fig)
|
||||
try:
|
||||
get_signal = iq.get_signal
|
||||
print('plotting RUS signal')
|
||||
@ -52,8 +57,7 @@ else:
|
||||
|
||||
lines = [plot(s, ax, '-', xs) for s in signal]
|
||||
|
||||
while True:
|
||||
plt.pause(0.5)
|
||||
while pause(0.5):
|
||||
plt.draw()
|
||||
xs, signal = get_signal(start, end, npoints)
|
||||
for line, sig in zip(lines, signal):
|
||||
|
Reference in New Issue
Block a user