Debian Codegraph @

examples/frompapers/Brette_Guigon_2003.py

raw
1 #!/usr/bin/env python
2 """
3 Reliability of spike timing
4 ---------------------------
5 Adapted from Fig. 10D,E of
6
7 Brette R and E Guigon (2003). Reliability of Spike Timing Is a General Property
8 of Spiking Model Neurons. Neural Computation 15, 279-308.
9
10 This shows that reliability of spike timing is a generic property of spiking
11 neurons, even those that are not leaky.
12 This is a non-physiological model which can be leaky or anti-leaky depending
13 on the sign of the input I.
14
15 All neurons receive the same fluctuating input, scaled by a parameter p that
16 varies across neurons. This shows:
17
18 1. reproducibility of spike timing
19 2. robustness with respect to deterministic changes (parameter)
20 3. increased reproducibility in the fluctuation-driven regime (input crosses
21 the threshold)
22 """
23 from brian2 import *
24
25 N = 500
26 tau = 33*ms
27 taux = 20*ms
28 sigma = 0.02
29
30 eqs_input = '''
31 dx/dt = -x/taux + (2/taux)**.5*xi : 1
32 '''
33
34 eqs = '''
35 dv/dt = (v*I + 1)/tau + sigma*(2/tau)**.5*xi : 1
36 I = 0.5 + 3*p*B : 1
37 B = 2./(1 + exp(-2*x)) - 1 : 1 (shared)
38 p : 1
39 x : 1 (linked)
40 '''
41
42 input = NeuronGroup(1, eqs_input, method='euler')
43 neurons = NeuronGroup(N, eqs, threshold='v>1', reset='v=0', method='euler')
44 neurons.p = '1.0*i/N'
45 neurons.v = 'rand()'
46 neurons.x = linked_var(input, 'x')
47
48 M = StateMonitor(neurons, 'B', record=0)
49 S = SpikeMonitor(neurons)
50
51 run(1000*ms, report='text')
52
53 subplot(211) # The input
54 plot(M.t/ms, M[0].B)
55 xticks([])
56 title('shared input')
57 subplot(212)
58 plot(S.t/ms, neurons.p[S.i], ',')
59 plot([0, 1000], [.5, .5], color='C1')
60 xlabel('time (ms)')
61 ylabel('p')
62 title('spiking activity')
63 show()