added times and alternative colours

This commit is contained in:
alexmadison 2022-02-28 10:21:43 +01:00
parent be33d19762
commit 9e4f090af2
1 changed files with 21 additions and 5 deletions

View File

@ -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) entries = re.findall(r"\t *(\d+) ([^:]+) : (\d)( \[by.+\])?[\n\r]", f)
assert len(entries) >= 1, "Could not find signal info in prsim.out!" 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 # Check if user gave an include filter
include_given = False include_given = False
include_re = None include_re = None
@ -104,11 +119,9 @@ Use -exclude='regex' to specify signals to exclude (or -ex).""")
# Plot # Plot
colour_undefined = (255,0,0) # Generate figure
colour_high = (252, 186, 3) # weird sizing is to try to keep "pixel" sizes approx const
colour_low = (20, 184, 186) fig = plt.figure(figsize = (num_sigs/3+0.5,num_times/3+0.2), dpi = 100)
fig = plt.figure(figsize = (num_sigs/3+4,num_times/3+4), dpi = 100)
image = np.zeros((num_sigs, num_times, 3), dtype = int) image = np.zeros((num_sigs, num_times, 3), dtype = int)
image[signals_matrix == 0] = colour_undefined 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.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) 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" output_type = ".pdf"
for arg in argv: for arg in argv: