-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathbrainopy_example2.py
31 lines (24 loc) · 1.39 KB
/
brainopy_example2.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
from brainopy import brainopy
b = brainopy("brain.db")
b.logging = True
neurotransmitters = {"Ach": "acetylcholine",
"DA": "dopamine",
"GLU": "glutamate",
"NE": "norepinephrine",
"5HT": "serotonin",
"GABA": "gamma-Aminobutyric acid"}
b.addNeurotransmitters(neurotransmitters)
neuron_names = ["N1", "N2", "N3", "N4", "N5", "N6", "N7", "N8", "N9", "N10"]
neuronList = [b.addNamedNeuron(name) for name in neuron_names]
print("Neuron List: " + str(neuronList))
synapse_names = ["S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "S10"]
synapseList = [b.addNamedSynapse(name) for name in synapse_names]
print("Synapse List: " + str(synapseList))
stapled_neuronIDs = [[neuronList[0][0], neuronList[1][0]], [neuronList[2][0], neuronList[3][0]],
[neuronList[4][0], neuronList[5][0]], [neuronList[6][0], neuronList[7][0]],
[neuronList[8][0], neuronList[9][0]]]
linkages = [b.stapleNeurons(neuron_pair[0], neuron_pair[1], "ID") for neuron_pair in stapled_neuronIDs]
print("Stapled neurons (by IDs): " + str(linkages))
stapled_neuronNames = [["N1", "N3"], ["N5", "N7"], ["N9", "N1"], ["N4", "N6"], ["N7", "N9"]]
linkages = [b.stapleNeurons(neuron_pair[0], neuron_pair[1], "name") for neuron_pair in stapled_neuronNames]
print("Stapled neurons (by names): " + str(linkages))