Skip to content

Commit

Permalink
Fix bug in spectrogram() FFT shift
Browse files Browse the repository at this point in the history
Fixes #406
  • Loading branch information
mhostetter committed Jul 10, 2024
1 parent dbcade6 commit a4121df
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/sdr/plot/_spectral_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a4121df

Please sign in to comment.