+
    /iE                       ^ RI t ^ RIt^ RIt^ RIHtHtHtHtH	t	 ^ RI
t
^ RI
Ht ^ RIHt ^ RIHt ^ RIHtHtHtHt ^ RIHt ^ RIHtHtHtHtHtHtHtH t  ^ R	I!H"t" ^ R
I#H$t$ ^ RI%H&t' ^ RI%H(t)  ! R R4      t* ! R R4      t+ ! R R4      t, ! R R4      t- ! R R4      t. ! R R4      t/ ! R R4      t0 ! R R4      t1R# )    N)assert_assert_allcloseassert_array_equalassert_equalassert_array_almost_equal_nulp)raises)signal)xp_assert_close)fftfreqrfftfreqfftirfft)	trapezoid)periodogramwelchlombscargle	coherencecsdspectrogram
check_COLA
check_NOLA)hann)_spectral_helper)stft_compare)istft_comparec                   X  a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	 t]P                  P                  ]P"                  R8*  R
R7      R 4       t]P                  P                  ]P"                  R8*  R
R7      R 4       tR tR tR tR tR tR tR tR tR tR tR tRtV t R# )TestPeriodogramc                "   \         P                  ! ^4      p^V^ &   \        V4      w  r#\        V\         P                  ! ^ R^	4      4       \         P
                  ! ^	4      p^ V^ &   VR;;,          R,          uu&   V^,          p\        W44       R# )         ?       @Nnpzerosr   r   linspaceonesselfxfpqs   &    ^/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/signal/tests/test_spectral.pytest_real_onesided_even'TestPeriodogram.test_real_onesided_even   sn    HHRL!1~2;;q#q12GGAJ!	"	Q    c                   \         P                  ! ^4      p^V^ &   \        V4      w  r#\        V\         P                  ! R4      R,          4       \         P
                  ! ^4      p^ V^ &   VR,          p\        W4RR7       R# )          @      .@V瞯<atolN?)r$   r%   r   r   aranger'   r(   s   &    r.   test_real_onesided_odd&TestPeriodogram.test_real_onesided_odd%   sc    HHRL!1~299S>$./GGAJ!	X5)r1   c                    \         P                  ! ^4      p^V^ &   \        VRR7      w  r#\        V\	        ^R4      4       \         P
                  ! ^R4      p^ V^ &   \        W44       R# )r   Freturn_onesided      ?N      ?)r$   r%   r   r   r   fullr(   s   &    r.   test_real_twosided"TestPeriodogram.test_real_twosided/   sX    HHRL!1e472s+,GGB!r1   c                    \         P                  ! ^4      p^V^ &   \        VRR7      w  r#\        VRR7      w  rE\        V\         P                  ! ^ R^	4      4       \        W5R,          4       R# )r   spectrumscalingdensityr    g      0@N)r$   r%   r   r   r&   )r)   r*   r+   r,   gr-   s   &     r.   test_real_spectrum"TestPeriodogram.test_real_spectrum8   sW    HHRL!1j11i02;;q#q12T6"r1   c                .   \         P                  ! ^\        R7      p^V^ &   \        V4      w  r#\	        V\         P
                  ! ^ R^	4      4       \         P                  ! ^	4      p^ V^ &   VR;;,          R,          uu&   V^,          p\	        W44       R# )r   dtyper    r!   Nr"   )r$   r%   intr   r   r&   r'   r(   s   &    r.   test_integer_even!TestPeriodogram.test_integer_even@   sq    HHRs#!1~2;;q#q12GGAJ!	"	Qr1   c                   \         P                  ! ^\        R7      p^V^ &   \        V4      w  r#\	        V\         P
                  ! R4      R,          4       \         P                  ! ^4      p^ V^ &   VR,          p\	        W4RR7       R# )r3   rN   r4   r5   r6   r7   Nr9   )r$   r%   rP   r   r   r:   r'   r(   s   &    r.   test_integer_odd TestPeriodogram.test_integer_oddK   sf    HHRs#!1~299S>$./GGAJ!	X5)r1   c                    \         P                  ! ^\        R7      p^V^ &   \        VRR7      w  r#\	        V\        ^R4      4       \         P                  ! ^R4      p^ V^ &   \	        W44       R# )r   rN   Fr>   r@   NrA   )r$   r%   rP   r   r   r   rB   r(   s   &    r.   test_integer_twosided%TestPeriodogram.test_integer_twosidedU   s[    HHRs#!1e472s+,GGB!r1   c                    \         P                  ! ^\         P                  4      pRV^ &   \        VRR7      w  r#\	        V\        ^R4      4       \         P                  ! ^R4      p^ V^ &   \	        W44       R# )r   r@   Fr>   N      ?       @      ?)r$   r%   
complex128r   r   r   rB   r(   s   &    r.   test_complexTestPeriodogram.test_complex^   s_    HHR'!1e472s+,GGB!!r1   c                z    \        \        \        \        P                  ! ^\        P
                  4      RR7       R# )   foorG   N)assert_raises
ValueErrorr   r$   r%   r\   r)   s   &r.   test_unk_scaling TestPeriodogram.test_unk_scalingg   s"    j+rxx2==/I	r1   zOn some 32-bit tolerance issue)reasonc                x   \         P                  ! ^\         P                  R7      pVP                  R4      pRVR&   \	        V4      w  r#\        VP                  R4       \        VR,          VR	,          ^<4       \	        VR,          4      w  rE\        V\         P                  R3,          VR
,          ^<4       R# )   rN   r@   NNNN      
   )rj   rj   r   rl   rm      r   r   rj   rm   r   rj   rm   rj   )	r$   r%   float64reshaper   r   shaper   newaxisr)   r*   r+   r,   f0p0s   &     r.   test_nd_axis_m1TestPeriodogram.test_nd_axis_m1k   s    
 HHRrzz*IIh%1~177I.&qx52>QuX&&r"**Q,'73Dr1   c                J   \         P                  ! ^\         P                  R7      pVP                  R4      pRVR&   \	        V^ R7      w  r#\        VP                  R4       \        VR,          VR	,          ^<4       \	        VR,          4      w  rE\        WSR	,          4       R# )
ri   rN   r@   axisNrn   rl   rm   )r   rj   rj   rp   rl   rm   rj   r   r   rj   rm   r   )r$   r%   rt   ru   r   r   rv   r   rx   s   &     r.   test_nd_axis_0TestPeriodogram.test_nd_axis_0y   s{    
 HHRrzz*IIh%11%177G,&qx52>QuX&&rU84r1   c                .   \         P                  ! ^4      p^V^ &   \        V^
R4      w  r#\        P                  ! R^4      p\        V^
V4      w  rV\        W64       \        W%4       \        P                  ! R^ 4      p\        \        \        V^
V4       R# )r   r   N)r$   r%   r   r	   
get_windowr   rb   rc   r)   r*   r+   r,   winfepewin_errs   &       r.   test_window_external$TestPeriodogram.test_window_external   s    HHRL!1b&)+QC(&q-&q-##FB/j+q'	#r1   c                    \         P                  ! ^4      p^V^ &   \        V4      w  r#\        V^ R7      w  rE\        W$R,          4       \        W5R,          4       \	        VP
                  R4       R# )r   nfftNNrl   N)   )r$   r%   r   r   r   rv   )r)   r*   r+   r,   fppps   &     r.   test_padded_fftTestPeriodogram.test_padded_fft   sW    HHRL!1~QR(c7#c7#288U+r1   c                $   \        . 4      w  r\        VP                  R4       \        VP                  R4       R FP  p\        \        P                  ! V4      4      w  r\        VP                  V4       \        VP                  V4       KR  	  R# r   Nr   r      r   r      rl   )r   r   rv   r$   emptyr)   r+   r,   rv   s   &   r.   test_empty_input TestPeriodogram.test_empty_input   sc    2177D)177D)+Erxx/DAqww.qww. ,r1   c                    R FR  p\        \        P                  ! V4      ^R7      w  r#\        VP                  V4       \        VP                  V4       KT  	  R# r   r~   Nr   r   )r   r$   r   r   rv   r)   rv   r+   r,   s   &   r.   test_empty_input_other_axis+TestPeriodogram.test_empty_input_other_axis   s>    %ErxxQ7DAqww.qww. &r1   c                &   \         P                  ! ^4      p^V^ &   \        V^R7      w  r#\        V\         P                  ! ^ R^	4      4       \         P
                  ! ^	4      p^ V^ &   VR;;,          R,          uu&   V^,          p\        W44       R# )   r   r    r!   Nr"   r#   r(   s   &    r.   test_short_nfftTestPeriodogram.test_short_nfft   q    HHRL!12&2;;q#q12GGAJ!	"	Qr1   c                &   \         P                  ! ^4      p^V^ &   \        V^R7      w  r#\        V\         P                  ! ^ R^	4      4       \         P
                  ! ^	4      p^ V^ &   VR;;,          R,          uu&   V^,          p\        W44       R# )r   r   r    r!   Nr"   r#   r(   s   &    r.   test_nfft_is_xshape#TestPeriodogram.test_nfft_is_xshape   r   r1   c                j   \         P                  ! ^R4      p^V^ &   \        V4      w  r#\        V\         P                  ! ^ R^	4      4       \         P
                  ! ^	R4      p^ V^ &   VR;;,          R,          uu&   V^,          p\        W44       \        VP                  VP                  8H  4       R# )r   r+   r    r!   Nr"   )r$   r%   r   r   r&   r'   r   rO   r(   s   &    r.   test_real_onesided_even_32*TestPeriodogram.test_real_onesided_even_32   s    HHR!1~2;;q#q12GGAsO!	"	Q177"#r1   c                N   \         P                  ! ^R4      p^V^ &   \        V4      w  r#\        V\         P                  ! R4      R,          4       \         P
                  ! ^R4      p^ V^ &   VR,          p\        W4RR7       \        VP                  VP                  8H  4       R# )r3   r+   r4   r5   Hz>r7   Nr9   )r$   r%   r   r   r:   r'   r   rO   r(   s   &    r.   test_real_onesided_odd_32)TestPeriodogram.test_real_onesided_odd_32   s}    HHR!1~299S>$./GGAsO!	X4(177"#r1   c                   \         P                  ! ^R4      p^V^ &   \        VRR7      w  r#\        V\	        ^R4      4       \         P
                  ! ^RR4      p^ V^ &   \        W44       \        VP                  VP                  8H  4       R# )r   r+   Fr>   r@   NrA   r$   r%   r   r   r   rB   r   rO   r(   s   &    r.   test_real_twosided_32%TestPeriodogram.test_real_twosided_32   sr    HHR!1e472s+,GGB$!177"#r1   c                   \         P                  ! ^R4      pRV^ &   \        VRR7      w  r#\        V\	        ^R4      4       \         P
                  ! ^RR4      p^ V^ &   \        W44       \        VP                  VP                  8H  4       R# )	r   Fr@   Fr>   r+   NrZ   r[   r   r(   s   &    r.   test_complex_32TestPeriodogram.test_complex_32   sr    HHR!1e472s+,GGB#&!177"#r1   c                    \         P                  ! ^4      p^V^ &   \        P                  ! R^
4      pRp\	        \
        VR7      ;_uu_ 4        \        WR7       RRR4       R#   + '       g   i     R# ; i)r   r   zOthe size of the window must be the same size of the input on the specified axismatchwindowN)r$   r%   r	   r   rb   rc   r   )r)   r*   r   expected_msgs   &   r.   test_shorter_window_error)TestPeriodogram.test_shorter_window_error   sU    HHRL!+=:\::& ;:::s   A%%A6	 Nl        )!__name__
__module____qualname____firstlineno__r/   r;   rC   rK   rQ   rT   rW   r]   re   pytestmarkskipifsysmaxsizer{   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes____classdictcell____classdict__s   @r.   r   r      s     	*#	* [[u/  E	E [[u/  5	5
#,//		
$	$$$' 'r1   r   c                      a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R  t#R! t$R"t%V t&R## )$	TestWelchc                    \         P                  ! ^4      p^V^ &   ^V^&   \        V^R7      w  r#\        V\         P                  ! ^ R^4      4       \         P
                  ! . RO4      p\        W4RRR7       R# r   npersegr    r   r8   rtolNiKGUU?gS8?#q?r   #q?r$   r%   r   r   r&   arrayr(   s   &    r.   r/   !TestWelch.test_real_onesided_even   se    HHRL!!Q"2;;q#q12HH " #4d3r1   c                    \         P                  ! ^4      p^V^ &   ^V^&   \        V^	R7      w  r#\        V\         P                  ! R4      R,          4       \         P
                  ! . RO4      p\        W4RRR7       R# r   r         @      "@r   r   Ng9?g?p0?r   r   )r$   r%   r   r   r:   r   r(   s   &    r.   r;    TestWelch.test_real_onesided_odd  se    HHRL!!Q"299S>#-.HH " #4d3r1   c                    \         P                  ! ^4      p^V^ &   ^V^&   \        V^RR7      w  r#\        V\	        ^R4      4       \         P
                  ! . RO4      p\        W4RRR7       R# r   Fr   r?   r@   r   r   Nr   S8?r   r   r   r   r   r   )r$   r%   r   r   r   r   r(   s   &    r.   rC   TestWelch.test_real_twosided  sb    HHRL!!Q5971c?+HH F G4d3r1   c                    \         P                  ! ^4      p^V^ &   ^V^&   \        V^RR7      w  r#\        V\         P                  ! ^ R^4      4       \         P
                  ! . RO4      p\        W4RRR7       R# r   rF   )r   rH   r    r   r   N)g      ?g-UU?.iqUU?r   g-UU?r   r(   s   &    r.   rK   TestWelch.test_real_spectrum  sg    HHRL!!Q:62;;q#q12HH " #4d3r1   c                    \         P                  ! ^\        R7      p^V^ &   ^V^&   \        V^R7      w  r#\	        V\         P
                  ! ^ R^4      4       \         P                  ! . RO4      p\	        W4RRR7       R# r   rN   r   r    r   r   Nr   )r$   r%   rP   r   r   r&   r   r(   s   &    r.   test_integer_onesided_even$TestWelch.test_integer_onesided_even  sh    HHRs#!!Q"2;;q#q12HH " #4d3r1   c                
   \         P                  ! ^\        R7      p^V^ &   ^V^&   \        V^	R7      w  r#\	        V\         P
                  ! R4      R,          4       \         P                  ! . RO4      p\	        W4RRR7       R# 	r   rN   r   r   r   r   r   Nr   )r$   r%   rP   r   r   r:   r   r(   s   &    r.   test_integer_onesided_odd#TestWelch.test_integer_onesided_odd)  sh    HHRs#!!Q"299S>#-.HH " #4d3r1   c                    \         P                  ! ^\        R7      p^V^ &   ^V^&   \        V^RR7      w  r#\	        V\        ^R4      4       \         P                  ! . RO4      p\	        W4RRR7       R# 	r   rN   Fr   r@   r   r   Nr   )r$   r%   rP   r   r   r   r   r(   s   &    r.   rW   TestWelch.test_integer_twosided3  se    HHRs#!!Q5971c?+HH F G4d3r1   c                    \         P                  ! ^\         P                  4      pRV^ &   RV^&   \        V^RR7      w  r#\	        V\        ^R4      4       \         P                  ! . RO4      p\	        W4RRR7       R# 	r   r@   Fr   r   r   NrZ   )g&>?#q?n)t?r  r  r  r  r  )r$   r%   r\   r   r   r   r   r(   s   &    r.   r]   TestWelch.test_complex=  si    HHR'!!Q5971c?+HH F G4d3r1   c                |    \        \        \        \        P                  ! ^\        P
                  4      R^R7       R# r`   ra   )rH   r   N)rb   rc   r   r$   r%   r\   rd   s   &r.   re   TestWelch.test_unk_scalingG  s$    j%!R]])C#Q	0r1   c                    \         P                  ! ^
\         P                  R7      R,           p\        V^
RR7      w  r#\	        V\         P
                  ! V4      RR7       R# rn   rN   {Gz?linearr   detrendr6   r7   Nr$   r:   rt   r   r   
zeros_liker)   r*   r+   r,   s   &   r.   test_detrend_linearTestWelch.test_detrend_linearK  s@    IIb

