-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathring_attractor.py
68 lines (45 loc) · 1.43 KB
/
ring_attractor.py
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
65
66
67
68
from brian import *
taum = 20 * ms # membrane time constant
taue = 5 * ms # excitatory synaptic time constant
taui = 10 * ms # inhibitory synaptic time constant
Vt = -50 * mV # spike threshold
Vr = -60 * mV # reset value
El = -49 * mV # resting potential
we = (60 * 0.27 / 10) * mV # excitatory synaptic weight
wi = (20 * 4.5 / 10) * mV # inhibitory synaptic weight
n = 40
eqs = Equations('''
dV/dt = (ge-gi-(V-El))/taum : volt
dge/dt = -ge/taue : volt
dgi/dt = -gi/taui : volt
''')
spiketimes = [(0, 1 * ms),(0, 10 * ms)]
G_input = SpikeGeneratorGroup(2, spiketimes)
G_ring = NeuronGroup(N=n, model=eqs, threshold=Vt, reset=Vr)
C1 = Connection(G_input, G_ring, 'ge')
C2 = Connection(G_ring, G_ring, 'ge')
C_ring_i = Connection(G_ring, G_ring, 'ge')
C1[0, 0] = 3 * mV
for i in range(0,n):
C2[i, (i+1)%n] = 3 * mV
M = SpikeMonitor(G_ring)
MV = StateMonitor(G_ring, 'V', record=True)
Mge = StateMonitor(G_ring, 'ge', record=True)
G_ring.V = Vr + (Vt - Vr) * rand(len(G_ring))
run(1000 * ms)
figure()
subplot(211)
raster_plot(M, title='The ring attractor network', newfigure=False)
subplot(223)
plot(MV.times / ms, MV[0] / mV)
plot(MV.times / ms, MV[10] / mV)
subplot(224)
plot(Mge.times / ms, Mge[0] / mV)
show()
#subplot(211)
#plot(Mv.times, Mv[0])
#subplot(212)
#plot(Mge.times, Mge[0])
#show()
#raster_plot(Mb, title='The Ring network')
#show()