[Scipy-tickets] [SciPy] #1665: Are odd-length window functions supposed to be always symmetrical?

SciPy Trac scipy-tickets@scipy....
Wed May 30 14:51:23 CDT 2012


#1665: Are odd-length window functions supposed to be always symmetrical?
--------------------------+-------------------------------------------------
 Reporter:  endolith      |       Owner:  cdavid     
     Type:  defect        |      Status:  new        
 Priority:  normal        |   Milestone:  Unscheduled
Component:  scipy.signal  |     Version:  0.10.0     
 Keywords:                |  
--------------------------+-------------------------------------------------
 The window functions in scipy.signal have a `sym` option for producing
 symmetric windows or periodic windows, but if you create a periodic window
 of an odd size, it gives identical output to a symmetric window.  This is
 in the code, but is it right?  It doesn't match Matlab's behavior, as
 described [https://ccrma.stanford.edu/~jos/sasp/Matlab_Hamming_Window.html
 here].

 If it's right, it should be documented why it works this way

 {{{
 >> hamming(3) % same in Matlab and Octave
 ans =
     0.0800
     1.0000
     0.0800
 >> hamming(3,'symmetric') % Matlab only
 ans =
     0.0800
     1.0000
     0.0800
 >> hamming(3,'periodic') % Matlab only
 ans =
     0.0800
     0.7700
     0.7700
 >> hamming(4) % same in Matlab and Octave
 ans =
     0.0800
     0.7700
     0.7700
     0.0800
 }}}

 SciPy:

 {{{

 In [2]: hamming(3)
 Out[2]: array([ 0.08,  1.  ,  0.08])

 In [3]: hamming(3,sym=True)
 Out[3]: array([ 0.08,  1.  ,  0.08])

 In [4]: hamming(3,sym=False)
 Out[4]: array([ 0.08,  1.  ,  0.08])

 In [5]: hamming(4)
 Out[5]: array([ 0.08,  0.77,  0.77,  0.08])

 In [6]: hamming(4, sym=True)
 Out[6]: array([ 0.08,  0.77,  0.77,  0.08])

 In [7]: hamming(4, sym=False)
 Out[7]: array([ 0.08,  0.54,  1.  ,  0.54])
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1665>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list