File: examples-misc_adaptive_threshold.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 (49 lines) | stat: -rw-r--r-- 1,007 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
.. currentmodule:: brian

.. index::
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; show
   pair: example usage; Connection
   pair: example usage; PoissonGroup
   pair: example usage; NeuronGroup
   pair: example usage; StateMonitor

.. _example-misc_adaptive_threshold:

Example: adaptive_threshold (misc)
==================================

A model with adaptive threshold (increases with each spike)

::

    from brian import *
    
    eqs = '''
    dv/dt = -v/(10*ms) : volt
    dvt/dt = (10*mV-vt)/(15*ms) : volt
    '''
    
    reset = '''
    v=0*mV
    vt+=3*mV
    '''
    
    IF = NeuronGroup(1, model=eqs, reset=reset, threshold='v>vt')
    IF.rest()
    PG = PoissonGroup(1, 500 * Hz)
    
    C = Connection(PG, IF, 'v', weight=3 * mV)
    
    Mv = StateMonitor(IF, 'v', record=True)
    Mvt = StateMonitor(IF, 'vt', record=True)
    
    run(100 * ms)
    
    plot(Mv.times / ms, Mv[0] / mV)
    plot(Mvt.times / ms, Mvt[0] / mV)
    
    show()