diff options
author | Dmitry Butyugin <dmbutyugin@google.com> | 2021-03-14 14:58:29 +0100 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2021-03-20 13:24:43 -0400 |
commit | 2d8945dc1c5a799476c10bf54d7eb1bca3a0fd36 (patch) | |
tree | 3041c293063cde6a72460fac15627c811ab8331c /scripts/graph_accelerometer.py | |
parent | b6908e56aa5584e7646422e8362bc7b994eae742 (diff) | |
download | kutter-2d8945dc1c5a799476c10bf54d7eb1bca3a0fd36.tar.gz kutter-2d8945dc1c5a799476c10bf54d7eb1bca3a0fd36.tar.xz kutter-2d8945dc1c5a799476c10bf54d7eb1bca3a0fd36.zip |
graph_accelerometer: Support axis-level comparison of adxl345 data
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Diffstat (limited to 'scripts/graph_accelerometer.py')
-rwxr-xr-x | scripts/graph_accelerometer.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/graph_accelerometer.py b/scripts/graph_accelerometer.py index f6d7cf89..93dd413b 100755 --- a/scripts/graph_accelerometer.py +++ b/scripts/graph_accelerometer.py @@ -113,7 +113,7 @@ def plot_frequency(datas, lognames, max_freq): fig.tight_layout() return fig -def plot_compare_frequency(datas, lognames, max_freq): +def plot_compare_frequency(datas, lognames, max_freq, axis): fig, ax = matplotlib.pyplot.subplots() ax.set_title('Frequency responses comparison') ax.set_xlabel('Frequency (Hz)') @@ -122,7 +122,7 @@ def plot_compare_frequency(datas, lognames, max_freq): for data, logname in zip(datas, lognames): calibration_data = calc_freq_response(data, max_freq) freqs = calibration_data.freq_bins - psd = calibration_data.psd_sum[freqs <= max_freq] + psd = calibration_data.get_psd(axis)[freqs <= max_freq] freqs = freqs[freqs <= max_freq] ax.plot(freqs, psd, label="\n".join(wrap(logname, 60)), alpha=0.6) @@ -243,7 +243,8 @@ def main(): opts.error("Only 1 input is supported in specgram mode") fig = plot_specgram(datas[0], args[0], options.max_freq, options.axis) elif options.compare: - fig = plot_compare_frequency(datas, args, options.max_freq) + fig = plot_compare_frequency(datas, args, options.max_freq, + options.axis) else: fig = plot_frequency(datas, args, options.max_freq) |