File: examples-misc_if.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 (45 lines) | stat: -rw-r--r-- 1,026 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
.. 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_if:

Example: if (misc)
==================

A very simple example Brian script to show how to implement
an integrate and fire model. In this example, we also
drive the single 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='V:volt', threshold=Vt, reset=Vr)
    
    input = SpikeGeneratorGroup(1, [(0, t * ms) for t in linspace(10, 100, 25)])
    
    C = Connection(input, G)
    C[0, 0] = 2 * mV
    
    M = StateMonitor(G, 'V', record=True)
    
    G.V = Vr
    run(100 * ms)
    plot(M.times / ms, M[0] / mV)
    show()