From a4121df8b1c60a25544c9a4490dd9d0c647fad49 Mon Sep 17 00:00:00 2001 From: mhostetter Date: Wed, 10 Jul 2024 16:11:57 -0400 Subject: [PATCH] Fix bug in `spectrogram()` FFT shift Fixes #406 --- src/sdr/plot/_spectral_estimation.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sdr/plot/_spectral_estimation.py b/src/sdr/plot/_spectral_estimation.py index 165f92a6c..20866484e 100644 --- a/src/sdr/plot/_spectral_estimation.py +++ b/src/sdr/plot/_spectral_estimation.py @@ -196,9 +196,8 @@ def spectrogram( f = f[0 : f.size // 2] Sxx = Sxx[0 : Sxx.shape[0] // 2, :] if y_axis == "two-sided": - # f[f >= 0.5 * sample_rate] -= sample_rate # Wrap frequencies from [0, 1) to [-0.5, 0.5) f = np.fft.fftshift(f) - Sxx = np.fft.fftshift(Sxx) + Sxx = np.fft.fftshift(Sxx, axes=0) if sample_rate_provided: f_units, scalar = freq_units(f)