spiketools.measures.conversions.convert_train_to_times

spiketools.measures.conversions.convert_train_to_times(spike_train, fs=1000, start_time=0)[source]

Convert a spike train representation into spike times, in seconds.

Parameters:
spike_train1d array

Spike train.

fsint, optional, default: 1000

The sampling rate of the computed spike train, in Hz.

start_timefloat, optional

The initial start time for the converted spike times.

Returns:
spikes1d array

Spike times, in seconds.

Examples

Convert a spike train into spike times:

>>> spike_train = np.array([0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1])
>>> convert_train_to_times(spike_train)
array([0.004, 0.006, 0.009, 0.011, 0.012, 0.014])