Debian Codegraph @

examples/frompapers/Rossant_et_al_2011bis.py

raw
1 #!/usr/bin/env python
2 """
3 Distributed synchrony example
4 =============================
5 Fig. 14 from:
6
7 Rossant C, Leijon S, Magnusson AK, Brette R (2011).
8 "Sensitivity of noisy neurons to coincident inputs".
9 Journal of Neuroscience, 31(47).
10
11 5000 independent E/I Poisson inputs are injected into a leaky integrate-and-fire neuron.
12 Synchronous events, following an independent Poisson process at 40 Hz, are considered,
13 where 15 E Poisson spikes are randomly shifted to be synchronous at those events.
14 The output firing rate is then significantly higher, showing that the spike timing of
15 less than 1% of the excitatory synapses have an important impact on the postsynaptic firing.
16 """
17 from brian2 import *
18
19 # neuron parameters
20 theta = -55*mV
21 El = -65*mV
22 vmean = -65*mV
23 taum = 5*ms
24 taue = 3*ms
25 taui = 10*ms
26 eqs = Equations("""
27 dv/dt = (ge+gi-(v-El))/taum : volt
28 dge/dt = -ge/taue : volt
29 dgi/dt = -gi/taui : volt
30 """)
31
32 # input parameters
33 p = 15
34 ne = 4000
35 ni = 1000
36 lambdac = 40*Hz
37 lambdae = lambdai = 1*Hz
38
39 # synapse parameters
40 we = .5*mV/(taum/taue)**(taum/(taue-taum))
41 wi = (vmean-El-lambdae*ne*we*taue)/(lambdae*ni*taui)
42
43 # NeuronGroup definition
44 group = NeuronGroup(N=2, model=eqs, reset='v = El',
45 threshold='v>theta',
46 refractory=5*ms, method='exact')
47 group.v = El
48 group.ge = group.gi = 0
49
50 # independent E/I Poisson inputs
51 p1 = PoissonInput(group[0:1], 'ge', N=ne, rate=lambdae, weight=we)
52 p2 = PoissonInput(group[0:1], 'gi', N=ni, rate=lambdai, weight=wi)
53
54 # independent E/I Poisson inputs + synchronous E events
55 p3 = PoissonInput(group[1:], 'ge', N=ne, rate=lambdae-(p*1.0/ne)*lambdac, weight=we)
56 p4 = PoissonInput(group[1:], 'gi', N=ni, rate=lambdai, weight=wi)
57 p5 = PoissonInput(group[1:], 'ge', N=1, rate=lambdac, weight=p*we)
58
59 # run the simulation
60 M = SpikeMonitor(group)
61 SM = StateMonitor(group, 'v', record=True)
62 BrianLogger.log_level_info()
63 run(1*second)
64 # plot trace and spikes
65 for i in [0, 1]:
66 spikes = (M.t[M.i == i] - defaultclock.dt)/ms
67 val = SM[i].v
68 subplot(2, 1, i+1)
69 plot(SM.t/ms, val)
70 plot(tile(spikes, (2, 1)),
71 vstack((val[array(spikes, dtype=int)],
72 zeros(len(spikes)))), 'C0')
73 title("%s: %d spikes/second" % (["uncorrelated inputs", "correlated inputs"][i],
74 M.count[i]))
75 tight_layout()
76 show()