File: examples-misc_leaky_if.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (46 lines) | stat: -rw-r--r-- 1,107 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
.. currentmodule:: brian

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

.. _example-misc_leaky_if:

Example: leaky_if (misc)
========================

A very simple example Brian script to show how to implement
a leaky integrate and fire model. In this example, we also
drive the single leaky integrate and fire neuron with
regularly spaced spikes from the :class:`SpikeGeneratorGroup`.

::

    from brian import *
    
    tau = 10 * ms
    Vr = -70 * mV
    Vt = -55 * mV
    
    G = NeuronGroup(1, model='dV/dt = -(V-Vr)/tau : volt', threshold=Vt, reset=Vr)
    
    spikes = [(0, t*second) for t in linspace(10 * ms, 100 * ms, 25)]
    input = SpikeGeneratorGroup(1, spikes)
    
    C = Connection(input, G)
    C[0, 0] = 5 * mV
    
    M = StateMonitor(G, 'V', record=True)
    
    G.V = Vr
    run(100 * ms)
    plot(M.times / ms, M[0] / mV)
    show()