| 1 |
#!/usr/bin/env python |
| 2 |
""" |
| 3 |
Phase locking in leaky integrate-and-fire model |
| 4 |
----------------------------------------------- |
| 5 |
Fig. 2A from: |
| 6 |
|
| 7 |
Brette R (2004). Dynamics of one-dimensional spiking neuron models. |
| 8 |
J Math Biol 48(1): 38-56. |
| 9 |
|
| 10 |
This shows the phase-locking structure of a LIF driven by a sinusoidal |
| 11 |
current. When the current crosses the threshold (a<3), the model |
| 12 |
almost always phase locks (in a measure-theoretical sense). |
| 13 |
""" |
| 14 |
from brian2 import * |
| 15 |
|
| 16 |
# defaultclock.dt = 0.01*ms # for a more precise picture |
| 17 |
N = 2000 |
| 18 |
tau = 100*ms |
| 19 |
freq = 1/tau |
| 20 |
|
| 21 |
eqs = ''' |
| 22 |
dv/dt = (-v + a + 2*sin(2*pi*t/tau))/tau : 1 |
| 23 |
a : 1 |
| 24 |
''' |
| 25 |
|
| 26 |
neurons = NeuronGroup(N, eqs, threshold='v>1', reset='v=0', method='euler') |
| 27 |
neurons.a = linspace(2, 4, N) |
| 28 |
|
| 29 |
run(5*second, report='text') # discard the first spikes (wait for convergence) |
| 30 |
S = SpikeMonitor(neurons) |
| 31 |
run(5*second, report='text') |
| 32 |
|
| 33 |
i, t = S.it |
| 34 |
plot((t % tau)/tau, neurons.a[i], ',') |
| 35 |
xlabel('Spike phase') |
| 36 |
ylabel('Parameter a') |
| 37 |
show() |