def calc_moving_average_array(values, window, mode='valid'):

    weights = np.repeat(1.0, window)/window

    # Including 'valid' MODE will REQUIRE there to be enough data points.