+d2QH52==+%8r1   c                    \         P                  ! ^
\         P                  R7      R,           p\        V^
RR7      w  r#\        V^
R R7      w  rE\	        W$RR7       \	        W5RR7       R# )	rn   rN   r  Fr  c                     V # Nr   r*   s   &r.   <lambda>.TestWelch.test_no_detrending.<locals>.<lambda>S  s    r1   r6   r7   N)r$   r:   rt   r   r   r)   r*   f1p1f2p2s   &     r.   test_no_detrendingTestWelch.test_no_detrendingP  sO    IIb

+d2q"e4q"k:U+U+r1   c                    \         P                  ! ^
\         P                  R7      R,           p\        V^
R R7      w  r#\	        V\         P
                  ! V4      RR7       R# )rn   rN   r  c                 2    \         P                  ! V R R7      # l)typer	   r  segs   &r.   r  1TestWelch.test_detrend_external.<locals>.<lambda>Z      #)Fr1   r  r6   r7   Nr  r  s   &   r.   test_detrend_externalTestWelch.test_detrend_externalW  sD    IIb

+d2QFH2==+%8r1   c                    \         P                  ! ^(\         P                  R7      R,           pVP                  R4      p\	        V^
R R7      w  r#\        V\         P                  ! V4      RR7       R# )	(   rN   r  c                 2    \         P                  ! V R R7      # r$  r'  r(  s   &r.   r  7TestWelch.test_detrend_external_nd_m1.<locals>.<lambda>a  r+  r1   r  r6   r7   Nrl   rl   rn   )r$   r:   rt   ru   r   r   r  r  s   &   r.   test_detrend_external_nd_m1%TestWelch.test_detrend_external_nd_m1]  sR    IIb

+d2IIhQFH2==+%8r1   c                   \         P                  ! ^\         P                  R7      R,           pVP                  R4      p\         P                  ! V^^ 4      p\        V^
^ R R7      w  r#\        V\         P                  ! V4      RR7       R# )	ri   rN   r  c                 4    \         P                  ! V ^ RR7      # r   r%  )r   r&  r'  r(  s   &r.   r  6TestWelch.test_detrend_external_nd_0.<locals>.<lambda>i  s    !#)Nr1   r   r   r  r6   r7   Nrk   )r$   r:   rt   ru   moveaxisr   r   r  r  s   &   r.   test_detrend_external_nd_0$TestWelch.test_detrend_external_nd_0d  sf    IIb

+d2IIhKK1a QNP2==+%8r1   c                   \         P                  ! ^\         P                  R7      R,           pVP                  R4      p\	        V^
R7      w  r#\        VP                  R	4       \        VR
,          VR,          RRR7       \	        VR
,          ^
R7      w  rE\        V\         P                  R3,          VR,          RRR7       R# ri   rN   r  r   rj   vIh%<=r   Nrk   ro   rq   rr   rs   )	r$   r:   rt   ru   r   r   rv   r   rw   rx   s   &     r.   r{   TestWelch.test_nd_axis_m1l  s    IIb

+d2IIhQ#177I.%!E(UCqx,2::a<(!C&u5Ir1   c                ^   \         P                  ! ^\         P                  R7      R,           pVP                  R4      p\	        V^
^ R7      w  r#\        VP                  R	4       \        VR
,          VR,          RRR7       \	        VR
,          ^
R7      w  rE\        WSR,          RRR7       R# ri   rN   r  )r   r   r?  r   r   Nr   r   r   r   )r$   r:   rt   ru   r   r   rv   r   rx   s   &     r.   r   TestWelch.test_nd_axis_0u  s    IIb

+d2IIhQ+177G,%!E(UCqx,eH5u=r1   c           	        \         P                  ! ^4      p^V^ &   ^V^&   \        V^
R^R7      w  r#\        P                  ! R^4      p\        V^
VRR7      w  rV\        W64       \        W%4       \        VP                  R4       \        VP                  R4       \        \        \        V^
V^R7       \        P                  ! R^ 4      p\        \        \        V^
VRR7       R# )r   r   r   Nr   )
r$   r%   r   r	   r   r   r   rv   rb   rc   r   s   &       r.   r   TestWelch.test_window_external~  s    HHRL!!QFA.*q"c40&q-&q-288T*288T*j%#q	*##FB/j%'4	1r1   c                $   \        . 4      w  r\        VP                  R4       \        VP                  R4       R FP  p\        \        P                  ! V4      4      w  r\        VP                  V4       \        VP                  V4       KR  	  R# r   )r   r   rv   r$   r   r   s   &   r.   r   TestWelch.test_empty_input  sc    Ry177D)177D)+E%)DAqww.qww. ,r1   c                    R FR  p\        \        P                  ! V4      ^R7      w  r#\        VP                  V4       \        VP                  V4       KT  	  R# r   )r   r$   r   r   rv   r   s   &   r.   r   %TestWelch.test_empty_input_other_axis  s>    %E%q1DAqww.qww. &r1   c                   \         P                  ! ^4      p^V^ &   \        P                  ! 4       ;_uu_ 4        \        P                  ! RR\
        4       \        VRR7      w  r#\        VRRR7      w  rERRR4       \        V^R7      w  rg\        XV4       \        XV4       \        XV4       \        XV4       R#   + '       g   i     LQ; i)	   ignorez$nperseg=256 is greater than signal.*r   r      r   r   Nr   )r$   r%   warningscatch_warningsfilterwarningsUserWarningr   r   r)   r*   r+   r,   r  r  r  r  s   &       r.   test_short_dataTestWelch.test_short_data  s    HHQK! $$&&##@+O&)DA1FC8FB	 '
 q!$22BB '&   <B>>C	c           
     $   \        \        \        \        P                  ! ^4      ^\        P
                  ! . RO4      4       \        \        \        \        P                  ! ^4      ^\        P                  ! ^4      P                  R4      4       R# r`   N)rm   rm   rm   rm   rm   )rl   r   )rb   rc   r   r$   r%   r   r:   ru   rd   s   &r.   test_window_long_or_nd TestWelch.test_window_long_or_nd  sQ    j%!a+9NOj%!aiil**51	3r1   c                    \         P                  ! ^@4      p^VR&   \        V^^R7      w  r#\         P                  ! . RO4      p\	        W4RR7       R# @   :NNrL  r   noverlapg-q=r7   N)	r   gUUUUUU?UUUUUU?皙?ra  rb  ra  rb  gUUUUUU?)r$   r%   r   r   r   r(   s   &    r.   test_nondefault_noverlap"TestWelch.test_nondefault_noverlap  sE    HHRL#QQ/HH  5)r1   c           	     `    \        \        \        \        P                  ! ^4      ^R^^4       R# r`   r   N)rb   rc   r   r$   r%   rd   s   &r.   test_bad_noverlapTestWelch.test_bad_noverlap  s    j%!aAFr1   c                ^    \        \        \        \        P                  ! ^4      ^^R7       R#    )r   r   N)rb   rc   r   r$   r'   rd   s   &r.   test_nfft_too_shortTestWelch.test_nfft_too_short  s    j%1aHr1   c                <   \         P                  ! ^R4      p^V^ &   ^V^&   \        V^R7      w  r#\        V\         P                  ! ^ R^4      4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  4       R# r   r+   r   r    r   r   Nr   )r$   r%   r   r   r&   r   r   rO   r(   s   &    r.   r   $TestWelch.test_real_onesided_even_32  s    HHR!!Q"2;;q#q12HH "#&(4d3177"#r1   c                F   \         P                  ! ^R4      p^V^ &   ^V^&   \        V^	R7      w  r#\        V\         P                  ! R4      R,          4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  4       R# 	r   r+   r   r   r   r   r   N)gx:?gyѲI?r   gw0?r   )r$   r%   r   r   r:   r   r   rO   r(   s   &    r.   r   #TestWelch.test_real_onesided_odd_32  s    HHR!!Q"299S>#-.HH "#&(4d3177"#r1   c                &   \         P                  ! ^R4      p^V^ &   ^V^&   \        V^RR7      w  r#\        V\	        ^R4      4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  4       R# 	r   r+   Fr   r@   r   r   Nr   r$   r%   r   r   r   r   r   rO   r(   s   &    r.   r   TestWelch.test_real_twosided_32  s}    HHR!!Q5971c?+HH "#&( 	4d3177"#r1   c                \   \         P                  ! ^R4      pRV^ &   RV^&   \        V^RR7      w  r#\        V\	        ^R4      4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  RVP                   R	VP                   24       R
# r   r   r@   Fr   r+   r   r   zdtype mismatch, , NrZ   )g%?A2q?d^?r|  g~?r|  r|  r{  rv  r(   s   &    r.   r   TestWelch.test_complex_32  s    HHR!!Q5971c?+HH FGJL4d3177""177)2aggY7	9r1   c                   \         P                  ! ^4      p^p\        VR4      RV^,          ^,            pVR;;,          R,          uu&   \        V^VR7      w  rE\        V^VR7      w  re\	        W44       \	        W64       ^p\        VR4      RV^,           ^,           p\        V^VR7      w  rE\        V^VR7      w  re\	        W44       \	        W64       R# rk  r@   Nr   r   r"   )r$   r%   r   r   r   )r)   r*   r   r+   fodd_fevens   &      r.   test_padded_freqsTestWelch.test_padded_freqs  s    HHRLD#za	*	"140AD1 !D#~A.140AD1 !r1   c           	     L   ^pRp\        V^
,          4      pRp\        WC,          V,          4      p\        P                  ! V4      V,          pV\        P                  ! ^\        P                  ,          V,          V,          4      ,          pR
 F  p\        WrW8RR7      w  r\        WrW8RR7      w  r\        W,          V^,          R,          4       \        \        P                  ! \        W4      4      V\        P                  ! ^4      ,          ^,          RR7       K  	  R	# )ri   g     @,  rF   )fsr   r   rH   rI   r!   gMbP?r   N)r   bartlett)tukey皙?flattop)	rP   r$   r:   sinpir   r   sqrtr   )r)   Ar  r   fsigiittr*   r   r  p_specfreqp_denss   &            r.   test_window_correction TestWelch.test_window_correction  s    b"f+r!"YYr]2bffQruuWT\"_%%EFa&02IA 7)24LD FJ1S1BGGIf$;<a
l1n!%' Fr1   c                   \         P                  P                  R 4       \         P                  P                  R4      p\	        V4      w  r#\        ^4       F  p^.^,          pRWT&   VP                  V4      p\	        WdR7      w  r'\	        WdVP                  ,
          R7      w  r(\        W7P                  4       VR7       \        W8P                  4       WFP                  ,
          R7       K  	  R# )     r~   err_msgNr"   )
r$   randomseedrandnr   rangeru   ndimr   squeeze)	r)   x_flatr  p_flatanewshaper*   p_plusp_minuss	   &        r.   test_axis_rollingTestWelch.test_axis_rolling  s    
		t&&M	qAtAvHHKx(Aa(IAqx0JA!11=!2AffHE r1   c                &   \         P                  ! ^4      p^V^ &   ^V^&   \        V^RR7      w  r#\        V\         P                  ! ^ R^4      4       \         P
                  ! . RO4      p\        W4RRR7       \        \        \        V^RR7       R# )	r   median)r   averager    r   r   zunrecognised-averageN)r  皙?        g&E    9r  )r$   r%   r   r   r&   r   rb   rc   r(   s   &    r.   test_averageTestWelch.test_average(  sv    HHRL!!Q842;;q#q12HH674d3j%A4	6r1   c                j   \         P                  ! . RO4      \         P                  ! ^4      ^r2p\        W2RRR7      p\	        V3RR/VB ^,          p\	        V3RR/VB ^,          p\        V^,          4      V,          \        \        V4      4      ^,          ,          p\        We,          V4       R# )znVerify the factor of ``sum(abs(window)**2)*fs / abs(sum(window))**2``
used in the `welch`  and `csd` docstrs. FN)r  r   r?   r  rH   rI   rF   )r@   r   r   r   )r$   r   r'   dictr   sumabsr   )r)   r*   r   r  paramsr  r  p_facs   &       r.   test_ratio_scale_toTestWelch.test_ratio_scale_to4  s     XXm,bggaj"Mq6)6v6q9q7*77:CFBSX!11/r1   r   N)'r   r   r   r   r/   r;   rC   rK   r   r   rW   r]   re   r  r   r,  r3  r;  r{   r   r   r   r   rU  rZ  rc  rg  rl  r   r   r   r   r  r  r  r  r  r   r   r   s   @r.   r   r      s     4444444409
,999J>1"//  3
*GI	$	$
$
9"$',F"
60 0r1   r   c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R  t"R! t#R" t$R# t%R$ t&R%t'V t(R&# )'TestCSDi>  c                $   \         P                  ! ^4      p\         P                  ! ^4      p\         P                  ! ^ R^4      p\         P                  ! ^\         P                  R7      p\	        W^R7      w  rV\        W54       \        WF4       R# )rL  r    rN   r   Nr$   r%   r&   r\   r   r   r)   r*   yr+   cr  c1s   &      r.   test_pad_shorter_xTestCSD.test_pad_shorter_x?  s`    HHQKHHRLKK3"HHQR]]+Q2&r1   c                $   \         P                  ! ^4      p\         P                  ! ^4      p\         P                  ! ^ R^4      p\         P                  ! ^\         P                  R7      p\	        W^R7      w  rV\        W54       \        WF4       R# )rk  r    rN   r   Nr  r  s   &      r.   test_pad_shorter_yTestCSD.test_pad_shorter_yJ  s`    HHRLHHQKKK3"HHQR]]+Q2&r1   c                   \         P                  ! . RO^4      p\        \        V4      R^R7      p\        P
                  ! V\         P                  ! V4      3/ VB ^,          p\        P
                  ! WR,          3/ VB ^,          p\        P
                  ! VR,          V3/ VB ^,          p\        WC^,          4       \        WS^,          4       R# )zzTest zero-padding for input `x.shape[axis] != y.shape[axis]` for 1d arrays.

This test ensures that issue 23036 is fixed.
boxcar)r  r   r   :NrL  NN)r`   r   r   )r$   tiler  lenr	   r   copyr
   )r)   r*   kwX0X1X2s   &     r.   test_unequal_length_input_1D$TestCSD.test_unequal_length_input_1DU  s    
 GGM1%SVHa8ZZ2771:,,Q/ZZR5'B'*ZZ"q'B'*F#F#r1   c                   ^p\         P                  ! ^V,          4      P                  ^V^4      pWR&   \        VRVR^R7      p\        P
                  ! W"P                  4       3/ VB ^,          p\        P
                  ! W"R,          3/ VB ^,          p\        P
                  ! VR,          V3/ VB ^,          p\        WT4       \        Wd4       R# )zzTest zero-padding for input `x.shape[axis] != y.shape[axis]` for 3d arrays.

This test ensures that issue 23036 is fixed.
r  N)r  r   r   r  r   )rj   r   rj   )rj   :Nrl   Nrj   )r$   r%   ru   r  r	   r   r  r
   )r)   nr*   r  r  r  r  s   &      r.   test_unequal_length_input_3D$TestCSD.test_unequal_length_input_3Dc  s    
 HHUQY''1a0'
QxDqIZZ668*r*1-ZZX;-"-a0ZZ(Q-"-a0r1   c                    \         P                  ! ^4      p^V^ &   ^V^&   \        W^R7      w  r#\        V\         P                  ! ^ R^4      4       \         P
                  ! . RO4      p\        W4RRR7       R# r   r$   r%   r   r   r&   r   r(   s   &    r.   r/   TestCSD.test_real_onesided_evens  se    HHRL!!1#2;;q#q12HH " #4d3r1   c                    \         P                  ! ^4      p^V^ &   ^V^&   \        W^	R7      w  r#\        V\         P                  ! R4      R,          4       \         P
                  ! . RO4      p\        W4RRR7       R# r   )r$   r%   r   r   r:   r   r(   s   &    r.   r;   TestCSD.test_real_onesided_odd}  se    HHRL!!1#299S>#-.HH " #4d3r1   c                    \         P                  ! ^4      p^V^ &   ^V^&   \        W^RR7      w  r#\        V\	        ^R4      4       \         P
                  ! . RO4      p\        W4RRR7       R# r   )r$   r%   r   r   r   r   r(   s   &    r.   rC   TestCSD.test_real_twosided  sb    HHRL!!1E:71c?+HH F G4d3r1   c                    \         P                  ! ^4      p^V^ &   ^V^&   \        W^RR7      w  r#\        V\         P                  ! ^ R^4      4       \         P
                  ! . RO4      p\        W4RRR7       R# r   r  r(   s   &    r.   rK   TestCSD.test_real_spectrum  sg    HHRL!!1J72;;q#q12HH " #4d3r1   c                    \         P                  ! ^\        R7      p^V^ &   ^V^&   \        W^R7      w  r#\	        V\         P
                  ! ^ R^4      4       \         P                  ! . RO4      p\	        W4RRR7       R# r   )r$   r%   rP   r   r   r&   r   r(   s   &    r.   r   "TestCSD.test_integer_onesided_even  sh    HHRs#!!1#2;;q#q12HH " #4d3r1   c                
   \         P                  ! ^\        R7      p^V^ &   ^V^&   \        W^	R7      w  r#\	        V\         P
                  ! R4      R,          4       \         P                  ! . RO4      p\	        W4RRR7       R# r   )r$   r%   rP   r   r   r:   r   r(   s   &    r.   r   !TestCSD.test_integer_onesided_odd  sh    HHRs#!!1#299S>#-.HH " #4d3r1   c                    \         P                  ! ^\        R7      p^V^ &   ^V^&   \        W^RR7      w  r#\	        V\        ^R4      4       \         P                  ! . RO4      p\	        W4RRR7       R# r   )r$   r%   rP   r   r   r   r   r(   s   &    r.   rW   TestCSD.test_integer_twosided  se    HHRs#!!1E:71c?+HH F G4d3r1   c                    \         P                  ! ^\         P                  4      pRV^ &   RV^&   \        W^RR7      w  r#\	        V\        ^R4      4       \         P                  ! . RO4      p\	        W4RRR7       R# r  )r$   r%   r\   r   r   r   r   r(   s   &    r.   r]   TestCSD.test_complex  si    HHR'!!1E:71c?+HH F G4d3r1   c           	         \        \        \        \        P                  ! ^\        P
                  4      \        P                  ! ^\        P
                  4      R^R7       R# r  )rb   rc   r   r$   r%   r\   r'   rd   s   &r.   re   TestCSD.test_unk_scaling  s6    j#rxx2=='Agga/	Kr1   c                    \         P                  ! ^
\         P                  R7      R,           p\        W^
RR7      w  r#\	        V\         P
                  ! V4      RR7       R# r  r$   r:   rt   r   r   r  r  s   &   r.   r  TestCSD.test_detrend_linear  s@    IIb

+d21X62==+%8r1   c                    \         P                  ! ^
\         P                  R7      R,           p\        W^
RR7      w  r#\        W^
R R7      w  rE\	        W$RR7       \	        W5RR7       R# )	rn   rN   r  Fr  c                     V # r  r   r  s   &r.   r  ,TestCSD.test_no_detrending.<locals>.<lambda>  s    r1   r6   r7   N)r$   r:   rt   r   r   r  s   &     r.   r   TestCSD.test_no_detrending  sO    IIb

+d2Q2u5Q2{;U+U+r1   c                    \         P                  ! ^
\         P                  R7      R,           p\        W^
R R7      w  r#\	        V\         P
                  ! V4      RR7       R# )rn   rN   r  c                 2    \         P                  ! V R R7      # r$  r'  r(  s   &r.   r  /TestCSD.test_detrend_external.<locals>.<lambda>      v~~c'Dr1   r  r6   r7   Nr  r  s   &   r.   r,  TestCSD.test_detrend_external  sD    IIb

+d21DF2==+%8r1   c                    \         P                  ! ^(\         P                  R7      R,           pVP                  R4      p\	        W^
R R7      w  r#\        V\         P                  ! V4      RR7       R# )	r/  rN   r  c                 2    \         P                  ! V R R7      # r$  r'  r(  s   &r.   r  5TestCSD.test_detrend_external_nd_m1.<locals>.<lambda>  r  r1   r  r6   r7   Nr2  )r$   r:   rt   ru   r   r   r  r  s   &   r.   r3  #TestCSD.test_detrend_external_nd_m1  sR    IIb

+d2IIh1DF2==+%8r1   c                   \         P                  ! ^\         P                  R7      R,           pVP                  R4      p\         P                  ! V^^ 4      p\        W^
^ R R7      w  r#\        V\         P                  ! V4      RR7       R# )	ri   rN   r  c                 4    \         P                  ! V ^ RR7      # r7  r'  r(  s   &r.   r  4TestCSD.test_detrend_external_nd_0.<locals>.<lambda>  s    v~~c'Lr1   r9  r6   r7   Nrk   )r$   r:   rt   ru   r:  r   r   r  r  s   &   r.   r;  "TestCSD.test_detrend_external_nd_0  sf    IIb

+d2IIhKK1a 1!LN2==+%8r1   c                   \         P                  ! ^\         P                  R7      R,           pVP                  R4      p\	        W^
R7      w  r#\        VP                  R	4       \        VR
,          VR,          RRR7       \	        VR
,          VR
,          ^
R7      w  rE\        V\         P                  R3,          VR,          RRR7       R# r>  )	r$   r:   rt   ru   r   r   rv   r   rw   rx   s   &     r.   r{   TestCSD.test_nd_axis_m1  s    IIb

+d2IIh1$177I.%!E(UCQuXqx42::a<(!C&u5Ir1   c                n   \         P                  ! ^\         P                  R7      R,           pVP                  R4      p\	        W^
^ R7      w  r#\        VP                  R	4       \        VR
,          VR,          RRR7       \	        VR
,          VR
,          ^
R7      w  rE\        WSR,          RRR7       R# rB  )r$   r:   rt   ru   r   r   rv   r   rx   s   &     r.   r   TestCSD.test_nd_axis_0  s    IIb

+d2IIh1!,177G,%!E(UCQuXqx4eH5u=r1   c           
     j   \         P                  ! ^4      p^V^ &   ^V^&   \        W^
R^4      w  r#\        P                  ! R^4      p\        W^
VRR7      w  rV\        W64       \        W%4       \        VP                  R4       \        VP                  R4       \        \        \        W^
VRR7       \        P                  ! R^ 4      p\        \        \        W^
VRR7       \        P                  ! \        RR7      ;_uu_ 4        \        W^ ^ R7       RRR4       R#   + '       g   i     R# ; i)r   r   Nr   rN  zParameter nperseg=0.*r   rE  )r$   r%   r   r	   r   r   r   rv   rb   rc   r   r   r   s   &       r.   r   TestCSD.test_window_external  s    HHRL!!1VQ'*Q2sD1&q-&q-288T*288T*j#q#s	,##FB/j#q'4	)]]:-DEEa# FEEEs   D!!D2	c                   \        . \        P                  ! ^
4      4      w  r\        VP                  R4       \        VP                  R4       \        \        P                  ! ^
4      . 4      w  r\        VP                  R4       \        VP                  R4       R Fe  p\        \        P
                  ! V4      \        P
                  ! V4      4      w  r\        VP                  V4       \        VP                  V4       Kg  	  \        \        P                  ! ^
4      \        P
                  ! R4      4      w  r\        VP                  R4       \        VP                  R4       \        \        P
                  ! R4      \        P                  ! ^
4      4      w  r\        VP                  R4       \        VP                  R4       R# )rn   Nr   r   )r   r   )r   r$   r%   r   rv   r   r'   r   s   &   r.   r   TestCSD.test_empty_input  s    2bhhrl#177D)177D)288B<#177D)177D)+Erxx8DAqww.qww. ,
 2772;0177E*177E*288E?BGGBK0177E*177E*r1   c                p   R Fg  p\        \        P                  ! V4      \        P                  ! V4      ^R7      w  r#\        VP                  V4       \        VP                  V4       Ki  	  \        \        P                  ! R4      \        P
                  ! R4      ^R7      w  r#\        VP                  R4       \        VP                  R4       \        \        P                  ! R4      \        P
                  ! R4      ^R7      w  r#\        VP                  R4       \        VP                  R4       R# )r   r~   Nr   )rn   rn   r   )rn   r   rm   )rn   r   r   )r   r$   r   r   rv   r%   r   s   &   r.   r   #TestCSD.test_empty_input_other_axis#  s    %Erxxa@DAqww.qww. &
 288I&(:C177H-177H-288H%rxx	':C177H-177H-r1   c           	        \         P                  ! ^4      p^V^ &   \        P                  ! 4       ;_uu_ 4        \        P                  ! RR\
        4       \        WRR7      w  r#\        WRRR7      w  rERRR4       \        W^R7      w  rg\        XV4       \        XV4       \        XV4       \        XV4       R#   + '       g   i     LQ; i)	rL  rM  z+nperseg=256 is greater than signal length.*r   r   rN  rO  Nr   )r$   r%   rP  rQ  rR  rS  r   r   rT  s   &       r.   rU  TestCSD.test_short_data1  s    HHQK! $$&&##GVqF+DAfc:FB	 '
 Q1%22BB '&rW  c                x   \        \        \        \        P                  ! ^4      \        P
                  ! ^4      ^\        P                  ! . RO4      4       \        \        \        \        P                  ! ^4      \        P
                  ! ^4      ^\        P                  ! ^4      P                  R4      4       R# rY  )	rb   rc   r   r$   r%   r'   r   r:   ru   rd   s   &r.   rZ  TestCSD.test_window_long_or_ndB  sh    j#rxx{BGGAJhh{+	-j#rxx{BGGAJiil**51	3r1   c                    \         P                  ! ^@4      p^VR&   \        W^^R7      w  r#\         P                  ! . RO4      p\	        W4RR7       R# r]  )r$   r%   r   r   r   r(   s   &    r.   rc   TestCSD.test_nondefault_noverlapH  sE    HHRL#1a0HH  5)r1   c           
         \        \        \        \        P                  ! ^4      \        P
                  ! ^4      ^R^^4       R# rf  )rb   rc   r   r$   r%   r'   rd   s   &r.   rg  TestCSD.test_bad_noverlapP  s+    j#rxx{BGGAJ6	r1   c           	         \        \        \        \        P                  ! ^4      \        P
                  ! ^4      ^^R7       R# rj  )rb   rc   r   r$   r'   r%   rd   s   &r.   rl  TestCSD.test_nfft_too_shortT  s'    j#rwwr{BHHRLq	!r1   c                    \         P                  ! \        R R7      ;_uu_ 4        \        \        P
                  ! R4      \        P
                  ! R4      ^R7       RRR4       R#   + '       g   i     R# ; i)zx and y cannot be broadcast.*r   r   N)rm   rL  rm   )rl   rL  )r   r   rc   r   r$   r'   rd   s   &r.   test_incompatible_inputs TestCSD.test_incompatible_inputsX  sA    ]]:-LMM	"BGGFOQ? NMMMs   7A&&A7	c                <   \         P                  ! ^R4      p^V^ &   ^V^&   \        W^R7      w  r#\        V\         P                  ! ^ R^4      4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  4       R# ro  )r$   r%   r   r   r&   r   r   rO   r(   s   &    r.   r   "TestCSD.test_real_onesided_even_32]  s    HHR!!1#2;;q#q12HH "#&(4d3177"#r1   c                F   \         P                  ! ^R4      p^V^ &   ^V^&   \        W^	R7      w  r#\        V\         P                  ! R4      R,          4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  4       R# rr  )r$   r%   r   r   r:   r   r   rO   r(   s   &    r.   r   !TestCSD.test_real_onesided_odd_32h  s    HHR!!1#299S>#-.HH "#&(4d3177"#r1   c                &   \         P                  ! ^R4      p^V^ &   ^V^&   \        W^RR7      w  r#\        V\	        ^R4      4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  4       R# ru  r$   r%   r   r   r   r   r   rO   r(   s   &    r.   r   TestCSD.test_real_twosided_32s  s}    HHR!!1E:71c?+HH "#&( 	4d3177"#r1   c                \   \         P                  ! ^R4      pRV^ &   RV^&   \        W^RR7      w  r#\        V\	        ^R4      4       \         P
                  ! . ROR4      p\        W4RRR7       \        VP                  VP                  8H  RVP                   R	VP                   24       R
# ry  r  r(   s   &    r.   r   TestCSD.test_complex_32  s    HHR!!1E:71c?+HH FGJL4d3177""177)2aggY7	9r1   c                   \         P                  ! ^4      p\         P                  ! ^4      p^p\        VR4      RV^,          ^,            pVR;;,          R,          uu&   \	        W^VR7      w  rV\	        W^VR7      w  rv\        WE4       \        WG4       ^p\        VR4      RV^,           ^,           p\	        W^VR7      w  rV\	        W^VR7      w  rv\        WE4       \        WG4       R# r  )r$   r%   r'   r   r   r   )r)   r*   r  r   r+   r  r  r  s   &       r.   r  TestCSD.test_padded_freqs  s    HHRLGGBKD#za	*	"aAD1qQT2 !D#~A.aAD1qQT2 !r1   c                   \         P                  P                  ^@4      pVP                  4       p\	        W^RRR7      w  r4\	        W^RRR7      w  r5\        WE4       \	        W^RRR7      w  r4\	        W^RRR7      w  r5\        WE4       R# )r^  meanF)r   r  r?   r  N)r$   r  r  r  r   r   )r)   r*   r  r  p_samep_copieds   &     r.   test_copied_dataTestCSD.test_copied_data  s    IIOOBFFHa(-/	!6*/1)a(-/	!8*/1)r1   r   N))r   r   r   r   r  r  r  r  r/   r;   rC   rK   r   r   rW   r]   re   r  r   r,  r3  r;  r{   r   r   r   r   rU  rZ  rc  rg  rl  r  r   r   r   r   r  r&  r   r   r   s   @r.   r  r  >  s     		$  44444444K9
,999J>$&+,. "3*!@
	$	$
$
9"&* *r1   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )TestCoherencei  c                   \         P                  P                  ^4      p\         P                  ! V4      p\         P                  ! ^ R^4      p\         P
                  ! ^4      p\        W^
R7      w  rV\        W54       \        WF4       R# ri   r    r   N)r$   r  r  r  r&   r'   r   r   r)   r*   r  r+   Cr  C1s   &      r.   test_identical_input"TestCoherence.test_identical_input  s^    IIOOBGGAJKK3"GGAJ1,r1   c                    \         P                  P                  ^4      pV) p\         P                  ! ^ R^4      p\         P                  ! ^4      p\        W^
R7      w  rV\        W54       \        WF4       R# r+  )r$   r  r  r&   r'   r   r   r,  s   &      r.   test_phase_shifted_input&TestCoherence.test_phase_shifted_input  sX    IIOOBBKK3"GGAJ1,r1   r   N)r   r   r   r   r/  r2  r   r   r   s   @r.   r)  r)    s     		 	r1   r)  c                   2   a  ] tR tRt o R tR tR tRtV tR# )TestSpectrogrami  c                    \         P                  P                  R 4      pRpRp^p^p\        WW4V4      w  rgp\	        WW4V4      w  r\        Wi4       \        \         P                  ! VRR7      V
4       R# )r  r@   r~   Nr  g      ?r"   )r$   r  r  r   r   r   r#  )r)   r*   r  r   r   r`  r+   r  PfwPws   &          r.   test_average_all_segments)TestSpectrogram.test_average_all_segments  sg    IIOOD! aVh?aqfx8+R0r1   c           	        \         P                  P                  R 4      pRpRp^p^p\        WW4V4      w  rgp\        P
                  ! R^4      p	\        WV	R^R7      w  rp\        V
