def mavg(arr, n=2, mode='valid'):
    '\n    returns the moving average of an array.\n    returned array is shorter by (n-1)\n    '
    if (len(arr) > 400):
        return signal.fftconvolve(arr, ([(1.0 / float(n))] * n), mode=mode)
    else:
        return signal.convolve(arr, ([(1.0 / float(n))] * n), mode=mode)
returns the moving average of an array.
returned array is shorter by (n-1)
def mavg(arr, n=2, mode='valid'):
    '\n    returns the moving average of an array.\n    returned array is shorter by (n-1)\n    '
    if (len(arr) > 400):
        return signal.fftconvolve(arr, ([(1.0 / float(n))] * n), mode=mode)
    else:
        return signal.convolve(arr, ([(1.0 / float(n))] * n), mode=mode)