File: examples-misc_two_neurons.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 (40 lines) | stat: -rw-r--r-- 986 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
.. currentmodule:: brian

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

.. _example-misc_two_neurons:

Example: two_neurons (misc)
===========================

Two connected neurons with delays

::

    from brian import *
    tau = 10 * ms
    w = -1 * mV
    v0 = 11 * mV
    neurons = NeuronGroup(2, model='dv/dt=(v0-v)/tau : volt', threshold=10 * mV, reset=0 * mV, \
                        max_delay=5 * ms)
    neurons.v = rand(2) * 10 * mV
    W = Connection(neurons, neurons, 'v', delay=2 * ms)
    W[0, 1] = w
    W[1, 0] = w
    S = StateMonitor(neurons, 'v', record=True)
    #mymonitor=SpikeMonitor(neurons[0])
    mymonitor = PopulationSpikeCounter(neurons)
    
    run(500 * ms)
    plot(S.times / ms, S[0] / mV)
    plot(S.times / ms, S[1] / mV)
    show()