Debian Codegraph @

examples/frompapers/Touboul_Brette_2008.py

raw
1 #!/usr/bin/env python
2 """
3 Chaos in the AdEx model
4 -----------------------
5 Fig. 8B from:
6 Touboul, J. and Brette, R. (2008). Dynamics and bifurcations of the adaptive
7 exponential integrate-and-fire model. Biological Cybernetics 99(4-5):319-34.
8
9 This shows the bifurcation structure when the reset value is varied
10 (vertical axis shows the values of w at spike times for a given a reset value
11 Vr).
12 """
13 from brian2 import *
14
15 defaultclock.dt = 0.01*ms
16
17 C = 281*pF
18 gL = 30*nS
19 EL = -70.6*mV
20 VT = -50.4*mV
21 DeltaT = 2*mV
22 tauw = 40*ms
23 a = 4*nS
24 b = 0.08*nA
25 I = .8*nA
26 Vcut = VT + 5 * DeltaT # practical threshold condition
27 N = 200
28
29 eqs = """
30 dvm/dt=(gL*(EL-vm)+gL*DeltaT*exp((vm-VT)/DeltaT)+I-w)/C : volt
31 dw/dt=(a*(vm-EL)-w)/tauw : amp
32 Vr:volt
33 """
34
35 neuron = NeuronGroup(N, model=eqs, threshold='vm > Vcut',
36 reset="vm = Vr; w += b", method='euler')
37 neuron.vm = EL
38 neuron.w = a * (neuron.vm - EL)
39 neuron.Vr = linspace(-48.3 * mV, -47.7 * mV, N) # bifurcation parameter
40
41 init_time = 3*second
42 run(init_time, report='text') # we discard the first spikes
43
44 states = StateMonitor(neuron, "w", record=True, when='start')
45 spikes = SpikeMonitor(neuron)
46 run(1 * second, report='text')
47
48 # Get the values of Vr and w for each spike
49 Vr = neuron.Vr[spikes.i]
50 w = states.w[spikes.i, int_((spikes.t-init_time)/defaultclock.dt)]
51
52 figure()
53 plot(Vr / mV, w / nA, '.k')
54 xlabel('Vr (mV)')
55 ylabel('w (nA)')
56 show()