File: examples-misc_I-F_curve.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 (59 lines) | stat: -rw-r--r-- 1,561 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
.. currentmodule:: brian

.. index::
   pair: example usage; subplot
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; trace
   pair: example usage; show
   pair: example usage; IdentityConnection
   pair: example usage; Current
   pair: example usage; xlabel
   pair: example usage; linspace
   pair: example usage; ylabel
   pair: example usage; NeuronGroup
   pair: example usage; StateMonitor

.. _example-misc_I-F_curve:

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

Input-Frequency curve of a neuron (cortical RS type)
Network: 1000 unconnected integrate-and-fire neurons (Brette-Gerstner)
with an input parameter I.
The input is set differently for each neuron.
Spikes are sent to a 'neuron' group with the same size and variable n,
which has the role of a spike counter.

::

    from brian import *
    from brian.library.IF import *
    
    N = 1000
    eqs = Brette_Gerstner() + Current('I:amp')
    print eqs
    group = NeuronGroup(N, model=eqs, threshold= -20 * mV, reset=AdaptiveReset())
    group.vm = -70 * mV
    group.I = linspace(0 * nA, 1 * nA, N)
    
    counter = NeuronGroup(N, model='n:1')
    C = IdentityConnection(group, counter, 'n')
    
    i = N * 8 / 10
    trace = StateMonitor(group, 'vm', record=i)
    
    duration = 5 * second
    run(duration)
    subplot(211)
    plot(group.I / nA, counter.n / duration)
    xlabel('I (nA)')
    ylabel('Firing rate (Hz)')
    subplot(212)
    plot(trace.times / ms, trace[i] / mV)
    xlabel('Time (ms)')
    ylabel('Vm (mV)')
    show()