def smooth(array, index, amount):
    """

    Returns the average of the data at the specified index +/- amount

    """
    sum = array[index]
    count = 1.0
    for n in range(1, amount + 1):
        if index + n >= len(array):
            break
        sum += array[index + n]
        count += 1.0
    for n in range(1, amount + 1):
        if index - n < 0:
            break
        sum += array[index - n]
        count += 1.0
    return sum / count
