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()
|
||||
|
Reference in New Issue
Block a user