P                  R4       \        VP                  R4       \        \        \        VW)^R7       \        P
                  ! RR4      p\        \        \        VW,RR7       R# )	r  r@   Nr_  r   i   r7  )	   )r>  I   )
r$   r  r  r   r	   r   r   rv   rb   rc   )r)   r*   r  r   r   r`  r+   r  r8  r   r   Per   s   &            r.   r   $TestSpectrogram.test_window_external  s    IIOOD! aVh?a4sD1E	r288T*288V,j+qq	*##OT:j+q4	1r1   c           	        \         P                  P                  R 4      pRp\        WR
R7      w  r4p\        P
                  ! 4       ;_uu_ 4        \        P                  ! RR\        4       \        WR
RR7      w  rdpRRR4       \        WRR	7      w  rp	\        WR R	7      w  rp\        W84       \        WY4       \        XV
4       \        XV4       R#   + '       g   i     L`; i)r  r@   r   rM  zInperseg = 1025 is greater than input length  = 1024, using nperseg = 1024i  rO  NrN  r   r7  )	r$   r  r  r   rP  rQ  rR  rS  r   )r)   r*   r  r+   r  r,   r  r  r  r  f3p3s   &           r.   rU  TestSpectrogram.test_short_data  s    IIOOD! aN;a$$&&##'	 $A.,02IB2 '  s3	rt4	rBB '&s   .CC%	r   N)	r   r   r   r   r;  r   rU  r   r   r   s   @r.   r5  r5    s     11&   r1   r5  c                     a  ] tR tRt o R tR t]P                  P                  R4      R 4       t	R t
R tR tR	 tR
 tR tR tR tR tR t]P                  P                  R4      R 4       tR tR t]P                  P                  R4      R 4       tR t]P                  P                  R4      R 4       tRtV tR# )TestLombscarglei  c           
     T   RpRpR\         P                  ,          p^dpRpRp\         P                  P                  R4      pVP	                  V4      p\         P
                  ! R\         P                  ,          R\         P                  ,          V4      W8  ,          p	V\         P                  ! W),          V,           4      ,          p
