# Description of problem

If I generate a Spiking Neural Network(SNN) which consists of multiple neurons ,from BRIAN2 simulator I can easily find the “spike times” and corresponding neuron indexes.**Out of several neurons if I wish to get all the spike times for a particular neuron, how can I find it apart from manual observation of the result? **.Because for small SNN network I can manually collect all the spiking time information for a particular neuron, but say for a network consists 5000 neuron if I want to know all the spiking times of a single neuron (say," neuron 2001") ,manual calculation is very difficult.

# Minimal code to reproduce problem

from brian2 import *
%matplotlib inline
start_scope()
vt=0.8
eqs = ‘’’
dv/dt = (1-v)/tau : 1
tau:second
‘’’
G = NeuronGroup(8,eqs,threshold=‘v>vt’,reset=‘v=0.0’,method=‘euler’)
M=StateMonitor(G,‘v’,record=True)
R=SpikeMonitor(G)
G.v=[0.1 ,0.3,0.4,0.5,0.6,0.7,0.8,0.9]
G.tau=[5,10,15,20,15,25,30,20]ms
run(100
ms)
print(len(R.i))
print(R.i)
print(R.t)

# Full traceback of error (if relevant)

To access all the spike times for a neuron with a certain index, you can use numpy’s boolean indexing functionality. E.g. to get all the spike times for the neuron for index 5, you can use `R.t[R.i == 5]`. If you need to do this for all/many of the neurons, a more efficient method is to use the `SpikeMonitor`'s `spike_trains()` method. It will return you a dictionary of spike times per neuron, which you can then access to get all the spike times for a certain neuron:

``````spike_times = R.spike_trains()
print(spike_times[5])  # spike times for neuron with index 5
``````

A lot of thanks sir. I have understood.