File: examples-misc_noisy_ring.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 (58 lines) | stat: -rw-r--r-- 1,148 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
.. 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; raster_plot
   pair: example usage; Connection
   pair: example usage; SpikeMonitor
   pair: example usage; NeuronGroup
   pair: example usage; StateMonitor

.. _example-misc_noisy_ring:

Example: noisy_ring (misc)
==========================

Integrate-and-fire neurons with noise

::

    from brian import *
    
    tau = 10 * ms
    sigma = .5
    N = 100
    J = -1
    mu = 2
    
    eqs = """
    dv/dt=mu/tau+sigma/tau**.5*xi : 1
    """
    
    group = NeuronGroup(N, model=eqs, threshold=1, reset=0)
    
    C = Connection(group, group, 'v')
    for i in range(N):
        C[i, (i + 1) % N] = J
    
    #C.connect_full(group,group,weight=J)
    #for i in range(N):
    #    C[i,i]=0
    
    S = SpikeMonitor(group)
    trace = StateMonitor(group, 'v', record=True)
    
    run(500 * ms)
    i, t = S.spikes[-1]
    
    subplot(211)
    raster_plot(S)
    subplot(212)
    plot(trace.times / ms, trace[0])
    show()