\         P
                  ! RRV4      p\        WV4      pV^,          V^ ,          ,
          pW+\         P                  ! V4      ,          ,
          VR,          8  g   Q h\        WV\         P                  ! WP                  R	7      R
7      pV^,          V^ ,          ,
          pW+\         P                  ! V4      ,          ,
          VR,          8  g   Q hR# )zWTest if frequency location of peak corresponds to frequency of
generated input signal.
r!   r@   r      ffffff?# {Gz?      $@rN   weightsN)r$   r  r  RandomStaterandr&   r  r   argmax	ones_likerO   )r)   amplwphininnoutr,   rngrtr  r+   r8  deltas   &             r.   test_frequencyTestLombscargle.test_frequency   s8    BEEk ii##G,HHSMKKRUU
CIs3AF; 266!#)$$ KKc4( a  !qtRYYq\?"eBh/0/ aaww)GH !qtRYYq\?"eBh/0/r1   c                r   R pRpR\         P                  ,          pRpRpRp\         P                  P                  R4      pVP	                  V4      p\         P
                  ! R\         P                  ,          R\         P                  ,          V4      W8  ,          p	V\         P                  ! W),          V,           4      ,          p
\         P
                  ! RRV4      p\        WV4      p\         P                  ! RV,          V	P                  ^ ,          ,          4      p\        WV8H  ,          VR	R
