def _is_local_maxima(index, reach_plot, nbh_size):
    """Test if a reachability_plot value is a local maxima

    :param index: The index of the value in reach_plot to check
    :param reach_plot: An array of reachability plot values
    :param nbh_size: The size of the neighborhood
    :return: Boolean True or False
    """

    reach_plot_size = len(reach_plot)

    for i in range(1, nbh_size + 1):
        # test if index is inside limits
        if index + i < reach_plot_size and index - i >= 0:
            current = reach_plot[index]
            previous = reach_plot[index - i]
            next = reach_plot[index + i]
            return previous <= current >= next

    return False