Skip to content

Commit

Permalink
Fix bug in sdr.plot.dft()
Browse files Browse the repository at this point in the history
Fixes #429
  • Loading branch information
mhostetter committed Jan 21, 2025
1 parent f298eb4 commit e4cdf43
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sdr/plot/_freq_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ def dft(
if ax is None:
ax = plt.gca()

if window is not None:
x *= scipy.signal.windows.get_window(window, x.size)
if window is None:
w = np.ones(x.size)
else:
w = scipy.signal.windows.get_window(window, x.size)

if size is None:
if oversample is None:
Expand All @@ -140,7 +142,7 @@ def dft(
if fast:
size = scipy.fft.next_fast_len(size)

X = np.fft.fft(x, size)
X = np.fft.fft(x * w, size)
if x_axis == "freq":
f = np.fft.fftfreq(size, 1 / sample_rate)
elif x_axis == "bin":
Expand Down

0 comments on commit e4cdf43

Please sign in to comment.