Skip to content

Commit

Permalink
added logging for filename in case of an unexpected error
Browse files Browse the repository at this point in the history
  • Loading branch information
Félix Boisselier committed Oct 26, 2023
1 parent 33ce0ad commit 6742a78
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
10 changes: 7 additions & 3 deletions K-ShakeTune/scripts/graph_belts.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,15 @@ def belts_calibration(lognames, klipperdir="~/klipper", max_freq=200.):
ax2 = fig.add_subplot(gs[1])

# Add title
filename = lognames[0].split('/')[-1]
dt = datetime.strptime(f"{filename.split('_')[1]} {filename.split('_')[2]}", "%Y%m%d %H%M%S")
title_line1 = "RELATIVE BELT CALIBRATION TOOL"
title_line2 = dt.strftime('%x %X')
fig.text(0.12, 0.965, title_line1, ha='left', va='bottom', fontsize=20, color=KLIPPAIN_COLORS['purple'], weight='bold')
try:
filename = lognames[0].split('/')[-1]
dt = datetime.strptime(f"{filename.split('_')[1]} {filename.split('_')[2]}", "%Y%m%d %H%M%S")
title_line2 = dt.strftime('%x %X')
except:
print("Warning: CSV filenames look to be different than expected (%s , %s)" % (lognames[0], lognames[1]))
title_line2 = lognames[0].split('/')[-1] + " / " + lognames[1].split('/')[-1]
fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple'])

# Plot the graphs
Expand Down
10 changes: 7 additions & 3 deletions K-ShakeTune/scripts/graph_shaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,15 @@ def shaper_calibration(lognames, klipperdir="~/klipper", max_smoothing=None, max
ax2 = fig.add_subplot(gs[1])

# Add title
filename_parts = (lognames[0].split('/')[-1]).split('_')
dt = datetime.strptime(f"{filename_parts[3]} {filename_parts[4].split('.')[0]}", "%Y%m%d %H%M%S")
title_line1 = "INPUT SHAPER CALIBRATION TOOL"
title_line2 = dt.strftime('%x %X') + ' -- ' + filename_parts[2].upper() + ' axis'
fig.text(0.12, 0.965, title_line1, ha='left', va='bottom', fontsize=20, color=KLIPPAIN_COLORS['purple'], weight='bold')
try:
filename_parts = (lognames[0].split('/')[-1]).split('_')
dt = datetime.strptime(f"{filename_parts[3]} {filename_parts[4].split('.')[0]}", "%Y%m%d %H%M%S")
title_line2 = dt.strftime('%x %X') + ' -- ' + filename_parts[2].upper() + ' axis'
except:
print("Warning: CSV filename look to be different than expected (%s)" % (lognames[0]))
title_line2 = lognames[0].split('/')[-1]
fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple'])

# Plot the graphs
Expand Down
10 changes: 7 additions & 3 deletions K-ShakeTune/scripts/graph_vibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,15 @@ def vibrations_calibration(lognames, klipperdir="~/klipper", axisname=None, max_
ax1 = fig.add_subplot(gs[0])
ax2 = fig.add_subplot(gs[1])

filename_parts = (lognames[0].split('/')[-1]).split('_')
dt = datetime.strptime(f"{filename_parts[1]} {filename_parts[2].split('-')[0]}", "%Y%m%d %H%M%S")
title_line1 = "VIBRATIONS MEASUREMENT TOOL"
title_line2 = dt.strftime('%x %X') + ' -- ' + axisname.upper() + ' axis'
fig.text(0.12, 0.965, title_line1, ha='left', va='bottom', fontsize=20, color=KLIPPAIN_COLORS['purple'], weight='bold')
try:
filename_parts = (lognames[0].split('/')[-1]).split('_')
dt = datetime.strptime(f"{filename_parts[1]} {filename_parts[2].split('-')[0]}", "%Y%m%d %H%M%S")
title_line2 = dt.strftime('%x %X') + ' -- ' + axisname.upper() + ' axis'
except:
print("Warning: CSV filename look to be different than expected (%s)" % (lognames[0]))
title_line2 = lognames[0].split('/')[-1]
fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple'])

# Remove speeds duplicates and graph the processed datas
Expand Down

0 comments on commit 6742a78

Please sign in to comment.