Skip to content

Instantly share code, notes, and snippets.

@ozturkib
Created July 7, 2016 12:22
Show Gist options
  • Save ozturkib/07d2f151a6420c2d4bc35e6745e25f71 to your computer and use it in GitHub Desktop.
Save ozturkib/07d2f151a6420c2d4bc35e6745e25f71 to your computer and use it in GitHub Desktop.
Accessin spike indices and times attributes in SpikeGeneratorGroup object
'''
Created on 7 Jul 2016
@author: io517@york.ac.uk
'''
import brian2
print("brian_version : " + str(brian2.__version__))
from brian2 import *
indices = np.array([0, 2, 1])
times = np.array([1, 2, 3])*1*ms
G = SpikeGeneratorGroup(3, indices, times)
#In order to access spike indices in SpikeGeneratorGroup object, "neuron_index" attribute should be used.
print("indices : " + str(G.neuron_index[:]))
#In order to access spike times in SpikeGeneratorGroup object, "spike_time" attribute should be used.
print("times : " + str(G.spike_time[:]))
Minput = SpikeMonitor(G)
run(10*ms)
print("Monitored times : " + str(Minput.t[:]))
@ozturkib
Copy link
Author

ozturkib commented Jul 7, 2016

Output :

brian_version : 2.0rc3
indices : [0 2 1]
times : [ 1.  2.  3.] ms
Monitored times : [ 1.  2.  3.] ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment