-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmalltestcase.py
60 lines (49 loc) · 1.37 KB
/
smalltestcase.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
# https://github.com/nest/nest-simulator/issues/1581
import nest
import nest.topology as topology
import multiprocessing
local_num_threads = 1
multiprocessing_flag = True
conn_ee_dict = {
"connection_type": "divergent",
"mask": {
"circular": {
"radius": 0.1
}
},
'kernel': {
'gaussian': {
'p_center': 1.0,
'sigma': 0.15
}
},
"weights": 0.1
}
layer_excitatory_dict = {
"extent": [1.1, 1.1],
"rows": 100,
"columns": 100,
"elements": "iaf_psc_alpha"
}
nest.ResetKernel()
nest.SetKernelStatus({"local_num_threads": local_num_threads})
layer1 = topology.CreateLayer(layer_excitatory_dict)
layer2 = topology.CreateLayer(layer_excitatory_dict)
connections = [
(layer1, layer1, conn_ee_dict, 1),
(layer1, layer2, conn_ee_dict, 2),
(layer2, layer2, conn_ee_dict, 3),
(layer2, layer1, conn_ee_dict, 4)
]
# Process the connections.
def parallel_topology_connect(parameters):
[pre, post, projection, number] = parameters
print(f"Connection number: {number}")
topology.ConnectLayers(pre, post, projection)
if multiprocessing_flag:
pool = multiprocessing.Pool(processes=4)
pool.map(parallel_topology_connect, connections)
else:
for [pre, post, projection, number] in connections:
topology.ConnectLayers(pre, post, projection)
#nest.Simulate(50)