mirror of https://github.com/Desuuuu/klipper.git
resonance_tester: Fixed multi-point resonance testing
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
This commit is contained in:
parent
bf01d6d1f8
commit
165d2fc228
|
@ -178,7 +178,10 @@ class ResonanceTester:
|
||||||
"%s-axis accelerometer measured no data" % (
|
"%s-axis accelerometer measured no data" % (
|
||||||
chip_axis,))
|
chip_axis,))
|
||||||
new_data = helper.process_accelerometer_data(chip_values)
|
new_data = helper.process_accelerometer_data(chip_values)
|
||||||
data = data.join(new_data) if data else new_data
|
if data is None:
|
||||||
|
data = new_data
|
||||||
|
else:
|
||||||
|
data.add_data(new_data)
|
||||||
if csv_output:
|
if csv_output:
|
||||||
csv_name = self.save_calibration_data('resonances', name_suffix,
|
csv_name = self.save_calibration_data('resonances', name_suffix,
|
||||||
helper, axis, data)
|
helper, axis, data)
|
||||||
|
@ -251,7 +254,7 @@ class ResonanceTester:
|
||||||
if calibration_data[axis] is None:
|
if calibration_data[axis] is None:
|
||||||
calibration_data[axis] = new_data
|
calibration_data[axis] = new_data
|
||||||
else:
|
else:
|
||||||
calibration_data[axis].join(new_data)
|
calibration_data[axis].add_data(new_data)
|
||||||
|
|
||||||
configfile = self.printer.lookup_object('configfile')
|
configfile = self.printer.lookup_object('configfile')
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ class CalibrationData:
|
||||||
self._psd_map = {'x': self.psd_x, 'y': self.psd_y, 'z': self.psd_z,
|
self._psd_map = {'x': self.psd_x, 'y': self.psd_y, 'z': self.psd_z,
|
||||||
'all': self.psd_sum}
|
'all': self.psd_sum}
|
||||||
self.data_sets = 1
|
self.data_sets = 1
|
||||||
def join(self, other):
|
def add_data(self, other):
|
||||||
np = self.numpy
|
np = self.numpy
|
||||||
joined_data_sets = self.data_sets + other.data_sets
|
joined_data_sets = self.data_sets + other.data_sets
|
||||||
for psd, other_psd in zip(self._psd_list, other._psd_list):
|
for psd, other_psd in zip(self._psd_list, other._psd_list):
|
||||||
|
|
|
@ -45,12 +45,12 @@ def calibrate_shaper(datas, csv_output, max_smoothing):
|
||||||
if isinstance(datas[0], CalibrationData):
|
if isinstance(datas[0], CalibrationData):
|
||||||
calibration_data = datas[0]
|
calibration_data = datas[0]
|
||||||
for data in datas[1:]:
|
for data in datas[1:]:
|
||||||
calibration_data.join(data)
|
calibration_data.add_data(data)
|
||||||
else:
|
else:
|
||||||
# Process accelerometer data
|
# Process accelerometer data
|
||||||
calibration_data = helper.process_accelerometer_data(datas[0])
|
calibration_data = helper.process_accelerometer_data(datas[0])
|
||||||
for data in datas[1:]:
|
for data in datas[1:]:
|
||||||
calibration_data.join(helper.process_accelerometer_data(data))
|
calibration_data.add_data(helper.process_accelerometer_data(data))
|
||||||
calibration_data.normalize_to_frequencies()
|
calibration_data.normalize_to_frequencies()
|
||||||
shaper, all_shapers = helper.find_best_shaper(
|
shaper, all_shapers = helper.find_best_shaper(
|
||||||
calibration_data, max_smoothing, print)
|
calibration_data, max_smoothing, print)
|
||||||
|
|
|
@ -82,7 +82,7 @@ def calc_specgram(data, axis):
|
||||||
def plot_frequency(datas, lognames, max_freq):
|
def plot_frequency(datas, lognames, max_freq):
|
||||||
calibration_data = calc_freq_response(datas[0], max_freq)
|
calibration_data = calc_freq_response(datas[0], max_freq)
|
||||||
for data in datas[1:]:
|
for data in datas[1:]:
|
||||||
calibration_data.join(calc_freq_response(data, max_freq))
|
calibration_data.add_data(calc_freq_response(data, max_freq))
|
||||||
freqs = calibration_data.freq_bins
|
freqs = calibration_data.freq_bins
|
||||||
psd = calibration_data.psd_sum[freqs <= max_freq]
|
psd = calibration_data.psd_sum[freqs <= max_freq]
|
||||||
px = calibration_data.psd_x[freqs <= max_freq]
|
px = calibration_data.psd_x[freqs <= max_freq]
|
||||||
|
@ -158,7 +158,7 @@ def write_frequency_response(datas, output):
|
||||||
helper = ShaperCalibrate(printer=None)
|
helper = ShaperCalibrate(printer=None)
|
||||||
calibration_data = helper.process_accelerometer_data(datas[0])
|
calibration_data = helper.process_accelerometer_data(datas[0])
|
||||||
for data in datas[1:]:
|
for data in datas[1:]:
|
||||||
calibration_data.join(helper.process_accelerometer_data(data))
|
calibration_data.add_data(helper.process_accelerometer_data(data))
|
||||||
helper.save_calibration_data(output, calibration_data)
|
helper.save_calibration_data(output, calibration_data)
|
||||||
|
|
||||||
def write_specgram(psd, freq_bins, time, output):
|
def write_specgram(psd, freq_bins, time, output):
|
||||||
|
|
Loading…
Reference in New Issue