def bin_spikes(spike_times, binsz):
    """Sort spike times into bins

    :param spike_times: times of spike instances
    :type spike_times: list
    :param binsz: length of time bin to use
    :type binsz: float
    :returns: list of bin indicies, one for each element in spike_times
    """
    bins = np.empty((len(spike_times),), dtype=int)
    for i, stime in enumerate(spike_times):
        # around to fix rounding errors
        bins[i] = np.floor(np.around(stime/binsz, 5))
    return bins
Sort spike times into bins

    :param spike_times: times of spike instances
    :type spike_times: list
    :param binsz: length of time bin to use
    :type binsz: float
    :returns: list of bin indicies, one for each element in spike_times