File: examples-synapses_probabilistic_synapses.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 (48 lines) | stat: -rw-r--r-- 1,150 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
.. currentmodule:: brian

.. index::
   pair: example usage; plot
   pair: example usage; run
   pair: example usage; show
   pair: example usage; PoissonGroup
   pair: example usage; Synapses
   pair: example usage; linspace
   pair: example usage; NeuronGroup
   pair: example usage; StateMonitor

.. _example-synapses_probabilistic_synapses:

Example: probabilistic_synapses (synapses)
==========================================

Probabilistic synapses

Seems to work.

::

    from brian import *
    
    N=20
    tau=5*ms
    input=PoissonGroup(2,rates=20*Hz)
    neurons=NeuronGroup(N,model='dv/dt=-v/tau : 1')
    
    S=Synapses(input,neurons,model="""w : 1
                                      p : 1 # transmission probability""",
                             pre="v+=w*(rand()<p)")
    # Transmission probabilities
    S[:,:]=True
    S.w=0.5
    S.p[0,:]=linspace(0,1,N) # transmission probability between 0 and 1
    S.p[1,:]=linspace(0,1,N)[::-1] # reverse order for the second input
    
    M=StateMonitor(neurons,'v',record=True)
    
    run(500*ms)
    
    for i in range(N):
        plot(M.times/ms,M[i]+i,'k')
    show()