spiketools.utils.epoch.epoch_spikes_by_segment¶
- spiketools.utils.epoch.epoch_spikes_by_segment(spikes, segments)[source]¶
Epoch spikes by segments.
- Parameters:
- spikes1d array
Spike times, in seconds.
- segmentslist or 1d array of float
Time values, in seconds, that define the segments. Each segment time is defined as the interval between segment[n] and segment[n+1].
- Returns:
- segment_spikeslist of 1d array
Spike times per segment.
Examples
Epoch spiking data based on segments:
>>> spikes = np.array([0.1, 0.3, 0.4, 0.5, 0.6, 0.7, 1, 1.4]) >>> segments = [0, 0.35, 0.55, 0.8, 1.5] >>> epoch_spikes_by_segment(spikes, segments) [array([0.1, 0.3]), array([0.4, 0.5]), array([0.6, 0.7]), array([1. , 1.4])]