Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sjvenditto committed Jan 21, 2025
1 parent 1141fb7 commit 11efd92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pynapple/process/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ def compute_power_spectral_density(sig, fs=None, ep=None, full_range=False, n=No
# subtract from the nyquist frequency to adjust for floating point error in np.fft.fftfreq
# nyquist freq may occur at negative end of frequencies if N is even
doubled_freqs = (
(fft.index != 0) & (fft.index < (fs / 2 - 1e-6)) & (fft.index > (fs / 2 + 1e-6))
(fft.index != 0) # not 0
& (fft.index < (fs / 2 - 1e-6)) # less than positive nyquist freq
& (fft.index > (-fs / 2 + 1e-6)) # greater than negative nyquist freq
)
psd[doubled_freqs] *= 2

Expand Down

0 comments on commit 11efd92

Please sign in to comment.