-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (34 loc) · 1.05 KB
/
main.py
File metadata and controls
51 lines (34 loc) · 1.05 KB
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
import network
import argparse
import datetime
import scipy.stats as stat
import matplotlib.pyplot as plot
def main():
k = 100
time_max = 1000
spikes = []
times = []
fig = plot.figure(figsize=(6,6))
ax1 = fig.add_subplot(111)
t0 = datetime.datetime.now()
net = network.Network(7 * k, 3 * k)
t1 = datetime.datetime.now()
print('configured network in:', t1 - t0)
t0 = datetime.datetime.now()
for t in range(time_max):
net.input[0 : net.numEx] = 5.0 * stat.norm.rvs(size=net.numEx)
net.input[net.numEx : ] = 2.0 * stat.norm.rvs(size=net.numIn)
tmp = net.update()
for n in tmp:
spikes.append(n)
times.append(t)
t1 = datetime.datetime.now()
print('simulated', time_max, 'steps in: ', t1 - t0)
ax1.plot(times, spikes, ',k')
xl, xr = ax1.get_xlim()
yb, yt = ax1.get_ylim()
ax1.set_aspect(abs((xr - xl) / (yb - yt)) * 1.0)
ax1.axhline(color='r', y=net.numEx - 0.5, xmax=time_max)
plot.show()
if __name__ == "__main__":
main()