bin/us-plot: fix usage message

This commit is contained in:
Ultrasound PC 2025-03-26 17:02:35 +01:00
parent d9f340dce6
commit 8c548da2e0

View File

@ -7,7 +7,20 @@ 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
from frappy_psi.iqplot import Pause
if len(sys.argv) < 2:
print("""
Usage:
us-plot <end> [<start> [<npoints>]]
end: end of window [ns]
start: start of window [n2], default: 0
npoints: number fo points (default 1000)
""")
sys.exit(0)
Client('pc13252:5000')
@ -24,41 +37,29 @@ def update(array, line, xs):
def on_close(event):
sys.exit(0)
# inp_signal.read()
# out_signal.read()
start = 0
end = float(sys.argv[1])
npoints = 1000
if len(sys.argv) > 2:
start = float(sys.argv[2])
if len(sys.argv) > 3:
npoints = float(sys.argv[3])
if len(sys.argv) < 2:
print("""
Usage: python3 sig.py <end> [<start> [<npoints>]]
fig, ax = plt.subplots(figsize=(15,3))
pause = Pause(fig)
try:
get_signal = iq.get_signal
print('plotting RUS signal')
except NameError:
get_signal = u.get_signal
print('plotting PE signal')
end: end of window [ns]
start: start of window [n2], default: 0
npoints: number fo points (default 1000)
""")
else:
start = 0
end = float(sys.argv[1])
npoints = 1000
if len(sys.argv) > 2:
start = float(sys.argv[2])
if len(sys.argv) > 3:
npoints = float(sys.argv[3])
xs, signal = get_signal(start, end, npoints)
fig, ax = plt.subplots(figsize=(15,3))
pause = Pause(fig)
try:
get_signal = iq.get_signal
print('plotting RUS signal')
except NameError:
get_signal = u.get_signal
print('plotting PE signal')
lines = [plot(s, ax, '-', xs) for s in signal]
while pause(0.5):
plt.draw()
xs, signal = get_signal(start, end, npoints)
lines = [plot(s, ax, '-', xs) for s in signal]
while pause(0.5):
plt.draw()
xs, signal = get_signal(start, end, npoints)
for line, sig in zip(lines, signal):
update(sig, line, xs)
for line, sig in zip(lines, signal):
update(sig, line, xs)