added try except for assert printing

This commit is contained in:
alexmadison 2022-03-01 13:55:45 +01:00
parent fc4ccea3c0
commit 05f46ccf33
1 changed files with 9 additions and 3 deletions

View File

@ -64,7 +64,7 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""")
for arg in argv:
r = re.findall(r'-t1=(\d+)', arg)
if len(r) >= 1:
print(f"Filtering by start time t0 = {r[0]}")
print(f"Filtering by end time t1 = {r[0]}")
entries = [e for e in entries if int(e[0]) <= int(r[0])]
@ -222,7 +222,10 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""")
print(a)
time = int(a[0])
if not time in unique_times:
time = unique_times[np.argwhere((unique_times-time) < 0)[-1]]
try:
time = unique_times[np.argwhere((unique_times-time) < 0)[-1]]
except:
print(f"Couldn't find an appropriate time for assert {a}")
index = time_to_index(time)
ax.axvline(index+0.5, c = "red", lw = 2)
ax.text(index+0.5, -1, a[1], rotation = 90, ha = "center", va = "bottom", c = "red")
@ -232,7 +235,10 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""")
for a in echoes:
time = int(a[0])
if not time in unique_times:
time = unique_times[np.argwhere((unique_times-time) < 0)[-1]]
try:
time = unique_times[np.argwhere((unique_times-time) < 0)[-1]]
except:
print(f"Couldn't find an appropriate time for echo {a}")
index = time_to_index(time)
c = "xkcd:bright purple"
ax.axvline(index+0.5, c = c, lw = 2)