7       R# )r!   r@   r    rI  rJ  rK  rL  rM  g      @r  r  N)r$   r  r  rP  rQ  r&   r  r   r  rv   r   )r)   rT  rU  rV  rW  rX  r,   rY  rZ  r[  r  r+   pgrams   &            r.   test_amplitudeTestLombscargle.test_amplitude(  s    
 BEEk ii##G,HHSMKKRUU
CIs3AF; 266!#)$$ KKc4( A!$ eaggaj01 	dT5r1   zignore::DeprecationWarningc                   R pRpR\         P                  ,          p^dpRpRpRp\         P                  P                  R4      pVP	                  V4      p	\         P
                  ! R\         P                  ,          R\         P                  ,          V4      W8  ,          p
V\         P                  ! W*,          V,           4      ,          V,           p\         P
                  ! RRV4      p\        WVR	R
7      p\        WVP                  4       ,
          VRR
7      p\        W4       \        WVR	R	R7      p\        WVP                  4       ,
          VRR	R7      p\        W4       R# )r!   r@   r    rI  rJ  333333?rK  rL  rM  T	precenterF)rf  floating_meanN)
r$   r  r  rP  rQ  r&   r  r   r#  r   )r)   rT  rU  rV  rW  rX  r,   offsetrY  rZ  r[  r  r+   r`  pgram2s   &              r.   test_precenterTestLombscargle.test_precenterI  s    BEEk ii##G,HHSMKKRUU
CIs3AF; 266!#)$$v- KKc4( A!t4QAFFHa5A 	&
 A!t4HQAFFHa5PTU 	&r1   c                J   R pRpR\         P                  ,          p^dpRpRp\         P                  P                  R4      pVP	                  V4      p\         P
                  ! R\         P                  ,          R\         P                  ,          V4      W8  ,          p	V\         P                  ! W),          V,           4      ,          p
\         P
                  ! RRV4      p\        WV4      p\        WVRR	7      p\         P                  ! V	4      \        V	P                  ^ ,          4      ,          pW,          V
,          P                  4       pTp^VV	P                  ^ ,          ,          ,          p\        VV,          V4       \        \         P                  ! V4      R4       R
# )r!   r@   r    rI  rJ  rK  rL  rM  T	normalizeN)r$   r  r  rP  rQ  r&   r  r   rS  floatrv   r  r   max)r)   rT  rU  rV  rW  rX  r,   rY  rZ  r[  r  r+   r`  ri  rO  YY_hatYYscale_to_uses   &                 r.   test_normalizeTestLombscargle.test_normalizer  s4    BEEk ii##G,HHSMKKRUU
CIs3AF; 266!#)$$ KKc4( A!$Q15 ,,q/%
"33+/&&("QWWQZ-( 	,f5v,r1   c           	        \         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      R,           p\        \        \        WV4       \         P
                  ! \         P                  ! \         P                  ! ^ ^^4      ^4      ^^R7      p\         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      R,           p\        \        \        WV4       \         P                  ! ^ ^^4      p\         P
                  ! \         P                  ! \         P                  ! ^ ^^4      ^4      ^^R7      p\         P                  ! ^ ^^4      R,           p\        \        \        WV4       \         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      p\         P
                  ! \         P                  ! \         P                  ! ^ ^^4      ^4      R,           ^^R7      p\        \        \        WV4       \         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      R,           p\         P
                  ! \         P                  ! \         P                  ! ^ ^^4      ^4      ^^R7      p\        \        \        WW4R7       R# )r   r  r~   rN  N)r$   r&   rb   rc   r   repeatexpand_dimsr)   r[  r  r+   rO  s   &    r.   test_wrong_shape TestLombscargle.test_wrong_shape  s    KK1a KK1a KK1a 3&j+qQ7 IIbnnR[[Aq%91=qqIKK1a KK1a 3&j+qQ7 KK1a IIbnnR[[Aq%91=qqIKK1a 3&j+qQ7 KK1a KK1a IIbnnR[[Aq%91=CQQOj+qQ7 KK1a KK1a KK1a 3&))BNN2;;q!Q+?CQQOj+qQHr1   c                   \         P                  ! ^ ^
RRR7      p\         P                  ! ^V,          4      p\         P                  ! ^ ^2RRR7      R,           p\        WV^,          \         P                  ,          4       R# )r   rI  F)endpointi  r  N)r$   r&   r  r   r  )r)   r[  r  r+   s   &   r.   test_lombscargle_atan_vs_atan2.TestLombscargle.test_lombscargle_atan_vs_atan2  sX     KK2te4FF1Q3KKK2sU3c9A!A#bee)$r1   c           	        \         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      p\         P                  ! ^ ^^4      R,           p\         P                  ! ^^^4      p\        \        \        WW4R7       R# )r   r  rN  N)r$   r&   rb   rc   r   ry  s   &    r.   test_wrong_shape_weights(TestLombscargle.test_wrong_shape_weights  s_     KK1a KK1a KK1a 3&++aA&j+qQHr1   c           	         \         P                  ! ^4      p\         P                  ! ^4      p\         P                  ! ^4      p\         P                  ! ^4      p\        \        \
        WW4R7       R# rm   rN  Nr$   r%   r'   rb   rc   r   ry  s   &    r.   test_zero_division_weights*TestLombscargle.test_zero_division_weights  sF     HHQKHHQKGGAJ((1+j+qQHr1   c           	     n   R pRp^ p^dpRpRp\         P                  P                  R4      pVP                  V4      p\         P                  ! R\         P
                  ,          R\         P
                  ,          V4      W8  ,          p	V\         P                  ! W),          V,           4      ,          p
