File: examples-frompapers_Brette_2004.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (57 lines) | stat: -rw-r--r-- 1,431 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.. currentmodule:: brian

.. index::
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; show
   pair: example usage; yticks
   pair: example usage; xlabel
   pair: example usage; linspace
   pair: example usage; ylabel
   pair: example usage; SpikeMonitor
   pair: example usage; NeuronGroup

.. _example-frompapers_Brette_2004:

Example: Brette_2004 (frompapers)
=================================

Phase locking in leaky integrate-and-fire model
-----------------------------------------------
Fig. 2A from:
Brette R (2004). Dynamics of one-dimensional spiking neuron models.
J Math Biol 48(1): 38-56.

This shows the phase-locking structure of a LIF driven by a sinusoidal
current. When the current crosses the threshold (a<3), the model
almost always phase locks (in a measure-theoretical sense).

::

    from brian import *
    
    #defaultclock.dt=0.01*ms # for a more precise picture
    N=2000
    tau=100*ms
    freq=1/tau
    
    eqs='''
    dv/dt=(-v+a+2*sin(2*pi*t/tau))/tau : 1
    a : 1
    '''
    
    neurons=NeuronGroup(N,eqs,threshold=1,reset=0)
    neurons.a=linspace(2,4,N)
    
    run(5*second,report='text') # discard the first spikes (wait for convergence)
    S=SpikeMonitor(neurons)
    run(5*second,report='text')
    
    i,t=zip(*S.spikes)
    plot((t % tau)/tau,i,'.')
    xlabel('Spike phase')
    ylabel('Parameter a')
    yticks([0,N/2,N],[2,3,4])
    show()