diff --git a/test/prsim_plot.py b/test/prsim_plot.py index bc412c9..6e57e4d 100755 --- a/test/prsim_plot.py +++ b/test/prsim_plot.py @@ -30,6 +30,21 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") entries = re.findall(r"\t *(\d+) ([^:]+) : (\d)( \[by.+\])?[\n\r]", f) assert len(entries) >= 1, "Could not find signal info in prsim.out!" + # Check if user gave a colour specification + colour_undefined = (255,0,0) + colour_high = (252, 186, 3) + colour_low = (20, 184, 186) + for arg in argv: + r = re.findall(r'-c=(.+)', arg) + if len(r) >= 1: + if r[0] == "michele": + colour_undefined = (100,100,100) + colour_high = (105, 204, 86) + colour_low = (209, 86, 48) + else: + raise Exception("Unknown colour given. I cba to code up general colours atm.") + + # Check if user gave an include filter include_given = False include_re = None @@ -104,11 +119,9 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") # Plot - colour_undefined = (255,0,0) - colour_high = (252, 186, 3) - colour_low = (20, 184, 186) - - fig = plt.figure(figsize = (num_sigs/3+4,num_times/3+4), dpi = 100) + # Generate figure + # weird sizing is to try to keep "pixel" sizes approx const + fig = plt.figure(figsize = (num_sigs/3+0.5,num_times/3+0.2), dpi = 100) image = np.zeros((num_sigs, num_times, 3), dtype = int) image[signals_matrix == 0] = colour_undefined @@ -159,6 +172,9 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""") plt.arrow(t0, s1, 0, s0-s1 + 0.2*np.sign(s0-s1), head_width = 0, width = 0.2, ec = "none", lw = 0, fc = "black", length_includes_head = True) plt.scatter((t0),(s0), c = "black", s = 30) + # Write times on x axis + for time in unique_times: + ax.text(time_to_index(time), num_sigs, time, ha = "center", va = "top", size = 10, rotation = 90) output_type = ".pdf" for arg in argv: