Skip to content

Commit

Permalink
Fix fft error (#873)
Browse files Browse the repository at this point in the history
* MAINT: fix float input for number of samples

* MAINT: fix FFT usage

---------

Co-authored-by: Chengyu Liu <cyliu@aus552cyliu.local>
  • Loading branch information
homosapien-lcy and Chengyu Liu authored Mar 31, 2023
1 parent 13b57e7 commit 2c6663c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/demo/advanced/spec_waterfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2c6663c

Please sign in to comment.