File: examples-misc_I-F_curve2.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 (43 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
.. currentmodule:: brian

.. index::
   pair: example usage; NeuronGroup
   pair: example usage; run
   pair: example usage; plot
   pair: example usage; show
   pair: example usage; linspace
   pair: example usage; SpikeCounter

.. _example-misc_I-F_curve2:

Example: I-F_curve2 (misc)
==========================

Input-Frequency curve of a IF model
Network: 1000 unconnected integrate-and-fire neurons (leaky IF)
with an input parameter v0.
The input is set differently for each neuron.
Spikes are sent to a spike counter (counts the spikes emitted by each neuron).

::

    from brian import *
    
    N = 1000
    tau = 10 * ms
    eqs = '''
    dv/dt=(v0-v)/tau : volt
    v0 : volt
    '''
    group = NeuronGroup(N, model=eqs, threshold=10 * mV, reset=0 * mV, refractory=5 * ms)
    group.v = 0 * mV
    group.v0 = linspace(0 * mV, 20 * mV, N)
    
    counter = SpikeCounter(group)
    
    duration = 5 * second
    run(duration)
    plot(group.v0 / mV, counter.count / duration)
    show()