def smooth(x, y):
    """
    Smooth a curve
    """
    xs = x[:]
    ys = y[:]
    d = 0
    for i in range(0, len(ys)):
        num = min(len(ys), i+d+1) - max(0, i-d)
        total = sum(ys[max(0, i-d):min(len(ys), i+d+1)])
        ys[i] = total/float(num)
    return xs, ys