Frix-x / klippain-shaketune

Klipper streamlined input shaper workflow and calibration tools
GNU General Public License v3.0
670 stars 80 forks source link

Vibration graph creation - IndexError: index -1 is out of bounds for axis 0 with size 0 #63

Closed Henk72 closed 5 months ago

Henk72 commented 8 months ago

K-Shake&Tune module branch

Version

v2.5.0-7-gb42e377a

Describe the bug and expected behavior

When running vibration analysis the printer is measuring correctly, but the scripts that make a graph .png file fail with attached error. This happens on my Ender5Pro. On the Ender3v2 all is working as expected.

Could this be related to the fact that the Ender5Pro homes against the max values of the axis (corner right/back) instead of the the Ender3v2 which homes in corner front left (0,0).

Additional information and klippy.log

main() File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/is_workflow.py", line 288, in main create_vibrations_graph(axis_name=options.axis_name, accel=options.accel_used, chip_name=options.chip_name, keep_csv=options.keep_csv) File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/is_workflow.py", line 165, in create_vibrations_graph fig = vibrations_calibration(lognames, KLIPPER_FOLDER, axis_name, accel) File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/graph_vibrations.py", line 382, in vibrations_calibration motor_fr, motor_zeta, motor_max_power_index = compute_mechanical_parameters(motor_vibration_power, freqs) File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/common_func.py", line 81, in compute_mechanical_parameters idx_below = np.where(psd[:max_power_index] <= half_power)[0][-1] IndexError: index -1 is out of bounds for axis 0 with size 0

wight554 commented 8 months ago

Got exactly same error on ender 3 with K-Shaketune 2.6.0. Might be some cache issue, it was working fine until it randomly stopped working

JenPet3D commented 7 months ago

Getting also this error message.

Frix-x commented 7 months ago

I'm not sure about the origin of this error message since it should be an impossible case... Can you share the CSV file that produce this error?

hemasi3d commented 7 months ago

Hi,

I have the same problem,

printer.cfg [stepper_x] ... position_endstop:260 ... [stepper_y] ... position_endstop: 150 ...

Klippain-version: v2.6.0-2-g312a9c9f Klipper-version: v0.12.0-115-gb98375b3

vibr_20240303_175423-sp20_00n1.csv

hrvat94 commented 7 months ago

Have a similar Problem:

Traceback (most recent call last): File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/is_workflow.py", line 303, in

main()

File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/is_workflow.py", line 289, in main

axis = create_shaper_graph(keep_csv=options.keep_csv, max_smoothing=options.max_smoothing, scv=options.scv)

File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/is_workflow.py", line 123, in create_shaper_graph

fig = shaper_calibration([new_file], KLIPPER_FOLDER, max_smoothing=max_smoothing, scv=scv)

File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 217, in shaper_calibration

performance_shaper, shapers, calibration_data, fr, zeta = calibrate_shaper(datas[0], max_smoothing, scv, max_freq)

File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 54, in calibrate_shaper

shaper, all_shapers = helper.find_best_shaper(

TypeError: find_best_shaper() got an unexpected keyword argument 'shapers'

Command {shaketune} finished

Henk72 commented 7 months ago

I'm not sure about the origin of this error message since it should be an impossible case... Can you share the CSV file that produce this error?

I retested today with the latest version. I got next error again

"motor_fr, motor_zeta, motor_max_power_index = compute_mechanical_parameters(motor_vibration_power, freqs) File "/home/pi/Ender5Pro_data/config/K-ShakeTuneJos/scripts/common_func.py", line 81, in compute_mechanical_parameters"

"idx_below = np.where(psd[:max_power_index] <= half_power)[0][-1] IndexError: index -1 is out of bounds for axis 0 with size 0"

I have attached the most recent .csv file from all the generated ones.

vibr_20240309_173411-sp200_00n1.csv

Frix-x commented 7 months ago

@hrvat94 your issue is different and it's because you have updated Shake&Tune to v2.6 and will need to also update Klipper to a more recent version. This will fix your issue. I hid your comment to keep the topic on the current issue.

@Henk72 and @hemasi3d can you give me the full set of CSV files in a zip archive ?

Henk72 commented 7 months ago

Dear Frix-x,

This is my full set of CSV files zipped. The problem happens on the Y-axis of the Ender5Pro. No issues on my Ender3v2. vibrations.zip

Frix-x commented 5 months ago

Hello, this was fixed in v3 and should not happen anymore :)