From 2c6663c439fba139834941b197a77ffa1a647b26 Mon Sep 17 00:00:00 2001 From: homosapien-lcy <102019577+homosapien-lcy@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:51:09 +0900 Subject: [PATCH] Fix fft error (#873) * MAINT: fix float input for number of samples * MAINT: fix FFT usage --------- Co-authored-by: Chengyu Liu --- examples/demo/advanced/spec_waterfall.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/demo/advanced/spec_waterfall.py b/examples/demo/advanced/spec_waterfall.py index f161ad7b0..a208ce0eb 100644 --- a/examples/demo/advanced/spec_waterfall.py +++ b/examples/demo/advanced/spec_waterfall.py @@ -6,7 +6,7 @@ # Major library imports import pyaudio from numpy import zeros, linspace, short, fromstring, transpose, array, empty -from scipy import fft +from scipy.fft import fft # Enthought library imports from enable.api import Window, Component, ComponentEditor @@ -100,7 +100,7 @@ def map_screen(self, data_array, data_offset=None): def _create_plot_component(obj): # Setup the spectrum plot - frequencies = linspace(0.0, float(SAMPLING_RATE) / 2, num=NUM_SAMPLES / 2) + frequencies = linspace(0.0, float(SAMPLING_RATE) / 2, num=NUM_SAMPLES // 2) obj.spectrum_data = ArrayPlotData(frequency=frequencies) empty_amplitude = zeros(NUM_SAMPLES // 2) obj.spectrum_data.set_data("amplitude", empty_amplitude)