File: examples-misc_topographic_map.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 (64 lines) | stat: -rw-r--r-- 1,787 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
60
61
62
63
64
.. currentmodule:: brian

.. index::
   pair: example usage; subplot
   pair: example usage; NeuronGroup
   pair: example usage; imshow
   pair: example usage; run
   pair: example usage; title
   pair: example usage; raster_plot
   pair: example usage; show
   pair: example usage; Connection
   pair: example usage; PoissonGroup
   pair: example usage; ones
   pair: example usage; SpikeMonitor

.. _example-misc_topographic_map:

Example: topographic_map (misc)
===============================

Topographic map - an example of complicated connections.
Two layers of neurons.
The first layer is connected randomly to the second one in a
topographical way.
The second layer has random lateral connections.

::

    from brian import *
    
    N = 100
    tau = 10 * ms
    tau_e = 2 * ms # AMPA synapse
    eqs = '''
    dv/dt=(I-v)/tau : volt
    dI/dt=-I/tau_e : volt
    '''
    
    rates = zeros(N) * Hz
    rates[N / 2 - 10:N / 2 + 10] = ones(20) * 30 * Hz
    layer1 = PoissonGroup(N, rates=rates)
    layer2 = NeuronGroup(N, model=eqs, threshold=10 * mV, reset=0 * mV)
    
    topomap = lambda i, j:exp(-abs(i - j) * .1) * 3 * mV
    feedforward = Connection(layer1, layer2, sparseness=.5, weight=topomap)
    #feedforward[2,3]=1*mV
    
    lateralmap = lambda i, j:exp(-abs(i - j) * .05) * 0.5 * mV
    recurrent = Connection(layer2, layer2, sparseness=.5, weight=lateralmap)
    
    spikes = SpikeMonitor(layer2)
    
    run(1 * second)
    subplot(211)
    raster_plot(spikes)
    subplot(223)
    imshow(feedforward.W.todense(), interpolation='nearest', origin='lower')
    title('Feedforward connection strengths')
    subplot(224)
    imshow(recurrent.W.todense(), interpolation='nearest', origin='lower')
    title('Recurrent connection strengths')
    show()