def compute_spike_rate(spikes):
    """Estimate spike rate from a vector of spike times, in seconds.

    Parameters
    ----------
    spikes : 1d array
        Spike times, in seconds.

    Returns
    -------
    float
        Average firing rate.

    Examples
    --------
    Compute spike rate of 6 spikes

    >>> spikes = [0.5, 1, 1.5, 2, 2.5, 3]
    >>> compute_spike_rate(spikes)
    2.4
    """

    return len(spikes) / (spikes[-1] - spikes[0])