diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-11-02 16:12:34 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-11-02 16:12:34 +0000 |
commit | df18ca848af515b961d50167646404e0d8db5eb8 (patch) | |
tree | ce26a7a88fb0ff4dda6a2ff1adffe17d8571844b /numpy/lib/function_base.py | |
parent | 8cc0baba1bea752cc6c8bc8917055260795960ba (diff) | |
download | numpy-df18ca848af515b961d50167646404e0d8db5eb8.tar.gz |
Fix #369: windows returning invalid results for M=1
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index d7e687eaa..a77b696c3 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -920,24 +920,40 @@ def corrcoef(x, y=None, rowvar=1, bias=0): def blackman(M): """blackman(M) returns the M-point Blackman window. """ + if M < 1: + return array([]) + if M == 1: + return ones(1, float) n = arange(0,M) return 0.42-0.5*cos(2.0*pi*n/(M-1)) + 0.08*cos(4.0*pi*n/(M-1)) def bartlett(M): """bartlett(M) returns the M-point Bartlett window. """ + if M < 1: + return array([]) + if M == 1: + return ones(1, float) n = arange(0,M) return where(less_equal(n,(M-1)/2.0),2.0*n/(M-1),2.0-2.0*n/(M-1)) def hanning(M): """hanning(M) returns the M-point Hanning window. """ + if M < 1: + return array([]) + if M == 1: + return ones(1, float) n = arange(0,M) return 0.5-0.5*cos(2.0*pi*n/(M-1)) def hamming(M): """hamming(M) returns the M-point Hamming window. """ + if M < 1: + return array([]) + if M == 1: + return ones(1,float) n = arange(0,M) return 0.54-0.46*cos(2.0*pi*n/(M-1)) |