File: examples-misc_COBA.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 (86 lines) | stat: -rw-r--r-- 2,701 bytes parent folder | download | duplicates (2)
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
.. currentmodule:: brian

.. index::
   pair: example usage; PopulationSpikeCounter
   pair: example usage; Connection
   pair: example usage; Equations
   pair: example usage; run
   pair: example usage; NeuronGroup

.. _example-misc_COBA:

Example: COBA (misc)
====================

This is a Brian script implementing a benchmark described
in the following review paper:

Simulation of networks of spiking neurons: A review of tools and strategies (2007).
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 23(3):349-98

Benchmark 1: random network of integrate-and-fire neurons with exponential synaptic conductances

Clock-driven implementation with Euler integration
(no spike time interpolation)

R. Brette - Dec 2007
--------------------------------------------------------------------------------------
Brian is a simulator for spiking neural networks written in Python, developed by
R. Brette and D. Goodman.
http://brian.di.ens.fr

::

    
    from brian import *
    import time
    
    # Time constants
    taum = 20 * msecond
    taue = 5 * msecond
    taui = 10 * msecond
    # Reversal potentials
    Ee = (0. + 60.) * mvolt
    Ei = (-80. + 60.) * mvolt
    
    start_time = time.time()
    eqs = Equations('''
    dv/dt = (-v+ge*(Ee-v)+gi*(Ei-v))*(1./taum) : volt
    dge/dt = -ge*(1./taue) : 1
    dgi/dt = -gi*(1./taui) : 1 
    ''')
    # NB 1: conductances are in units of the leak conductance
    # NB 2: multiplication is faster than division
    
    P = NeuronGroup(4000, model=eqs, threshold=10 * mvolt, \
                  reset=0 * mvolt, refractory=5 * msecond,
                  order=1, compile=True)
    Pe = P.subgroup(3200)
    Pi = P.subgroup(800)
    we = 6. / 10. # excitatory synaptic weight (voltage)
    wi = 67. / 10. # inhibitory synaptic weight
    Ce = Connection(Pe, P, 'ge', weight=we, sparseness=0.02)
    Ci = Connection(Pi, P, 'gi', weight=wi, sparseness=0.02)
    # Initialization
    P.v = (randn(len(P)) * 5 - 5) * mvolt
    P.ge = randn(len(P)) * 1.5 + 4
    P.gi = randn(len(P)) * 12 + 20
    
    # Record the number of spikes
    Me = PopulationSpikeCounter(Pe)
    Mi = PopulationSpikeCounter(Pi)
    
    print "Network construction time:", time.time() - start_time, "seconds"
    print "Simulation running..."
    start_time = time.time()
    
    run(1 * second)
    duration = time.time() - start_time
    print "Simulation time:", duration, "seconds"
    print Me.nspikes, "excitatory spikes"
    print Mi.nspikes, "inhibitory spikes"