From 05f46ccf33aec92f08d162ac5680590937a988a6 Mon Sep 17 00:00:00 2001 From: alexmadison Date: Tue, 1 Mar 2022 13:55:45 +0100 Subject: [PATCH] added try except for assert printing --- test/prsim_plot.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/prsim_plot.py b/test/prsim_plot.py index 0cad3e5..6b1b4a0 100755 --- a/test/prsim_plot.py +++ b/test/prsim_plot.py @@ -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)