def smooth_hanning(x, size=11):
    """smooth a 1D array using a hanning window with requested size."""

    if x.ndim != 1:
        raise ValueError, "smooth_hanning only accepts 1-D arrays."
    if x.size < size:
        raise ValueError, "Input vector needs to be bigger than window size."
    if size < 3:
        return x

    s = np.r_[x[size - 1:0:-1], x, x[-1:-size:-1]]
    w = np.hanning(size)
    y = np.convolve(w / w.sum(), s, mode='valid')
    return y
dataset/ETHPy150Open ucbvislab/radiotool/radiotool/algorithms/novelty.py/smooth_hanning/original