\         P                  ! RRV4      p\        WVRR7      p\        WVR	R7      p\        WVR
R7      p\        WVRR7      p\        WVRR7      p\        W4       \        W4       \         P                  ! V
4      \        V
P                  ^ ,          4      ,          pVV
,          V
,          P                  4       pTp\        VR ,          \        V	P                  ^ ,          4      V,          ,          V4       \         P                  ! W8H  4      ^ ,          ^ ,          p\        \         P                  ! VV,          4      V4       \        \         \        WVRR7       \        \         \        WV^R7       R# )r!   r@   rI  rJ  rK  rL  rM  Frm  Tpowerrn  	amplitudelombN)r$   r  rP  rQ  r&   r  r  r   r   rS  ro  rv   r  wherer  rb   rc   )r)   rT  rU  rV  rW  rX  r,   rY  rZ  r[  r  r+   pgram_false
pgram_truepgram_power
pgram_norm	pgram_amprO  rq  rr  f_is   &                    r.   test_normalize_parameter(TestLombscargle.test_normalize_parameter  s     ii##G,HHSMKKRUU
CIs3AF; 266!#)$$ KKc4( "!U; qD9
!!W= qK@
a;?	 	1
/ ,,q/%
"33A+/&&(c)U1771:->-CDjQ hhqtnQ"y~.5 	j+qQ&Ij+qQ!Dr1   c                "   R pRpR\         P                  ,          p^dpRpRpRp\         P                  P                  R4      pVP	                  V4      p	\         P
                  ! R\         P                  ,          R\         P                  ,          V4      W8  ,          p
V\         P                  ! W*,          V,           4      ,          p\         P
                  ! RRV4      p\        WVR	R
7      p\        WV,           VR	R
7      p\        W4       R# )r!   r@   r    rI  rJ  333333@rK  rL  rM  T)rg  N)	r$   r  r  rP  rQ  r&   r  r   r   r)   rT  rU  rV  rW  rX  r,   rh  rY  rZ  r[  r  r+   r`  pgram_offsets   &              r.   test_offset_removal#TestLombscargle.test_offset_removal  s    
 BEEk ii##G,HHSMKKRUU
CIs3AF; 266!#)$$ KKc4( A!48"1&j!4H 	,r1   c                &   R pRp^ pRpRpRp^p\         P                  P                  R4      pVP                  V4      p	\         P                  ! R\         P
                  ,          R\         P
                  ,          V4      W8  ,          p
V\         P                  ! W*,          V,           4      ,          p\         P                  ! RRV4      p\        WVRRR	7      p\        WV,           VRRR	7      pV^ ,          R8  g   Q hV^ ,          R
8  g   Q hR# )r!   r@   rI  rJ  rK  rL  rM  TFrn  rg  r    Nr$   r  rP  rQ  r&   r  cosr   r  s   &              r.   test_floating_mean_false(TestLombscargle.test_floating_mean_false!  s      ii##G,HHSMKKRUU
CIs3AF; 266!#)$$ KKc4( A!t5I"1&j!t168
 Qx$A$%$r1   c                   R pRpRp^dpRpRpRp\         P                  P                  R4      pVP                  V4      p	\         P                  ! R\         P
                  ,          R\         P
                  ,          V4      W8  ,          p
V\         P                  ! W*,          V,           4      ,          V,           p\         P                  ! RRV4      p\         P                  ! W8H  4      ^ ,          ^ ,          p\        WVR	R
R7      p\        \         P                  ! W,          4      V4       \        \         P                  ! W,          4      ) V4       R# )r!   r@   Q?rI  rJ  r  rK  rL  rM  r  Tr  N)r$   r  rP  rQ  r&   r  r  r  r   r   r  angle)r)   rT  rU  rV  rW  rX  r,   rh  rY  rZ  r[  r  r+   f_indxr`  s   &              r.   test_amplitude_is_correct)TestLombscargle.test_amplitude_is_correctC  s     ii##G,HHSMKKRUU
CIs3AF; 266!#)$$v- KKc4( !$"1% A!{$O 	u}-t4 	%-00#6r1   c           	         \         P                  ! ^4      p\         P                  ! ^4      p\         P                  ! ^4      p\         P                  ! ^4      ) p\        \        \
        WW4R7       R# r  r  ry  s   &    r.   test_negative_weight$TestLombscargle.test_negative_weightg  sH     HHQKHHQKGGAJ771:+j+qQHr1   c                `   . R NRNRNRNRNRNRNRNRNR	NR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0NR1NR2NR3NR4NR5NR6NR7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNRHNRINRJNRKNRLNRMNRNNRONRPNRQNRRNRSNRTNRUNRVNRWNRXNRYNRZNR[NR\NR]NR^NR_NR`NRaNRbNRcNRdNReNRfNRgNRhNRiNRjNRkNRlNRmNRnNRoNRpNRqNRrNRsNRtNRuNRvNRwNRxNp. RyNRzNR{NR|NR}NR~NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNp\         P                  ! R^xR4      p^\         P                  ,          V,          p\        WVRRR7       R# )g   ˈAg   ˈAg   ̈Ag   ͈Ag   ΈAg   ψAg   ЈAg   шAg   ҈Ag   ӈAg   ԈAg   ՈAg   ֈAg   ׈Ag   ؈Ag   وAg   ڈAg   ۈAg   ܈Ag   ݈Ag   Ag   Ag   Ag   Ag   Ag    Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag    Ag   Ag   Ag   "Ag   Ag   Ag   Ag   
Ag   Ag   Ag   Ag    Ag   !Ag   "Ag   #Ag   $Ag   %Ag   &Ag   'Ag   (Ag   )Ag   *Ag   +Ag   ZcAg   TdAg   NeAg   HfAg   BgAg   <hAg   6iAg   0jAg   *kAg   $lAg   mAg   nAg   oAg   pAg   qAg    rAg   rAg   sAg   tAg   uAg   wAg   xAg   yAg   zAg   {Ag   |Ag   }Ag   ~Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag   |Ag   vAg   pAg   jAg   Ag   
Ag   Ag   Ag   Ag   Ag   잉Ag   柉Ag   ࠉAg   ڡAg   ԢAg   ΣAg   ȤAg   ¥Ag   Ag   Ag   Ag   Ag   Ag   Ag   Ag     @@g     ܨ@g     J@g     @g     9@g     @g     @g     2@g    @g     @g     i@g     @g    j@g    @g     @g    @g     @g     @g    ?@g    @g     n@g     ײ@g     .@g     @g     h@g     @g     ޫ@g     Ӱ@g     >@g     @g     @g     b@g     @g    H@g    @g     @g    @g    d@g     @g    @g     p@g     ̳@g     m@g     D@g     ҧ@g     @g     @g     @g     G@g     @g     @g     _@g     @g    @g    @g     "@g    @g    @g     M@g     n@g    @g     @g     0@g     @g      @g    D@g     w@g     9@g     y@g     µ@g     6@g     @g     \@g     F@g     @g     Ь@g     k@g     @g     @g     V@g     @g     @g     D@g    @g    J@g    @g     @g     @g    @g    @g    3@g    @g    @g    @g     @g     @g    s@g    @g    :@g    b@g     @g     @g     p@g     @g     @g     @g     Q@g     @g     \@g     !@g     @g    j@g     @g    F@g    @g    @g    @g     e@g    @g     @g    @i  rI  T)rf  rn  N)r$   r&   r  r   )r)   r[  r  periodsangular_freqs   &    r.   test_list_inputTestLombscargle.test_list_inputp  s	   
^ ^ ^ ^ *,:<J*,:<J  + -; =K 	 +	 -;	 =K	
 
 +
 -;
 =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  !  +!  -;!  =K!" #" +#" -;#" =K#$ %$ +%$ -;%$ =K%& '& +'& -;'& =K'( )( +)( -;)( =K)* +* ++* -;+* =K+, -, +-, -;-, =K-. /. +/. -;/. =K/0 10 +10 -;10 =K12 32 +32 -;32 =K34 54 +54 -;54 =K56 76 +76 -;76 =K78 98 +98 -;98 =K9: ;: +;: -;;: =K;< =>^ ^ ^ ^ *,:<J*,:<J  + -; =K 	 +	 -;	 =K	
 
 +
 -;
 =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  + -; =K  !  +!  -;!  =K!" #" +#" -;#" =K#$ %$ +%$ -;%$ =K%& '& +'& -;'& =K'( )( +)( -;)( =K)* +* ++* -;+* =K+, -, +-, -;-, =K-. /. +/. -;/. =K/0 10 +10 -;10 =K12 32 +32 -;32 =K34 54 +54 -;54 =K56 76 +76 -;76 =K78 98 +98 -;98 =K9: ;: +;: -;;: =K;< =@ ++c3-255y7*A,$$Gr1   c                   R pRpRp^dpRpRp^ p\         P                  P                  R4      pVP                  V4      p	\         P                  ! R\         P
                  ,          R\         P
                  ,          V4      W8  ,          p
V\         P                  ! W*,          V,           4      ,          V,           p\         P                  ! ^ RV4      p\        WVRRR	7      pV^ ,          R
8  g   Q hR# )r!   r@   r  i  rJ  rK  rL  rM  Tr  -C6?Nr  )r)   rT  rU  rV  rW  rX  r,   rh  rY  rZ  r[  r  r+   r`  s   &             r.   test_zero_freqTestLombscargle.test_zero_freq  s    
  ii##G,HHSMKKRUU
CIs3AF; 266!#)$$v- KK3% A!t4H Qx$r1   c                   \        ^ ^ 4       Uu. uF  q^,           NK  	  upp\        P                  ! \        V4      4      pR\        P                  ,          .^,          p\        WV4       \        ^ ^ 4       Uu. uF  q^,          ^,           NK  	  upp\        P                  ! \        V4      4      p\        P                  R,          .^,          p\        WV4       R# u upi u upi )r   r!   N)r  r$   r'   r  r  r   )r)   r[  r  freqss   &   r.   test_simple_div_zero$TestLombscargle.test_simple_div_zero  s    
 "!RL)LqUUL)GGCFORUUaA%  $Arl+lqS1WWl+GGCFOsaA%  * ,s   C";C'c                   R pRpR\         P                  ,          p^dpRpRp\         P                  P                  4       pVP                  V4      p\         P                  ! R\         P                  ,          R\         P                  ,          V4      W8  ,          p	V\         P
                  ! W),          V,           4      ,          p
\         P                  ! RRV4      p\         P                  ! V
4      pV	P                  4       pV
P                  4       pVP                  4       pVP                  4       p\        WVRVR7       \        W4       \        W4       \        W4       \        VV4       R	# )
r!   r@   r    rI  rJ  rL  rM  T)rf  rO  N)
r$   r  r  default_rngr&   r  rS  r  r   r   )r)   rT  rU  rV  rW  rX  r,   rY  rZ  r[  r  r+   rO  t_orgy_orgf_orgweights_orgs   &                r.   test_input_mutation#TestLombscargle.test_input_mutation  s    BEEk ii##%JJsOKKRUU
CIs3AF; 266!#)$$ KKc4(,,q/ llnA!tW= 	1$1$1$7K0r1   c           	        R pRpR\         P                  ,          p^dpRpRpRp\         P                  P                  4       pVP                  V4      p	\         P                  ! R\         P                  ,          R\         P                  ,          V4      W8  ,          p
V\         P
                  ! W*,          V,           4      ,          V,           p\         P                  ! RRV4      p\        P                  ! RR	7      ;_uu_ 4        \        WVR
R7       RRR4       \        P                  ! RR	7      ;_uu_ 4        \        WVRR7       RRR4       R#   + '       g   i     LH; i  + '       g   i     R# ; i)r!   r@   r    rI  rJ  rd  rL  rM  zleave 'precenter' unspecifiedr   Tre  NF)	r$   r  r  r  r&   r  r   deprecated_callr   )r)   rT  rU  rV  rW  rX  r,   rh  rY  rZ  r[  r  r+   s   &            r.   test_precenter_deprecation*TestLombscargle.test_precenter_deprecation  s    BEEk ii##%JJsOKKRUU
CIs3AF; 266!#)$$v- KKc4( ##*IJJa40 K ##*IJJa51 KJ KJ KJJs   E<E(E%	(E9	z;ignore:.*leave 'precenter' unspecified.*:DeprecationWarningc                    \         P                  ! R R7      ;_uu_ 4        \        P                  ! R.4      p\	        WVR4       RRR4       R#   + '       g   i     R# ; i)zuse keyword argumentsr   r@   FN)r   r  r$   asarrayr   )r)   ones   & r.    test_positional_args_deprecation0TestLombscargle.test_positional_args_deprecation/  sB     ##*ABB**cU#C#u- CBBBs   %AA 	r   N)r   r   r   r   r]  ra  r   r   rR  rj  rt  rz  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   s   @r.   rG  rG    s     &1P6B [[ <=&' >&'P"-HIB%II/Eb-> &D"7HI [[ <=FH >FHP >!" [[ <=%1 >%1N2< [[E..r1   rG  c                      a  ] tR tRt o R tR tR tR tR t]	P                  P                  RRR	.4      R
 4       tR tR tR t]	P                  P                  RRR	.4      R 4       tR tR tR tR tR tRtV tR# )TestSTFTi8  c           	     @   R  pV! R4      ;_uu_ 4        \        RR"^ 4       RRR4       V! R4      ;_uu_ 4        \        R^
