Debian Codegraph @

examples/CUBA.py

raw
1 """
2 This is a Brian script implementing a benchmark described
3 in the following review paper:
4
5 Simulation of networks of spiking neurons: A review of tools and strategies
6 (2007). Brette, Rudolph, Carnevale, Hines, Beeman, Bower, Diesmann, Goodman,
7 Harris, Zirpe, Natschlager, Pecevski, Ermentrout, Djurfeldt, Lansner, Rochel,
8 Vibert, Alvarez, Muller, Davison, El Boustani and Destexhe.
9 Journal of Computational Neuroscience 23(3):349-98
10
11 Benchmark 2: random network of integrate-and-fire neurons with exponential
12 synaptic currents.
13
14 Clock-driven implementation with exact subthreshold integration
15 (but spike times are aligned to the grid).
16 """
17 from brian2 import *
18
19 taum = 20*ms
20 taue = 5*ms
21 taui = 10*ms
22 Vt = -50*mV
23 Vr = -60*mV
24 El = -49*mV
25
26 eqs = '''
27 dv/dt = (ge+gi-(v-El))/taum : volt (unless refractory)
28 dge/dt = -ge/taue : volt
29 dgi/dt = -gi/taui : volt
30 '''
31
32 P = NeuronGroup(4000, eqs, threshold='v>Vt', reset='v = Vr', refractory=5*ms,
33 method='exact')
34 P.v = 'Vr + rand() * (Vt - Vr)'
35 P.ge = 0*mV
36 P.gi = 0*mV
37
38 we = (60*0.27/10)*mV # excitatory synaptic weight (voltage)
39 wi = (-20*4.5/10)*mV # inhibitory synaptic weight
40 Ce = Synapses(P, P, on_pre='ge += we')
41 Ci = Synapses(P, P, on_pre='gi += wi')
42 Ce.connect('i<3200', p=0.02)
43 Ci.connect('i>=3200', p=0.02)
44
45 s_mon = SpikeMonitor(P)
46
47 run(1 * second)
48
49 plot(s_mon.t/ms, s_mon.i, ',k')
50 xlabel('Time (ms)')
51 ylabel('Neuron index')
52 show()