[SciPy-User] Normalization of window functions (documentation suggestion)

Fabrice Silva silva at lma.cnrs-mrs.fr
Sat Apr 2 11:31:45 EDT 2011


Le samedi 02 avril 2011 à 15:51 +0200, Ralf Gommers a écrit :
> On Thu, Mar 31, 2011 at 8:21 PM, Yury V. Zaytsev <yury at shurup.com> wrote:
> > Hi!
> >
> > In the documentation of the return values of the window functions in
> > NumPy, such as:
> >
> > bartlett(M)
> > blackman(M)
> > hamming(M)
> > hanning(M)
> > kaiser(M, beta)
> >
> > it always says something like "The window, normalized to one". I find
> > this slightly confusing, because I would actually read that as if the
> > values were normalized such that the area under the curve is one.
> >
> > I think it would make sense to change it to something like "The window,
> > with the maximum value normalized to one" to state it more explicitly.
> 
> Done in commit 250245d. Thanks for the suggestion.

The maximum coefficient of the array returned is not 1 if an even number
of values is required:

>>> import numpy as np
>>> np.hanning(5)
array([ 0. ,  0.5,  1. ,  0.5,  0. ])
>>> np.hanning(4)
array([ 0.  ,  0.75,  0.75,  0.  ])

(same behaviour for others windows)
For even number, the mean value (zero for centered window) is not
sampled for symmetry reason. It is the underlying analytical (time
continuous) function that has a maximum value normalised to one.

-- 
Fabrice Silva




More information about the SciPy-User mailing list