^4       RRR4       V! R4      ;_uu_ 4        \        \        P                  ! R#4      ^
^ 4       RRR4       V! R4      ;_uu_ 4        \        \        P                  ! ^4      ^
^ 4       RRR4       V! R4      ;_uu_ 4        \        RR"^ 4       RRR4       V! R4      ;_uu_ 4        \        R^
^4       RRR4       V! R4      ;_uu_ 4        \        \        P                  ! R#4      ^
^ 4       RRR4       V! R4      ;_uu_ 4        \        \        P                  ! ^4      ^
^ 4       RRR4       V! R4      ;_uu_ 4        \        R^@R$4       RRR4       \        P                  ! R	4      p\        V4      ^,          pV! R4      ;_uu_ 4        \        V\        P                  ! R#4      R
7       RRR4       V! R%4      ;_uu_ 4        \        V\        P                  ! ^
4      RR7       RRR4       V! R4      ;_uu_ 4        \        VR&R7       RRR4       V! R4      ;_uu_ 4        \        VRR	R7       RRR4       V! R4      ;_uu_ 4        \        VR^R7       RRR4       V! R4      ;_uu_ 4        \        V4       RRR4       V! R4      ;_uu_ 4        \        V\        P                  ! R#4      R
7       RRR4       V! R4      ;_uu_ 4        \        V\        P                  ! ^
4      RR7       RRR4       V! R4      ;_uu_ 4        \        VR&R7       RRR4       V! R4      ;_uu_ 4        \        VRR	R7       RRR4       V! R4      ;_uu_ 4        \        VR^R7       RRR4       \        P                  ! \        R'R7      ;_uu_ 4        \        VR^ RR7       RRR4       V! R4      ;_uu_ 4        \        V^ ^ R7       RRR4       V! R(4      ;_uu_ 4        \        W"RR7       RRR4       V! R4      ;_uu_ 4        \        VR,          VR,          RR7       RRR4       V! R)4      ;_uu_ 4        \        W"RR7       RRR4       RpV! RV: R 24      ;_uu_ 4        \        W$R!7       RRR4       V! RV: R 24      ;_uu_ 4        \        W4R!7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL{; i  + '       g   i     ELi; i  + '       g   i     ELC; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELq; i  + '       g   i     EL^; i  + '       g   i     ELN; i  + '       g   i     EL(; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL|; i  + '       g   i     EL[; i  + '       g   i     ELI; i  + '       g   i     EL1; i  + '       g   i     R# ; i)*c                :    \         P                  ! \        V R7      # )ziAssert for a ValueError matching regexp `match`.

This little wrapper allows a more concise code layout.
r   )r   r   rc   r   s   &r.   chk_VE.TestSTFT.test_input_validation.<locals>.chk_VE;  s    
 ==599r1   z"nperseg must be a positive integerr   Nz#noverlap must be less than nperseg.zwindow must be 1-Dz"window must have length of npersegz"noverlap must be less than npersegz&noverlap must be a nonnegative integerr  r   rN  rO  r   r_  z.nfft must be greater than or equal to nperseg.r  zInput stft must be at least 2d!zwindow must have length of 256r   r   r`  r   z/Must specify differing time and frequency axes!	time_axis	freq_axisra   )modez'x and y must be equal if mode is 'stft':Ni   N:i   NNstft)boundary	not_validzParameter scaling=z not in \['spectrum', 'psd'\]!rG   i)rl   rl   iz>value specified for nperseg is different from length of windowi z1NOLA condition failed, STFT may not be invertiblez=Unknown value for mode foo, must be one of: \{'psd', 'stft'\}z[Unknown boundary option 'foo', must be one of: \['even', 'odd', 'constant', 'zeros', None\])r   r$   r'   r   r%   r  istftr   warnsrS  r   )r)   r  r*   zrH   s   &    r.   test_input_validationTestSTFT.test_input_validation9  s   	: 899vsA& :9::vr2& ;())rwwvA. *899rwwr{B* : 899vsA& :899vr2& :())rwwvA. *899rwwr{B* :<==vr3' > HHTNGAJ ())2776?+ * , - -2772;4- 899D! :9::C$/ ;DEECa( F 566!H 7())!BGGFO, *455!BGGBK5 6899!T" :9::!S40 ;DEE!Sq) F\\+ .7 8 8!S1V<8 EFF!qA. G  ) * *Q.* =>>QtWagF; ? D E EQE2E *'+IJKK$ L*'+IJKK!% LKK :99:::)))999 :99999)))999=== *))- - - :99:::EEE 766)))555999:::EEE8 8 8 GFF* * * ?>>E E E
 LKKKKKsB  TT "T,"U U:U( "U<"VV$""V8#WW =W4$XX/"X0)#Y$Y
Y,1Z ,ZZ(;Z<![[$[8-\T	T)	,T=	 U	U%	(U9	<V	V!	$V5	8W		W	 W1	4X	X	X-	0Y	Y	Y)	,Y=	 Z	Z%	(Z9	<[	[!	$[5	8\		\	c                j    . ROpV F(  pRP                   ! V!  p\        R\        V!  VR7       K*  	  R# )r  
{}, {}, {}Tr  N)r  rn   r   r  rn   r>  r  3      r   rN     r   rN     blackmanr     r  r    rN  r^  r   rN     )formatr   r   )r)   settingssettingmsgs   &   r.   test_check_COLATestSTFT.test_check_COLA  s6    	  G%%w/Cz73SA  r1   c                <   . ROpV F(  pRP                   ! V!  p\        R\        V!  VR7       K*  	  \        P                  ! ^4      p^ VR&   V\        V4      \        V4      ^,          3R.pV F(  pRP                   ! V!  p\        R\        V!  VR7       K*  	  R# )	r  r  Tr  r   FN)r  r  )r  rn      r  )r  r  rn   r  r  )r   rN  %   r  )r  r  {   r  )r  rN  &   r  )r   rN  '   )r   r^  r   )r  r   r   r$   r'   r  )r)   settings_passr  r  w_failsettings_fails   &     r.   test_check_NOLATestSTFT.test_check_NOLA  s      %G%%w/Cz73SA % sS[#f+*:;#
 %G%%w/C
G 4cB %r1   c                T   \         P                  P                  R 4      pVP                  R4      pRpRp^p^p\	        W#WEVRRRR7      w  rxp	\        W#WEVRRRR7      w  r\        Wz4       \        \         P                  ! \         P                  ! V	4      ^,          R
R	7      V4       R# )r  r  r@   r   FN)paddedr?   r  rF   )r?   rH   r  r~   r"   )	r$   r  rP  r  r  r   r   r#  r  )r)   rY  r*   r  r   r   r`  r+   r  Zr9  r:  s   &           r.   r;  "TestSTFT.test_average_all_segments  s    ii##D)IIdO
 qfx',t=aqfx)5: 	q	126;r1   c           
        \         P                  P                  R 4      pVP                  R4      pRpRp^p^p\	        W#WEV4      w  rxp	\	        VP                  R4      W4WV^ R7      w  rp\        WWEV4      w  r\        VP                  W4WV^ RR7      w  pp\        Wz4       \        W4       \        W4       \        WR	,          4       \        VVR
,          4       R# )r  r  r@   r   r~   r  Nr"   )r"   rm   rm   )rj   r   r   rj   r   )	r$   r  rP  r  r  ru   r  Tr   )r)   rY  r*   r  r   r   r`  r  t1Z1r  t2Z2t3x1t4x2s   &                r.   test_permute_axesTestSTFT.test_permute_axes  s    ii##D)IIdO!(;
!))J/W "
 rv9rttRa!#%B 	zN+BwK(r1   rH   rF   psdc                ^   \         P                  P                  R 4      p. ROpV F  w  rErg\         P                  ! V4      p^
VP	                  VP
                  4      ,          p	\        WVVRRVR7      w   r\        WVWAR7      w  rV RV 2p\        WVR7       \        WVR7       K  	  R# )r  NF)r   r`  r   r  r  rH   )r   r`  r   rH   rz  r  r  d   rn   r   r  r  rn   r>  )r  e   r  r  r   r  rN  r  )r    rN  r^  )r   r  rN  r  	r$   r  rP  r:   r  sizer  r  r   r)   rH   rY  r  r   Nr   r`  r[  r*   r  zztrxrr  s   &&             r.   test_roundtrip_realTestSTFT.test_roundtrip_real  s    ii##D) -5(Fw		!A399QVV$$AA#)4$+-HAq 2"(;FB HBxj)CA3/A3/ -5r1   c                   \         P                  P                  R 4      p\         P                  ! ^4      p^ VR&   VR\	        V4      \	        V4      ^,          3R.pV EF  w  rErgV RV RV RV 2p\        WFV4      '       d   Q V4       h\         P                  ! V4      p	^
VP                  V	P                  4      ,          p
\        WVVRRRR7      w   r\        P                  ! \        RR	7      ;_uu_ 4        \        WVVRR
7      w  rRRR4       \         P                  ! V	XR\	        V	4       4      '       g   Q V4       h\         P                  ! V
XR\	        V
4       4      '       g   EK  Q V4       h	  R#   + '       g   i     Lw; i)r  r   rN  rz  NTr%   r   r`  r   r  r  r  NOLAr   r   r`  r   r  )r   rN  r^  r   )r$   r  rP  r'   r  r   r:   r  r  r  r   r  rS  r  allclose)r)   rY  r  r  r   r  r   r`  r  r[  r*   r  r  r  r  s   &              r.   test_roundtrip_not_nola TestSTFT.test_roundtrip_not_nola  sX   ii##D)sS#f+s6{a/?@(

 -5(FwHBqcG9Bxj9C!&8<<AcA<		!ASYYqvv&&AA#)4%,.HAq k88rX&,t= 9 ;;q"Wc!f+..33.{{1b#a&k227C72 -5 98s   ;E<<Fc                   \         P                  P                  R 4      p. ROpV F  w  r4rVV RV RV 2p\        W5V4      '       g   Q V4       h\	        W5V4      '       d   Q V4       h\         P
                  ! V4      p^
VP                  VP                  4      ,          p	\        WVVRRRR7      w   r\        WVVRR7      w  rV RV 2p\        WR\        V4       VR7       \        WR\        V	4       VR7       K  	  R# )	r  rz  NTr%   r!  r#  r  ))r  r  rn   r   )r  r  r  r  )r   r  rN     )r  r  rN     )r   r  rN  r   )r$   r  rP  r   r   r:   r  r  r  r  r   r  )r)   rY  r  r   r  r   r`  r  r[  r*   r  r  r  r  s   &             r.   test_roundtrip_nola_not_cola%TestSTFT.test_roundtrip_nola_not_cola  s   ii##D) -5(FwHBwir(4Cfx88=#=8!&8<<AcA<		!ASYYqvv&&AA#)4%,.HAq 2"(49FB HBxj)CA'3q6{C8A'3q6{C8# -5r1   c           
        \         P                  P                  R 4      pR
.pV F  w  r4rV\         P                  ! V4      p^
VP	                  VP
                  4      ,          pVP                  \         P                  4      p\        WVVRRR7      w   r\        WVVR7      w  rV RV 2p\        WwVR7       \        WVRRR	7       \        VP                  VP                  8H  4       K  	  R# )r  NFr   r`  r   r  r  r  rz  r  r  gh㈵>)r  r   r8   r  )r$   r  rP  r:   r  r  astypefloat32r  r  r   r   rO   r)   rY  r  r   r  r   r`  r[  r*   r  r  r  r  r  s   &             r.   test_roundtrip_float32TestSTFT.test_roundtrip_float32:  s    ii##D),-,4(Fw		!A399QVV$$A$AA#)4GHAq 2"(*FB HBxj)CA#.A3TEAGGrxx'( -5r1   c                   \         P                  P                  R 4      p. ROpV F  w  rErg\         P                  ! V4      p^
VP	                  VP
                  4      ,          RVP	                  VP
                  4      ,          ,           p	\        WVVRRRVR7      w   r\        WVVRVR7      w  rV RV RV 2p\        WVR7       \        WVR7       K  	  \        P                  ! 4       ;_uu_ 4        \        P                  ! RR	\        4       \        X	XXXRRR
VR7      w   rRRR4       \        XXXXRVR7      w  rV RV RV 2p\        XWR7       \        X	WR7       R#   + '       g   i     LI; i)r  y              $@NF)r   r`  r   r  r  r?   rH   )r   r`  r   input_onesidedrH   rz  r  rM  z9Input data is complex, switching to return_onesided=FalseTr  )r$   r  rP  r:   r  r  r  r  r   rP  rQ  rR  rS  r  s   &&             r.   test_roundtrip_complexTestSTFT.test_roundtrip_complexO  so   ii##D) -5(Fw		!A399QVV$$s399QVV+<'<<AA#)4,17DHAq 2"(#*,FB HBwir(4CA3/A3/ -5" $$&&##K
 Aw#)4,0'CHAq ' r7X$UGM 7)2hZ02+2+ '&s   73E++E;	c                   \         P                  P                  R 4      pRR	.pV F  w  r4rV\         P                  ! V4      p^
VP	                  VP
                  4      ,          p\        WVVRRRR7      w   r\        WVRR7      w  rR
 FK  p\        WVVRRVR7      w   r\        WVRR7      w  rV RV RV 2p\        WVR7       \        WVR7       KM  	  K  	  R# )r  NTr!  F)r`  r   r  rz  r  r  r  )evenoddconstantr%   r  )r)   rY  r  r   r  r   r`  r[  r*   r  r  r  r  zz_extxr_extr  s   &               r.   !test_roundtrip_boundary_extension*TestSTFT.test_roundtrip_boundary_extension~  s    ii##D) +*
 -5(Fw		!A399QVV$$AA"($t$(*HAq "OEA@#A'-tD)1 31 "&F)-/	  8*Bxj9s337 A -5r1   c           
        \         P                  P                  R 4      pRR.pV F  w  r4rV\         P                  ! V4      p^
VP	                  VP
                  4      ,          p\        WVVRRR7      w   r\        WVR7      w  rV RV 2p\        W{RVP
                   VR7       \        WRVP
                   VR7       K  	  R# )	r  NTr-  )r`  r   rz  r  )r  r  rn   r   )r   rI  rN  r  r  r0  s   &             r.   test_roundtrip_padded_signal%TestSTFT.test_roundtrip_padded_signal  s    ii##D) +,
 -5(Fw		!A399QVV$$AA#)4FHAq 2@FBHBxj)CA'166{C8A'166{C8 -5r1   c                8   \         P                  P                  R 4      p. ROpV F  w  r4rVp\         P                  ! V4      p^
VP	                  VP
                  4      ,          p	V	\         P                  ! R\         P                  ,          ^,          4      ,          p
\        WWgVRRR7      w   r\        WWgVRRRR7      w   r\        WWgVR7      w  r\        WWgVRR7      w  ppV R	V 2p\        WVR
7       \        WVR
7       \        V
VVR
7       K  	  R# )r  y              ?NT)r   r`  r   r   r  r  F)r   r`  r   r   r  r  r?   )r   r`  r   r   )r   r`  r   r   r4  rz  r  ))r   r  rN  r  i   )r   r  rN  r  i  )r  r  rn   r   !   )r  r  rN  r^  r  )r$   r  rP  r:   r  r  expr  r  r  r   )r)   rY  r  r   r  r   r`  r   r[  r*   xcr  r  zcr  r  xcrr  s   &                 r.   test_roundtrip_padded_FFT"TestSTFT.test_roundtrip_padded_FFT  s   ii##D) 3;.Fw$		!A399QVV$$A266"RUU(1*%%B 1#)4FGAq B(#)4,13HAq 1"(*FB B(#)%AGB HBxj)CA3/A3/BS1/ 3;r1   c                j   \         P                  P                  R 4      pVP                  R4      p\	        V4      w   r4\        ^4       F  p^.^,          pRWe&   VP                  V4      p\	        WuR7      w   r8\	        WuVP                  ,
          R7      w   r9\        WHP                  4       VR7       \        WIP                  4       WWP                  ,
          R7       K  	  \        VP                  R	RR7      w  r:\        VP                  ^ ^R7      w  r;\        W*RR7       \        W+RR7       R# )
r  r  r~   r  r  zistft transpose minuszistft transpose plusNr"   )r$   r  rP  r  r  r  ru   r  r   r  r  r  r   )r)   rY  r  r  z_flatr  r  r*   z_plusz_minusx_transpose_mx_transpose_ps   &           r.   r  TestSTFT.test_axis_rolling  s    ii##D)4F|1qAtAvHHKx(A?LAq 1662MAq!11=!2AffHE  !R2F Q!D7NO7MNr1   c                B   \         P                  ! R\        R7      pRVR&   \         P                  P	                  V4      p\        V^,          4      \        V4      ,          p\        VRRR7      ^,          p\        VRRR7      ^,          p\        WR4       \        \        V^?R	R13,          4      R
4       \        \        V^@R	R13,          4      ^4       \        \        V^AR	R13,          4      R
4       ^ VRR	R13&   \        VRR	R13,          ^ \         P                  ! VP                  4      P                  R7       \        VRRRR7      ^,          p\         P
                  ! VP                  ^,          VP                  ^,          ,           ^ R7      VP                   ^ ,          ,          p\        Ws4       \        VRRRR7      ^,          p\        WR4       \        VRRRR7      ^,          p\         P"                  ! VR^ R1R3,          4      p	\        VR,          V4       \        VR,          V	4       \         P
                  ! VP                  ^,          VP                  ^,          ,           ^ R7      \         P
                  ! V	P                  ^,          V	P                  ^,          ,           ^ R7      ,           p
WP                   ^ ,          V	P                   ^ ,          ,           ,          p\        W4       \        VRRRR7      ^,          p\        WR4       R	# )z&Verify behavior of scaling parameter. i  rN   r  rN  r8  rF   )r  rH   TNr    :?   B   Nrj   r7   Fr  )r?   r  rH   r~   )r4  r  rH   r"   rK  ):N   Nrj   ):rU  NNrj   )r$   r%   complexr   r   r  r  r  r  r   r  finforO   
resolutionrealimagrv   conj)r)   Xr*   power_xZsr	  Zppsd_ZpZp0Zp1s2psd_Zp01s   &           r.   test_roundtrip_scalingTestSTFT.test_roundtrip_scaling  s[    HHS(#FFLLOad)c!f$ !fj9!< 2j9!< 	Br3B3wK(#.Br3B3wK(!,Br3B3wK(#.5#2#:1crc6
ABHHRXX,>,I,IJ !UVUKAN 
RWWaZ/a8288A;F( 2edEJ1M 1dVUKAN ggc"Qr'1*o&7S)7S) ffSXX]SXX]2;ffSXX]SXX]2;<1		!45* 3tdEJ1Mr1   r   N)r   r   r   r   r  r  r  r;  r  r   r   parametrizer  r%  r*  r1  r5  r=  r@  rH  r  re  r   r   r   s   @r.   r  r  8  s     P&dB C><(). [[YU(;<0 =06869<)* [[YU(;<,, =,,\8B9,!2FO4? ?r1   r  c                      a  ] tR tRt o Rt^ tRt^t^tR t	]
V 3R lR l4       t]
V 3R lR l4       tR tR	 tV 3R
 ltRtV tR# )"TestSampledSpectralRepresentationsi4  zCheck energy/power relations from `Spectral Analysis` section in the user guide.

A 32 sample cosine signal is used to compare the numerical to the expected results
stated in :ref:`tutorial_SpectralAnalysis` in
file ``doc/source/tutorial/signal.rst``
c                   \        V P                  V P                  4      p\        P                  ! V4      p^V n        V P                  ^,          V P                  ,          W P
                  &   \        V4      V n        \        V P                  4      V n
        V P                  V P                  ^,          ,          ^,          V n        V P                  ^,          ^,          V n        R# )z5Create Cosine signal with amplitude a from spectrum. N)r   r  r  r$   r  l_aa_refr   x_refr   X_reftauE_refP_ref)r)   r+   rn  s   &  r.   setup_method/TestSampledSpectralRepresentations.setup_methodE  s    TVVTVV$a **Q,/hh5\
_
 XX

A-1
ZZ]Q&
r1   c                    < V ^8  d   QhRS[ /# rl   returnro  )r  r   s   "r.   __annotate__/TestSampledSpectralRepresentations.__annotate__S  s      U r1   c                <    V P                   V P                  ,          # )zDuration of signal. r  r  rd   s   &r.   ro  &TestSampledSpectralRepresentations.tauR  s     vvr1   c                    < V ^8  d   QhRS[ /# ru  rw  )r  r   s   "r.   rx  ry  X  s     % % %r1   c                J    ^V P                   V P                  ,          ,          # )z
Bin width r{  rd   s   &r.   delta_f*TestSampledSpectralRepresentations.delta_fW  s     DFFTVVO$$r1   c                l   \        ^V P                  ,          \        P                  ! V P                  4      RR7       \        V P
                  \        V P                  ^,          4      ,          V P                  4       \        V P                  P                  ^,          V P                  P                  ^,          ,           4      p\        V P
                  V P                  ,          V,          V P                  4       \        ^V P                  ^,          ,          V,          V P                  4       R# )z Test energy and power formulas. r  r  N)r   rl  r$   ptprm  r  r  rp  rn  rY  rZ  r  rq  )r)   sum_X_ref_squareds   & r.   test_reference_signal8TestSampledSpectralRepresentations.test_reference_signal\  s     	$**bffTZZ&8sCTZZ1_!55tzzB  

 2TZZ__a5G GHtvv(994::F$&&!)&77Dr1   c                   \        V P                  RR7      p\        \        V4      4      \        P
                  ! \        VP                  ^,          VP                  ^,          ,           4      4      r2\        V P                  V,          4      p\        V P                  W@P                  ,          ,          V,          V P                  V P                  ,          ^,          4       \        W@P                  ,          V,          V P                  ^,          4       V P                  V P                  ,          \        WC,          4      ^,          ,          pV P                  \        WC,          4      ^,          ,          p\        V P                  \        V4      ,          V P                   4       \        V P                  \        V4      ,          V P"                  4       \%        ^V P                  ,          VRRR7      p\'        V P                  3RR/VB w  r\'        V P                  3RR/VB w  r\        P(                  ! V	P*                  4      P,                  p\        V	\        WB,          4      ^,          V\/        V	4      ,          R7       \        WV\/        V
4      ,          R7       \%        RR\1        V P                  4      R	^ /VB p\        \3        V P                  3RR/VB ^,          V	V\/        V	4      ,          R7       \        \3        V P                  3RR/VB ^,          V
V\/        V
4      ,          R7       R
# )zwVerify spectral representations of windowed DFT.

Furthermore, the scalings of `periodogram` and `welch` are verified.
F)sym)r  r   r  r?   rH   rF   rI   r7   r   r`  Nr   )r   r  r  r  r$   r  rY  rZ  r   rm  r   ro  rk  rl  r  r  rp  rq  r  r   rW  rO   rX  rp  r  r   )r)   rU  c_ampc_rmsXwX_ESDX_PSDr  r  P_magP_psd	float_ress   &           r.   test_windowed_DFT4TestSampledSpectralRepresentations.test_windowed_DFTh  s7   
 U#3q6{BGGC	AFFAI0E,F$GuA 	2hh</%7dhh9NQR9RS88u,djjl; 466!C
OQ$66RZ!++s5z14::>s5z14::> QtvvXaNtzzD:DDtzzC9CC HHU[[)44	s28}a/iE
6JK9SZ+?@ <#djj/<A<<djjC*CCAF&s5z1	3djjB)BrB1Eu&s5z1	3r1   c                   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[ ;R&   S[P                  ;R&   S[P                  ;R&   S[;R&   S[;R&   # )	rl   r  r  rl  rk  rm  rn  rp  rq  )rP   ro  r$   ndarray)r  r   s   "r.   rx  ry  4  sp      K  O    
L  ::  ::  L  L r1   )rp  rq  rn  rk  rm  NrA   )r   r   r   r   __doc__r  r  rl  rk  rr  propertyro  r  r  r  __annotate_func__r   r   r   s   @r.   ri  ri  4  s`      AAEC'   % %
E$3i  r1   ri  )2r   rP  numpyr$   numpy.testingr   r   r   r   r   r   r   rb   scipyr	   scipy._lib._array_apir
   	scipy.fftr   r   r   r   scipy.integrater   scipy.signalr   r   r   r   r   r   r   r   scipy.signal.windowsr   scipy.signal._spectral_pyr   ,scipy.signal.tests._scipy_spectral_test_shimr   r  r   r  r   r   r  r)  r5  rG  r  ri  r   r1   r.   <module>r     s    
  ; ;  *  1 3 3 %? ? ? % 6 N OZ' Z'zF0 F0P
n* n*b 06  6 pv. v.ry yxX3 X3r1   