def calc_number_of_spikes(in_array, threshold=0.0):
    """

    :param in_array: array of values
    :param threshold: value that if in_array passes, counts as a spike
    :return: num_spikes: integer value of the number of spikes
    """
    num_spikes = 0

    for in_ind, in_val in enumerate(in_array[0:-2]):
        if in_val < threshold < in_array[in_ind+1]:
            num_spikes += 1

    return num_spikes