def cosine(M, sym=True):
    if M < 1:
        return np.array([])
    if M == 1:
        return np.ones(1, 'd')
    odd = M % 2
    if not sym and not odd:
        M = M + 1

    w = np.sin(np.pi / M * (np.arange(0, M) + .5))

    if not sym and not odd:
        w = w[:-1]
    return w
Return a window with a simple cosine shape.
dataset/ETHPy150Open scipy/scipy/scipy/signal/windows.py/cosine