File: examples-synapses_short_term_plasticity2.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 (79 lines) | stat: -rw-r--r-- 1,806 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
.. currentmodule:: brian

.. index::
   pair: example usage; subplot
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; trace
   pair: example usage; title
   pair: example usage; show
   pair: example usage; rate
   pair: example usage; Synapses
   pair: example usage; linspace
   pair: example usage; NeuronGroup
   pair: example usage; StateMonitor

.. _example-synapses_short_term_plasticity2:

Example: short_term_plasticity2 (synapses)
==========================================

Example with short term plasticity,
with event-driven updates defined by differential equations.

::

    from brian import *
    
    tau_e = 3 * ms
    taum = 10 * ms
    A_SE = 250 * pA
    Rm = 100 * Mohm
    N = 10
    
    eqs = '''
    dx/dt=rate : 1
    rate : Hz
    '''
    
    input = NeuronGroup(N, model=eqs, threshold=1., reset=0)
    input.rate = linspace(5 * Hz, 30 * Hz, N)
    
    eqs_neuron = '''
    dv/dt=(Rm*i-v)/taum:volt
    di/dt=-i/tau_e:amp
    '''
    neuron = NeuronGroup(N, model=eqs_neuron)
    
    taud=1*ms
    tauf=100*ms
    U=.1
    #taud=100*ms
    #tauf=10*ms
    #U=.6
    S=Synapses(input,neuron,
               model='''w : 1
                        dx/dt=(1-x)/taud : 1 (event-driven)
                        du/dt=(U-u)/tauf : 1 (event-driven)
                     ''',
               pre='''i+=w*u*x
                      x*=(1-u)
                      u+=U*(1-u)''')
    S[:,:]='i==j' # one to one connection
    S.w=A_SE
    # Initialization of STP variables
    S.x = 1
    S.u = U
    
    trace = StateMonitor(neuron, 'v', record=[0, N - 1])
    
    run(1000 * ms)
    subplot(211)
    plot(trace.times / ms, trace[0] / mV)
    title('Vm')
    subplot(212)
    plot(trace.times / ms, trace[N - 1] / mV)
    title('Vm')
    show()