File: examples-twister_QuentinPauluis.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 (87 lines) | stat: -rw-r--r-- 2,373 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
.. currentmodule:: brian

.. index::
   pair: example usage; subplot
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; show
   pair: example usage; raster_plot
   pair: example usage; Connection
   pair: example usage; SpikeMonitor
   pair: example usage; ylabel
   pair: example usage; xlabel
   pair: example usage; NeuronGroup
   pair: example usage; Equations
   pair: example usage; legend
   pair: example usage; StateMonitor

.. _example-twister_QuentinPauluis:

Example: QuentinPauluis (twister)
=================================

Quentin Pauluis's entry for the 2012 Brian twister.

::

    from brian import *
    
    taum = 20 * ms          # membrane time constant
    taue = 5 * ms          # excitatory synaptic time constant
    taui = 10 * ms          # inhibitory synaptic time constant
    Vt = -50 * mV          # spike threshold
    Vr = -60 * mV          # reset value
    El = -49 * mV          # resting potential
    we = (60 * 0.27 / 10) * mV # excitatory synaptic weight
    wi = (20 * 4.5 / 10) * mV # inhibitory synaptic weight
    eqs = Equations('''
            dV/dt  = (ge-gi-(V-El))/taum : volt
            dge/dt = -ge/taue            : volt
            dgi/dt = -gi/taui            : volt
            ''')
    G = NeuronGroup(4000, model=eqs, threshold=Vt, reset=Vr)
    Ge = G.subgroup(3200) # Excitatory neurons
    Gi = G.subgroup(800)  # Inhibitory neurons
    Ce = Connection(Ge, G, 'ge', sparseness=0.2, weight=we)
    
    Ci = Connection(Gi, G, 'gi', sparseness=0.2, weight=wi*10)
    Cii=Connection(Gi,Gi,'gi',sparseness=0.2, weight=wi)
    M = SpikeMonitor(G)
    E=SpikeMonitor(Ge,'+')
    I=SpikeMonitor(Gi,'o')
    MV = StateMonitor(G, 'V', record=0)
    Mge = StateMonitor(G, 'ge', record=0)
    Mgi = StateMonitor(G, 'gi', record=0)
    G.V = Vr + (Vt - Vr) * rand(len(G))
    run(2500 * ms)
    subplot(211)
    raster_plot(M, title='The CUBA network', newfigure=False)
    raster_plot(E)
    raster_plot(I)
    subplot(223)
    plot(MV.times / ms, MV[0] / mV)
    xlabel('Time (ms)')
    ylabel('V (mV)')
    subplot(224)
    plot(Mge.times / ms, Mge[0] / mV)
    plot(Mgi.times / ms, Mgi[0] / mV)
    xlabel('Time (ms)')
    ylabel('ge and gi (mV)')
    legend(('ge', 'gi'), 'upper right')
    show()
    #new.Figure