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, 8, 11, 32), 'numpy.arange', 'np.arange', ({(11, 18, 11, 19): '1', (11, 21, 11, 28): 'WSZ - 1', (11, 30, 11, 31): '2'}, {}), '(1, WSZ - 1, 2)', True, 'import numpy as np\n'), ((14, 11, 14, 46), 'numpy.concatenate', 'np.concatenate', ({(14, 26, 14, 45): '(start, out0, stop)'}, {}), '((start, out0, stop))', True, 'import numpy as np\n'), ((10, 26, 10, 49), 'numpy.ones', 'np.ones', (), '', True, 'import numpy as np\n'), ((12, 12, 12, 34), 'numpy.cumsum', 'np.cumsum', ({(12, 22, 12, 33): 'a[:WSZ - 1]'}, {}), '(a[:WSZ - 1])', True, 'import numpy as np\n'), ((13, 12, 13, 34), 'numpy.cumsum', 'np.cumsum', ({(13, 22, 13, 33): 'a[:-WSZ:-1]'}, {}), '(a[:-WSZ:-1])', True, 'import numpy as np\n')]