Skip to content

Commit 456c4cf

Browse files
authored
update code formatting for test_psd_window_flattop
1 parent 76e53c1 commit 456c4cf

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

lib/matplotlib/tests/test_mlab.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,13 @@ def test_psd_window_hanning_detrend_linear(self):
672672

673673
def test_psd_window_flattop(self):
674674
# flattop window
675-
# adaption from https://github.com/scipy/scipy/blob/v1.10.0/scipy/signal/windows/_windows.py#L562-L622
676-
if self.NFFT_density_real <= 1:
677-
win = np.ones(self.NFFT_density_real)
678-
else:
679-
a = [0.21557895, 0.41663158, 0.277263158, 0.083578947, 0.006947368]
680-
fac = np.linspace(-np.pi, np.pi, self.NFFT_density_real)
681-
win = np.zeros(self.NFFT_density_real)
682-
for k in range(len(a)):
683-
win += a[k] * np.cos(k * fac)
675+
# adaption from https://github.com/scipy/scipy/blob\
676+
# /v1.10.0/scipy/signal/windows/_windows.py#L562-L622
677+
a = [0.21557895, 0.41663158, 0.277263158, 0.083578947, 0.006947368]
678+
fac = np.linspace(-np.pi, np.pi, self.NFFT_density_real)
679+
win = np.zeros(self.NFFT_density_real)
680+
for k in range(len(a)):
681+
win += a[k] * np.cos(k * fac)
684682

685683
spec, fsp = mlab.psd(x=self.y,
686684
NFFT=self.NFFT_density,
@@ -695,18 +693,10 @@ def test_psd_window_flattop(self):
695693
noverlap=0,
696694
sides=self.sides,
697695
window=win)
698-
# spec_b, fsp_b = mlab.psd(x=self.y * win,
699-
# NFFT=self.NFFT_density,
700-
# Fs=self.Fs,
701-
# noverlap=0,
702-
# sides=self.sides,
703-
# window=mlab.window_none)
704696
assert_allclose(spec*win.sum()**2,
705697
spec_a*self.Fs*(win**2).sum(),
706698
atol=1e-08)
707-
# assert_allclose(spec*win.sum()**2,
708-
# spec_b*self.Fs*self.NFFT_density,
709-
# atol=1e-08)
699+
710700

711701
def test_psd_windowarray(self):
712702
freqs = self.freqs_density

0 commit comments

Comments
 (0)