-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathExample1.py
56 lines (35 loc) · 1.57 KB
/
Example1.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
from neuromllite import Network, Population, Projection, RandomConnectivity
################################################################################
### Build a new network
net = Network(id="net0")
net.notes = (
"A simple network with 2 populations & projection between them. "
+ "No info yet on what the cells are so network can't be simulated."
)
print(net)
################################################################################
### Add some populations
p0 = Population(id="pop0", size=5, component="iaf", properties={"color": "0 .8 0"})
p1 = Population(id="pop1", size=10, component="iaf", properties={"color": "0 0 .8"})
print(p1.to_json())
net.populations.append(p0)
net.populations.append(p1)
################################################################################
### Add a projection
net.projections.append(
Projection(id="proj0", presynaptic=p0.id, postsynaptic=p1.id, synapse="ampa")
)
net.projections[0].random_connectivity = RandomConnectivity(probability=0.5)
################################################################################
### Save to JSON format
print(net)
net.id = "TestNetwork"
print(net.to_json())
new_file = net.to_json_file("Example1_%s.json" % net.id)
################################################################################
### Export to some formats, e.g. try:
### python Example1.py -graph2
from neuromllite.NetworkGenerator import check_to_generate_or_run
from neuromllite import Simulation
import sys
check_to_generate_or_run(sys.argv, Simulation(id="SimExample1", network=new_file))