isi¶
- isi(spikes: Tensor, step_time: float, time_first: bool = True) Tensor[source]¶
Transforms spike trains into interspike intervals.
The returned tensor will be padded with
NaNvalues where an interval could not be computed but the position existed (e.g. padding at the end of) spike trains with fewer spikes. If no intervals could be generated at all, a tensor with a time dimension of zero will be returned. The returned tensor will have a floating point type, as required for the padding.- Parameters:
spikes (torch.Tensor) – spike trains for which to calculate intervals.
step_time (float) – length of the simulation step, in \(\text{ms}\).
time_first (bool, optional) – if the time dimension is given first rather than last. Defaults to
True.
- Returns:
interspike intervals for the given spike trains.
- Return type:
Shape
spikes:\(T \times N_0 \times \cdots\) or \(N_0 \times \cdots \times T\)
return:\((C - 1) \times N_0 \times \cdots\) or \(N_0 \times \cdots \times (C - 1)\)
- Where:
\(N_0, \ldots\) shape of the generating population (batch, neuron shape, etc).
\(T\) the length of the spike trains.
\(C\) the maximum number of spikes amongst the spike trains.