@@ -672,15 +672,13 @@ def test_psd_window_hanning_detrend_linear(self):
672
672
673
673
def test_psd_window_flattop (self ):
674
674
# 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 )
684
682
685
683
spec , fsp = mlab .psd (x = self .y ,
686
684
NFFT = self .NFFT_density ,
@@ -695,18 +693,10 @@ def test_psd_window_flattop(self):
695
693
noverlap = 0 ,
696
694
sides = self .sides ,
697
695
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)
704
696
assert_allclose (spec * win .sum ()** 2 ,
705
697
spec_a * self .Fs * (win ** 2 ).sum (),
706
698
atol = 1e-08 )
707
- # assert_allclose(spec*win.sum()**2,
708
- # spec_b*self.Fs*self.NFFT_density,
709
- # atol=1e-08)
699
+
710
700
711
701
def test_psd_windowarray (self ):
712
702
freqs = self .freqs_density
0 commit comments