def get_window(window, Nx, fftbins=True):
sym = not fftbins<EOL>try:<EOL><INDENT>beta = float(window)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>args = ()<EOL>if isinstance(window, tuple):<EOL><INDENT>winstr = window[<NUM_LIT:0>]<EOL>if len(window) > <NUM_LIT:1>:<EOL><INDENT>args = window[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>elif isinstance(window, string_types):<EOL><INDENT>if window in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>raise ValueError("<STR_LIT>" + window + "<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>winstr = window<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % str(type(window)))<EOL><DEDENT>if winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = blackman<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = triang<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = hamming<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = bartlett<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = hann<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = blackmanharris<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = parzen<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = bohman<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = nuttall<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = barthann<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = flattop<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = kaiser<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = gaussian<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = general_gaussian<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = boxcar<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = slepian<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = cosine<EOL><DEDENT>elif winstr in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>winfunc = chebwin<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>params = (Nx,) + args + (sym,)<EOL><DEDENT>else:<EOL><INDENT>winfunc = kaiser<EOL>params = (Nx, beta, sym)<EOL><DEDENT>return winfunc(*params)<EOL>
Return a window.

Parameters
----------
window : string, float, or tuple
    The type of window to create. See below for more details.
Nx : int
    The number of samples in the window.
fftbins : bool, optional
    If True, create a "periodic" window ready to use with ifftshift
    and be multiplied by the result of an fft (SEE ALSO fftfreq).

Returns
-------
get_window : ndarray
    Returns a window of length `Nx` and type `window`

Notes
-----
Window types:

    boxcar, triang, blackman, hamming, hann, bartlett, flattop,
    parzen, bohman, blackmanharris, nuttall, barthann,
    kaiser (needs beta), gaussian (needs std),
    general_gaussian (needs power, width),
    slepian (needs width), chebwin (needs attenuation)


If the window requires no parameters, then `window` can be a string.

If the window requires parameters, then `window` must be a tuple
with the first argument the string name of the window, and the next
arguments the needed parameters.

If `window` is a floating point number, it is interpreted as the beta
parameter of the kaiser window.

Each of the window types listed above is also the name of
a function that can be called directly to create a window of
that type.

Examples
--------
>>> from scipy import signal
>>> signal.get_window('triang', 7)
array([ 0.25,  0.5 ,  0.75,  1.  ,  0.75,  0.5 ,  0.25])
>>> signal.get_window(('kaiser', 4.0), 9)
array([ 0.08848053,  0.32578323,  0.63343178,  0.89640418,  1.        ,
        0.89640418,  0.63343178,  0.32578323,  0.08848053])
>>> signal.get_window(4.0, 9)
array([ 0.08848053,  0.32578323,  0.63343178,  0.89640418,  1.        ,
        0.89640418,  0.63343178,  0.32578323,  0.08848053])