Online Computation of Interspike Interval

Hello Brain Community,
I would like to ask if it is possible to compute the interspike interval in an online manner ? and not waiting the network to be simulated and after that compute the aforementioned parameter.
Thank you so much.

Hi @Haydar, I can think of ways to do calculate ISIs online, but could you give a bit more detail about what you want to do? Do you want to use this information during the simulation somehow, or is it just for more convenient access after the simulation? And do you want to calculate all interspike intervals, or are you only interested in e.g. the average interspike interval for each neuron.
Just in case it is helpful, here’s a compact way to calculate a dictionary mapping neuron indices to their ISIs from a SpikeMonitor:

ISIs = {index: np.diff(spikes)
        for index, spikes in spike_monitor.spike_trains().items()}

Thank you for your response.
I would like to use this information during the simulation, more specifically, to activate specific synapses (out of group of synapses) upon the ISI of the pre synaptic neuron.

Thanks for the clarification. The easiest way to directly represent an ISI is to include a variable storing the time of the last spike. Actually, if your model uses refractoriness, then this variable already exists: it is called lastspike (see Refractoriness — Brian 2 2.5.1 documentation). The synaptic action in on_pre can then refer to something like t - lastspike_pre, which is the time since the last spike, i.e. the interspike interval.
If your model does not use refractoriness, you’ll have to define the lastspike variable yourself by including lastspike : second in the equations, and adding lastspike = t to your reset statements.
Hope that helps!

Thank you very much !!

1 Like