2 Commits

Author SHA1 Message Date
Félix Boisselier
c39f0fe781 bugfixes 2023-10-26 18:18:18 +02:00
Félix Boisselier
6742a785d3 added logging for filename in case of an unexpected error 2023-10-26 13:56:15 +02:00
4 changed files with 27 additions and 11 deletions

View File

@@ -570,11 +570,15 @@ def belts_calibration(lognames, klipperdir="~/klipper", max_freq=200.):
ax2 = fig.add_subplot(gs[1]) ax2 = fig.add_subplot(gs[1])
# Add title # 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_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') 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']) fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple'])
# Plot the graphs # Plot the graphs

View File

@@ -311,11 +311,15 @@ def shaper_calibration(lognames, klipperdir="~/klipper", max_smoothing=None, max
ax2 = fig.add_subplot(gs[1]) ax2 = fig.add_subplot(gs[1])
# Add title # 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_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') 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]}", "%Y%m%d %H%M%S")
title_line2 = dt.strftime('%x %X') + ' -- ' + filename_parts[3].upper().split('.')[0] + ' 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']) fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple'])
# Plot the graphs # Plot the graphs

View File

@@ -348,7 +348,7 @@ def setup_klipper_import(kdir):
shaper_calibrate = importlib.import_module('.shaper_calibrate', 'extras') shaper_calibrate = importlib.import_module('.shaper_calibrate', 'extras')
def vibrations_calibration(lognames, klipperdir="~/klipper", axisname=None, max_freq=200., remove=0): def vibrations_calibration(lognames, klipperdir="~/klipper", axisname=None, max_freq=1000., remove=0):
setup_klipper_import(klipperdir) setup_klipper_import(klipperdir)
# Parse the raw data and get them ready for analysis # Parse the raw data and get them ready for analysis
@@ -368,11 +368,15 @@ def vibrations_calibration(lognames, klipperdir="~/klipper", axisname=None, max_
ax1 = fig.add_subplot(gs[0]) ax1 = fig.add_subplot(gs[0])
ax2 = fig.add_subplot(gs[1]) 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_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') 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']) 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 # Remove speeds duplicates and graph the processed datas

View File

@@ -39,12 +39,16 @@ For those not using the full [Klippain](https://github.com/Frix-x/klippain), fol
managed_services: klipper managed_services: klipper
install_script: install.sh install_script: install.sh
``` ```
> **Note**:
>
> If already using my old IS workflow scripts, please remove everything before installing this new module. This include the macros, the Python scripts, the `plot_graph.sh` and the `[gcode_shell_command plot_graph]` section.
## Usage ## Usage
Ensure your machine is homed, then invoke one of the following macros as needed: Ensure your machine is homed, then invoke one of the following macros as needed:
- `BELTS_SHAPER_CALIBRATION` for belt resonance graphs, useful for verifying belt tension and differential belt paths behavior. - `BELTS_SHAPER_CALIBRATION` for belt resonance graphs, useful for verifying belt tension and differential belt paths behavior.
- `AXES_SHAPER_CALIBRATION` for input shaper graphs to mitigate ringing/ghosting by tuning Klipper's `[input_shaper]` system. - `AXES_SHAPER_CALIBRATION` for input shaper graphs to mitigate ringing/ghosting by tuning Klipper's input shaper system.
- `VIBRATIONS_CALIBRATION` for machine vibration graphs to optimize your slicer speed profiles. - `VIBRATIONS_CALIBRATION` for machine vibration graphs to optimize your slicer speed profiles.
- `EXCITATE_AXIS_AT_FREQ` to sustain a specific excitation frequency, useful to let you inspect and find out what is resonating. - `EXCITATE_AXIS_AT_FREQ` to sustain a specific excitation frequency, useful to let you inspect and find out what is resonating.