From 2a61adef0a97bea2f252e75a7f482de3da7d3c74 Mon Sep 17 00:00:00 2001 From: Chengyu Liu Date: Fri, 31 Mar 2023 10:33:34 +0900 Subject: [PATCH 1/2] MAINT: fix float input for number of samples --- examples/demo/advanced/spec_waterfall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/demo/advanced/spec_waterfall.py b/examples/demo/advanced/spec_waterfall.py index f161ad7b0..5dd6d7d57 100644 --- a/examples/demo/advanced/spec_waterfall.py +++ b/examples/demo/advanced/spec_waterfall.py @@ -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) From 6074ffcda0984e3f32fd68d71a95a8a79f1124a1 Mon Sep 17 00:00:00 2001 From: Chengyu Liu Date: Fri, 31 Mar 2023 10:48:33 +0900 Subject: [PATCH 2/2] MAINT: fix FFT usage --- examples/demo/advanced/spec_waterfall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/demo/advanced/spec_waterfall.py b/examples/demo/advanced/spec_waterfall.py index 5dd6d7d57..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