From 94109bb1573d210f4aae0146dd74f73f6b5470b3 Mon Sep 17 00:00:00 2001 From: alexmadison Date: Mon, 28 Feb 2022 15:44:24 +0100 Subject: [PATCH] plotting in ex bugs --- test/prsim_plot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/prsim_plot.py b/test/prsim_plot.py index dad63e3..3064344 100755 --- a/test/prsim_plot.py +++ b/test/prsim_plot.py @@ -117,6 +117,7 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") ''' Since times are random, need to convert them to an index. ''' + if not (int(time) in unique_times): return None out = np.argwhere(unique_times == int(time)) return out[0][0] @@ -125,6 +126,7 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") Handles signal name ordering. Assume ordered like unique_sigs for now ''' + if not (sig in unique_sigs): return None out = np.argwhere(unique_sigs == sig) return out[0][0] @@ -205,14 +207,18 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") for a in asserts: print(a) time = int(a[0]) + if not time in unique_times: + time = unique_times[np.argwhere((unique_times-time) < 0)[-1]] 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") # Find echoed statements of the form "[digits] text" - echoes = re.findall(r"\t *(\d+) [^\t]*\n(\[\d+\].+)", f) + echoes = re.findall(r"\t *(\d+) [^\t]*\n(\[\d*\].+)", f) for a in echoes: time = int(a[0]) + if not time in unique_times: + time = unique_times[np.argwhere((unique_times-time) < 0)[-1]] index = time_to_index(time) c = "xkcd:bright purple" ax.axvline(index+0.5, c = c, lw = 2)