Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Plotter.py #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions Pipeline/FromCanUtilsLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@ def canUtilsToTSV(filename):
outFileName = filename + ".tsv"
with open(outFileName, "w") as outFile:
with open(filename, "r") as file:
linePattern = re.compile(r"\((\d+.\d+)\)\s+[^\s]+\s+([0-9A-F#]{3}|[0-9A-F#]{8})#([0-9A-F]+)")

try:
linePattern = re.compile(r"\((\d+.\d+)\)\s+[^\s]+\s+([0-9A-F#]{3}|[0-9A-F#]{8})#([0-9A-F]+)")
except:
pass
while True:
line = file.readline()
if not line:
return outFileName
tokens = linePattern.search(line).groups()
try:
tokens = linePattern.search(line).groups()

# write delta time
writeLine = tokens[0]
# write delta time
writeLine = tokens[0]

# write arb id
writeLine += '\t' + tokens[1]
# write arb id
writeLine += '\t' + tokens[1]

# write dlc
bytes = int(len(tokens[2]) / 2)
writeLine += '\t' + str(bytes)
# write dlc
bytes = int(len(tokens[2]) / 2)
writeLine += '\t' + str(bytes)

# write bytes
for b in range(bytes):
writeLine += '\t' + tokens[2][b*2:b*2+2]
# write bytes
for b in range(bytes):
writeLine += '\t' + tokens[2][b*2:b*2+2]

outFile.write(writeLine + '\n')
outFile.write(writeLine + '\n')
except:
pass
2 changes: 1 addition & 1 deletion Pipeline/Plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def plot_signals_by_arb_id(a_timer: PipelineTimer, arb_id_dict: dict, signal_dic

# If you want transparent backgrounds, a different file format, etc. then change these settings accordingly.
savefig(hex(arb_id.id) + "." + figure_format,
bbox_iches='tight',
bbox_inches='tight',
pad_inches=0.0,
dpi=figure_dpi,
format=figure_format,
Expand Down