import numpy as np


def smooth(a, WSZ):
    # a: NumPy 1-D array containing the data to be smoothed
    # WSZ: smoothing window size needs, which must be odd number,
    # as in the original MATLAB implementation
    if WSZ % 2 == 0:
        WSZ = WSZ - 1
    out0 = np.convolve(a, np.ones(WSZ, dtype=int), 'valid') / WSZ
    r = np.arange(1, WSZ - 1, 2)
    start = np.cumsum(a[:WSZ - 1])[::2] / r
    stop = (np.cumsum(a[:-WSZ:-1])[::2] / r)[::-1]
    return np.concatenate((start, out0, stop))

[(11, 'numpy.arange', 'np.arange', (['(1)', '(WSZ - 1)', '(2)'], {}), True, 'import numpy as np\n'), (14, 'numpy.concatenate', 'np.concatenate', (['(start, out0, stop)'], {}), True, 'import numpy as np\n'), (10, 'numpy.ones', 'np.ones', (['WSZ'], {'dtype': 'int'}), True, 'import numpy as np\n'), (12, 'numpy.cumsum', 'np.cumsum', (['a[:WSZ - 1]'], {}), True, 'import numpy as np\n'), (13, 'numpy.cumsum', 'np.cumsum', (['a[:-WSZ:-1]'], {}), True, 'import numpy as np\n')]