File: examples-misc_COBAHH.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (105 lines) | stat: -rw-r--r-- 3,105 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.. currentmodule:: brian

.. index::
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; trace
   pair: example usage; show
   pair: example usage; Connection
   pair: example usage; EmpiricalThreshold
   pair: example usage; NeuronGroup
   pair: example usage; Equations
   pair: example usage; StateMonitor

.. _example-misc_COBAHH:

Example: COBAHH (misc)
======================

This is an implementation of a benchmark described
in the following review paper:

Simulation of networks of spiking neurons: A review of tools and strategies (2006).
Brette, Rudolph, Carnevale, Hines, Beeman, Bower, Diesmann, Goodman, Harris, Zirpe,
NatschlAger, Pecevski, Ermentrout, Djurfeldt, Lansner, Rochel, Vibert, Alvarez, Muller,
Davison, El Boustani and Destexhe.
Journal of Computational Neuroscience

Benchmark 3: random network of HH neurons with exponential synaptic conductances

Clock-driven implementation
(no spike time interpolation)

R. Brette - Dec 2007

70s for dt=0.1 ms with exponential Euler

::

    
    from brian import *
    
    # Parameters
    area = 20000 * umetre ** 2
    Cm = (1 * ufarad * cm ** -2) * area
    gl = (5e-5 * siemens * cm ** -2) * area
    El = -60 * mV
    EK = -90 * mV
    ENa = 50 * mV
    g_na = (100 * msiemens * cm ** -2) * area
    g_kd = (30 * msiemens * cm ** -2) * area
    VT = -63 * mV
    # Time constants
    taue = 5 * ms
    taui = 10 * ms
    # Reversal potentials
    Ee = 0 * mV
    Ei = -80 * mV
    we = 6 * nS # excitatory synaptic weight (voltage)
    wi = 67 * nS # inhibitory synaptic weight
    
    # The model
    eqs = Equations('''
    dv/dt = (gl*(El-v)+ge*(Ee-v)+gi*(Ei-v)-\
        g_na*(m*m*m)*h*(v-ENa)-\
        g_kd*(n*n*n*n)*(v-EK))/Cm : volt 
    dm/dt = alpham*(1-m)-betam*m : 1
    dn/dt = alphan*(1-n)-betan*n : 1
    dh/dt = alphah*(1-h)-betah*h : 1
    dge/dt = -ge*(1./taue) : siemens
    dgi/dt = -gi*(1./taui) : siemens
    alpham = 0.32*(mV**-1)*(13*mV-v+VT)/ \
        (exp((13*mV-v+VT)/(4*mV))-1.)/ms : Hz
    betam = 0.28*(mV**-1)*(v-VT-40*mV)/ \
        (exp((v-VT-40*mV)/(5*mV))-1)/ms : Hz
    alphah = 0.128*exp((17*mV-v+VT)/(18*mV))/ms : Hz
    betah = 4./(1+exp((40*mV-v+VT)/(5*mV)))/ms : Hz
    alphan = 0.032*(mV**-1)*(15*mV-v+VT)/ \
        (exp((15*mV-v+VT)/(5*mV))-1.)/ms : Hz
    betan = .5*exp((10*mV-v+VT)/(40*mV))/ms : Hz
    ''')
    
    P = NeuronGroup(4000, model=eqs,
        threshold=EmpiricalThreshold(threshold= -20 * mV,
                                     refractory=3 * ms),
        implicit=True, freeze=True)
    Pe = P.subgroup(3200)
    Pi = P.subgroup(800)
    Ce = Connection(Pe, P, 'ge', weight=we, sparseness=0.02)
    Ci = Connection(Pi, P, 'gi', weight=wi, sparseness=0.02)
    # Initialization
    P.v = El + (randn(len(P)) * 5 - 5) * mV
    P.ge = (randn(len(P)) * 1.5 + 4) * 10. * nS
    P.gi = (randn(len(P)) * 12 + 20) * 10. * nS
    
    # Record the number of spikes and a few traces
    trace = StateMonitor(P, 'v', record=[1, 10, 100])
    
    run(1 * second)
    
    plot(trace[1])
    plot(trace[10])
    plot(trace[100])
    show()