aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/graph_accelerometer.py
diff options
context:
space:
mode:
authorDmitry Butyugin <dmbutyugin@google.com>2021-10-22 20:46:20 +0200
committerKevinOConnor <kevin@koconnor.net>2021-10-26 16:14:50 -0400
commitd5a7a7f00fc9b171cdd485fb26987f4aa6eb0f6b (patch)
tree81165140f392e30eed540fafd1d010d7b8b48036 /scripts/graph_accelerometer.py
parent6c395fd0165d9b73de4ea50dc5b88ddf9bc218c7 (diff)
downloadkutter-d5a7a7f00fc9b171cdd485fb26987f4aa6eb0f6b.tar.gz
kutter-d5a7a7f00fc9b171cdd485fb26987f4aa6eb0f6b.tar.xz
kutter-d5a7a7f00fc9b171cdd485fb26987f4aa6eb0f6b.zip
input_shaper: Define input shapers in a single place in Python code
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Diffstat (limited to 'scripts/graph_accelerometer.py')
-rwxr-xr-xscripts/graph_accelerometer.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/graph_accelerometer.py b/scripts/graph_accelerometer.py
index 472530d3..990bd23b 100755
--- a/scripts/graph_accelerometer.py
+++ b/scripts/graph_accelerometer.py
@@ -5,12 +5,12 @@
# Copyright (C) 2020 Dmitry Butyugin <dmbutyugin@google.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import optparse, os, sys
+import importlib, optparse, os, sys
from textwrap import wrap
import numpy as np, matplotlib
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),
- '..', 'klippy', 'extras'))
-from shaper_calibrate import ShaperCalibrate
+ '..', 'klippy'))
+shaper_calibrate = importlib.import_module('.shaper_calibrate', 'extras')
MAX_TITLE_LENGTH=65
@@ -56,7 +56,7 @@ def plot_accel(data, logname):
# Calculate estimated "power spectral density"
def calc_freq_response(data, max_freq):
- helper = ShaperCalibrate(printer=None)
+ helper = shaper_calibrate.ShaperCalibrate(printer=None)
return helper.process_accelerometer_data(data)
def calc_specgram(data, axis):
@@ -155,7 +155,7 @@ def plot_specgram(data, logname, max_freq, axis):
######################################################################
def write_frequency_response(datas, output):
- helper = ShaperCalibrate(printer=None)
+ helper = shaper_calibrate.ShaperCalibrate(printer=None)
calibration_data = helper.process_accelerometer_data(datas[0])
for data in datas[1:]:
calibration_data.add_data(helper.process_accelerometer_data(data))