Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gviejo committed Jan 24, 2025
1 parent d531a2e commit ce6ea48
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/user_guide/10_power_spectral_density.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ plt.plot(10*np.log10(mean_psd), label='Mean PSD (20s)')
plt.ylabel("Power/Frequency (dB/Hz)")
plt.legend()
plt.xlim(0, 15)
plt.xlim(0, 20)
plt.xlabel("Frequency (Hz)")
```
Expand Down
4 changes: 2 additions & 2 deletions pynapple/process/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def compute_mean_power_spectral_density(
window = window[:, np.newaxis]

# Compute the PSD
psd_result = np.zeros((N, *sig.shape[1:]), dtype=float) # Default
psd_result = np.zeros((N, *sig.shape[1:]), dtype=float) # Default

for i in range(len(slices)):
tmp = sig[slices[i, 0] : slices[i, 1]].values[0:N] * window
Expand All @@ -294,7 +294,7 @@ def compute_mean_power_spectral_density(
# transform to power spectral density, power/Hz
psd = (1 / (fs * N)) * (np.abs(fft) ** 2)

psd_result += psd #Default
psd_result += psd # Default

psd_result /= float(len(slices))
ret = pd.DataFrame(psd_result, index=fft_freq)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_power_spectral_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_compute_fft():
assert r.shape[0] == 500

a, b = get_sorted_fft(np.hstack((sig.values, np.zeros(20))), sig.rate)
r = nap.compute_fft(sig, fs=1000, n = len(sig)+20, full_range=True)
r = nap.compute_fft(sig, fs=1000, n=len(sig) + 20, full_range=True)
np.testing.assert_array_almost_equal(r.index.values, a)
np.testing.assert_array_almost_equal(r.values, b)

Expand Down

0 comments on commit ce6ea48

Please sign in to comment.