Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
a0970dc
Merge pull request #2 from AllenInstitute/master
pgleeson Sep 25, 2018
5aaec68
Merge pull request #5 from AllenInstitute/master
pgleeson Oct 1, 2018
f5a3518
Merge pull request #6 from AllenInstitute/master
pgleeson Oct 2, 2018
d4a8e13
Merge branch 'master' of github.com:AllenInstitute/sonata
pgleeson Oct 16, 2018
1bba63e
Morphologies reoriented and recentered
Oct 26, 2018
c1696f9
Rotate cells only around Y-axis in the 300 cell example for better ap…
Oct 26, 2018
e2f05de
Merge branch 'master' of github.com:AllenInstitute/sonata
pgleeson Nov 19, 2018
7b87077
Merge pull request #8 from AllenInstitute/sim_tests_dontmerge
pgleeson Nov 20, 2018
42b1336
Initial test on intfire
pgleeson Nov 20, 2018
dbb11f0
File
pgleeson Nov 20, 2018
a748c5c
Running example
pgleeson Nov 20, 2018
ebc19eb
Regenerated
pgleeson Nov 20, 2018
f197376
Updates to config files: "node_sets_file": "$BASE_DIR/node_sets.json"
pgleeson Nov 20, 2018
9e94d6d
Another example
pgleeson Nov 20, 2018
c7dc10f
Specify how to represent node types when `target_simulator` is "NEST"…
apdavison Nov 27, 2018
3de5422
Updating pysonata code
kaeldai Nov 28, 2018
8d601a3
Merge pull request #69 from kaeldai/feature/pysonata_update
kaeldai Nov 28, 2018
3ceb05d
Fixing so that all examples use model_name instead of pop_name
kaeldai Nov 28, 2018
cb9c519
Merge pull request #71 from kaeldai/fix/issue44
kaeldai Nov 28, 2018
f20f4a3
updating setup metadata for pypi
kaeldai Nov 28, 2018
9e4501e
Merge branch 'master' of https://github.com/AllenInstitute/sonata
kaeldai Nov 28, 2018
9ba0afb
Merge pull request #72 from kaeldai/master
kaeldai Nov 28, 2018
13506a1
Add test script to check examples
pgleeson Nov 29, 2018
8ee5ea3
Merge branch 'master' of github.com:AllenInstitute/sonata
pgleeson Nov 29, 2018
300ceb6
Merge branch 'master' of github.com:AllenInstitute/sonata into tests
pgleeson Nov 29, 2018
a5791ed
Renaming 10_cells -> ten_cells
pgleeson Nov 29, 2018
82cc1a8
Preliminary 10 cell spiker
pgleeson Dec 3, 2018
5d71d3c
Better ten cells spikes
pgleeson Dec 3, 2018
e6f63b5
Removing GIDs from the spec
Oct 29, 2018
0c30e1e
Retested
pgleeson Dec 18, 2018
e285d6b
Consolidate analysis script
pgleeson Dec 18, 2018
0dde848
analyse output script for 300 cell example
pgleeson Dec 18, 2018
c4829c1
Added enumeration datatypes to the spec
arsenius7 Dec 20, 2018
7bec1fb
Lowercase MAY / SHOULD
arsenius7 Dec 21, 2018
a3f64d1
Update docs/SONATA_DEVELOPER_GUIDE.md
Dec 21, 2018
48aea41
Update docs/SONATA_DEVELOPER_GUIDE.md
Dec 21, 2018
f404d55
Update docs/SONATA_DEVELOPER_GUIDE.md
Dec 21, 2018
cb0489d
Update docs/SONATA_DEVELOPER_GUIDE.md
Dec 21, 2018
3c17d11
Update SONATA_DEVELOPER_GUIDE.md
arsenius7 Dec 21, 2018
0014291
Update SONATA_DEVELOPER_GUIDE.md
arsenius7 Dec 21, 2018
b12e201
Node attribute for specifying orientations with quaternions.
Dec 20, 2018
6280118
Update SONATA_DEVELOPER_GUIDE.md
arsenius7 Jan 24, 2019
f82ab3e
Fixing 5_cells_iclamp example to use NeuroML files
Jan 30, 2019
8200b1c
Merge pull request #9 from AllenInstitute/master
pgleeson Jan 30, 2019
efe3f8c
Merge pull request #86 from kaeldai/fix/5_cells_nml
kaeldai Jan 30, 2019
456e61e
Adding pySONATA notebook tutorials and some api improvements
kaeldai Feb 7, 2019
eb7e65e
merging from master
kaeldai Feb 7, 2019
c0a1316
Adding magic and version to unit test files
kaeldai Feb 7, 2019
b4fb6cb
Merge pull request #89 from kaeldai/feature/pysonata_tutorial
kaeldai Feb 7, 2019
0ee3ad5
Adding 300 NEST example
kaeldai Feb 7, 2019
21c9856
Merge pull request #10 from AllenInstitute/master
pgleeson Feb 13, 2019
0bfcb87
Merge branch 'master' into tests
pgleeson Feb 13, 2019
efc3f65
Merge pull request #11 from kaeldai/feature/300_pointneurons
pgleeson Feb 13, 2019
12b1886
Add test on 300_pointneurons
pgleeson Feb 19, 2019
bf5c5fa
Adding another example for testing on nest
pgleeson Feb 19, 2019
a7952a7
Add test for new tests
pgleeson Feb 19, 2019
3947218
Minor formatting fixes
Feb 21, 2019
495ed76
Merge pull request #90 from kaeldai/feature/300_pointneurons
kaeldai Feb 21, 2019
c31172f
adding small V1 L4 example
kaeldai Feb 23, 2019
f9a9630
Adding small layer4 example with ~ 450 cells
kaeldai Feb 23, 2019
ec967db
Merge pull request #93 from kaeldai/feature/layer4
kaeldai Feb 28, 2019
c6f9db7
Fixed a discovered issue with L4 positions and rotations. Cleaned up …
kaeldai Mar 2, 2019
9b72ad9
Merge pull request #94 from kaeldai/feature/layer4
kaeldai Mar 2, 2019
4fa7d95
Changes needed to run 300_pointneurons example with PyNN
apdavison Mar 14, 2019
286256c
Merge pull request #12 from AllenInstitute/master
pgleeson Mar 18, 2019
cbe7ba0
Merge branch 'master' into tests
pgleeson Mar 18, 2019
4081375
Tested on latest PyNN
pgleeson Mar 19, 2019
e126994
Merge pull request #13 from apdavison/300_pointneurons
pgleeson Mar 19, 2019
caeaa85
Updated to run in pynn & bmtk...
pgleeson Mar 21, 2019
ad1d46a
Merge pull request #95 from apdavison/300_pointneurons
kaeldai Mar 21, 2019
3f8303c
Merge pull request #15 from AllenInstitute/master
pgleeson Mar 22, 2019
b61f36e
Rename to indicate just runs in nest
pgleeson Mar 22, 2019
dd1a8cd
Renaming for clarity
pgleeson Mar 22, 2019
0ac4386
Updated ten cells nest
pgleeson Mar 26, 2019
5edf865
Update & rearrange
pgleeson Mar 26, 2019
c0b799f
Retested one cell test
pgleeson Apr 11, 2019
d3726cd
Adding test scripts
pgleeson Apr 11, 2019
72684e9
Rename test dir
pgleeson Apr 11, 2019
489ec71
Add output dir
pgleeson Apr 11, 2019
acd3a3e
Renaming files
pgleeson Apr 11, 2019
3ce8a35
Update example
pgleeson Apr 11, 2019
62727a7
Updated example
pgleeson Apr 11, 2019
6d5586b
Update test file
pgleeson Apr 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
**/*.egg-info/
**/*~
src/pysonata/sonata/tests/tmp
src/pysonata/build
src/pysonata/dist
src/pysonata/.pytest_cache
**/mechanisms/x86_64
examples/**/output/log.txt
examples/**/output/config.json
.idea
.cache
**/mechanisms/x86_64
/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/.pytest_cache
/examples/sim_tests/intfire/**/.pytest_cache
.ipynb_checkpoints/
/examples/checkouth5.sh
/examples/300_pointneurons/output/*.dat
/examples/sim_tests/intfire/*/test/x86_64
/examples/sim_tests/intfire/*/test/LEMS*.xml
/examples/sim_tests/intfire/*/test/*.dat
/examples/sim_tests/intfire/*/test/report*txt
/examples/sim_tests/intfire/*/test/*spikes
/examples/sim_tests/intfire/*/test/*.net.nml
/examples/sim_tests/intfire/*/test/*_nrn.py
/examples/sim_tests/intfire/*/test/*.mod
/examples/sim_tests/intfire/*/test/output/*h5
/examples/sim_tests/intfire/*/test/output/log.txt
/examples/sim_tests/intfire/*/test/output/*dat
298 changes: 125 additions & 173 deletions docs/SONATA_DEVELOPER_GUIDE.md

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions examples/300_cells/analyze_output.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys
from bmtk.analyzer.visualization.spikes import plot_spikes


sys.path.append("../sim_tests/shared_components/scripts")

from analyze_output_utils import plot_data

if __name__ == '__main__':

plot_data('output/membrane_potential.h5', 'mV', 'Membrane Potential', show_already=True, max_num_traces=12)
plot_spikes('network/internal_nodes.h5', 'network/internal_node_types.csv', 'output/spikes.h5', group_key='model_name')
2 changes: 1 addition & 1 deletion examples/300_cells/simulation_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"v_init": -80
},

"node_sets_file": "node_sets.json",
"node_sets_file": "$BASE_DIR/node_sets.json",

"inputs": {
"external_spike_trains": {
Expand Down
28 changes: 14 additions & 14 deletions examples/300_intfire/build_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# Step 1: Create a v1 mock network of 14 cells (nodes) with across 7 different cell "types"
net = NetworkBuilder("v1")

net.add_nodes(N=240, pop_name='LIF_exc', location='VisL4', ei='e',
net.add_nodes(N=240, model_name='LIF_exc', location='VisL4', ei='e',
model_type='point_process', # use point_process to indicate were are using point model cells
model_template='nrn:IntFire1', # Tell the simulator to use the NEURON built-in IntFire1 type cell
dynamics_params='IntFire1_exc_1.json')

net.add_nodes(N=60, pop_name='LIF_inh', location='VisL4', ei='i',
net.add_nodes(N=60, model_name='LIF_inh', location='VisL4', ei='i',
model_type='point_process',
model_template='nrn:IntFire1',
dynamics_params='IntFire1_inh_1.json')
Expand Down Expand Up @@ -46,7 +46,7 @@ def recurrent_connections(src_cells, trg_cell, n_syns):
dynamics_params='instanteneousInh.json')


net.add_edges(source={'ei': 'e'}, target={'pop_name': 'LIF_inh'},
net.add_edges(source={'ei': 'e'}, target={'model_name': 'LIF_inh'},
iterator='all_to_one',
connection_rule=recurrent_connections,
connection_params={'n_syns': 10},
Expand All @@ -56,7 +56,7 @@ def recurrent_connections(src_cells, trg_cell, n_syns):
dynamics_params='instanteneousExc.json')


net.add_edges(source={'ei': 'e'}, target={'pop_name': 'LIF_exc'},
net.add_edges(source={'ei': 'e'}, target={'model_name': 'LIF_exc'},
iterator='all_to_one',
connection_rule=recurrent_connections,
connection_params={'n_syns': 10},
Expand All @@ -78,33 +78,33 @@ def generate_positions(N, x0=0.0, x1=300.0, y0=0.0, y1=100.0):

def select_source_cells(src_cells, trg_cell, n_syns):
if np.random.random() > 0.1:
synapses = [n_syns if src['pop_name'] == 'tON' or src['pop_name'] == 'tOFF' else 0 for src in src_cells]
synapses = [n_syns if src['model_name'] == 'tON' or src['model_name'] == 'tOFF' else 0 for src in src_cells]
else:
synapses = [n_syns if src['pop_name'] == 'tONOFF' else 0 for src in src_cells]
synapses = [n_syns if src['model_name'] == 'tONOFF' else 0 for src in src_cells]

return synapses


lgn = NetworkBuilder("lgn")
pos_x, pos_y = generate_positions(30)
lgn.add_nodes(N=30, pop_name='tON', ei='e', location='LGN',
lgn.add_nodes(N=30, model_name='tON', ei='e', location='LGN',
x=pos_x, y=pos_y,
model_type='virtual')

pos_x, pos_y = generate_positions(30)
lgn.add_nodes(N=30, pop_name='tOFF', ei='e', location='LGN',
lgn.add_nodes(N=30, model_name='tOFF', ei='e', location='LGN',
x=pos_x, y=pos_y,
model_type='virtual')

pos_x, pos_y = generate_positions(30)
lgn.add_nodes(N=30, pop_name='tONOFF', ei='e', location='LGN',
lgn.add_nodes(N=30, model_name='tONOFF', ei='e', location='LGN',
x=pos_x, y=pos_y,
model_type='virtual')




lgn.add_edges(source=lgn.nodes(), target=net.nodes(pop_name='LIF_exc'),
lgn.add_edges(source=lgn.nodes(), target=net.nodes(model_name='LIF_exc'),
iterator='all_to_one',
connection_rule=select_source_cells,
connection_params={'n_syns': 10},
Expand All @@ -113,7 +113,7 @@ def select_source_cells(src_cells, trg_cell, n_syns):
delay=2.0,
dynamics_params='instanteneousExc.json')

lgn.add_edges(source=lgn.nodes(), target=net.nodes(pop_name='LIF_inh'),
lgn.add_edges(source=lgn.nodes(), target=net.nodes(model_name='LIF_inh'),
iterator='all_to_one',
connection_rule=select_source_cells,
connection_params={'n_syns': 10},
Expand All @@ -127,16 +127,16 @@ def select_source_cells(src_cells, trg_cell, n_syns):


tw = NetworkBuilder("tw")
tw.add_nodes(N=30, pop_name='TW', ei='e', location='TW', model_type='virtual')
tw.add_nodes(N=30, model_name='TW', ei='e', location='TW', model_type='virtual')

tw.add_edges(source=tw.nodes(), target=net.nodes(pop_name='LIF_exc'),
tw.add_edges(source=tw.nodes(), target=net.nodes(model_name='LIF_exc'),
connection_rule=5,
syn_weight=0.01,
weight_function='wmax',
delay=2.0,
dynamics_params='instanteneousExc.json')

tw.add_edges(source=tw.nodes(), target=net.nodes(pop_name='LIF_inh'),
tw.add_edges(source=tw.nodes(), target=net.nodes(model_name='LIF_inh'),
connection_rule=5,
syn_weight=0.02,
weight_function='wmax',
Expand Down
2 changes: 1 addition & 1 deletion examples/300_intfire/network/lgn_node_types.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_type_id model_type ei location pop_name
node_type_id model_type ei location model_name
100 virtual e LGN tON
101 virtual e LGN tOFF
102 virtual e LGN tONOFF
4 changes: 2 additions & 2 deletions examples/300_intfire/network/lgn_v1_edge_types.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
edge_type_id target_query source_query delay weight_function syn_weight dynamics_params
100 pop_name=='LIF_exc' * 2.0 wmax 0.0045 instanteneousExc.json
101 pop_name=='LIF_inh' * 2.0 wmax 0.0015 instanteneousExc.json
100 model_name=='LIF_exc' * 2.0 wmax 0.0045 instanteneousExc.json
101 model_name=='LIF_inh' * 2.0 wmax 0.0015 instanteneousExc.json
2 changes: 1 addition & 1 deletion examples/300_intfire/network/tw_node_types.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_type_id model_type ei location pop_name
node_type_id model_type ei location model_name
100 virtual e TW TW
4 changes: 2 additions & 2 deletions examples/300_intfire/network/tw_v1_edge_types.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
edge_type_id target_query source_query delay weight_function syn_weight dynamics_params
100 pop_name=='LIF_exc' * 2.0 wmax 0.01 instanteneousExc.json
101 pop_name=='LIF_inh' * 2.0 wmax 0.02 instanteneousExc.json
100 model_name=='LIF_exc' * 2.0 wmax 0.01 instanteneousExc.json
101 model_name=='LIF_inh' * 2.0 wmax 0.02 instanteneousExc.json
2 changes: 1 addition & 1 deletion examples/300_intfire/network/v1_node_types.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_type_id ei pop_name location model_template model_type dynamics_params
node_type_id ei model_name location model_template model_type dynamics_params
100 e LIF_exc VisL4 nrn:IntFire1 point_process IntFire1_exc_1.json
101 i LIF_inh VisL4 nrn:IntFire1 point_process IntFire1_inh_1.json
4 changes: 2 additions & 2 deletions examples/300_intfire/network/v1_v1_edge_types.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
edge_type_id target_query source_query delay weight_function syn_weight dynamics_params
100 model_type=='point_process'&ei=='i' ei=='i' 2.0 wmax 0.01 instanteneousInh.json
101 model_type=='point_process'&ei=='e' ei=='i' 2.0 wmax 0.15 instanteneousInh.json
102 pop_name=='LIF_inh' ei=='e' 2.0 wmax 0.3 instanteneousExc.json
103 pop_name=='LIF_exc' ei=='e' 2.0 wmax 0.002 instanteneousExc.json
102 model_name=='LIF_inh' ei=='e' 2.0 wmax 0.3 instanteneousExc.json
103 model_name=='LIF_exc' ei=='e' 2.0 wmax 0.002 instanteneousExc.json
2 changes: 1 addition & 1 deletion examples/300_intfire/plot_spikes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from bmtk.analyzer.visualization.spikes import plot_spikes

plot_spikes('network/v1_nodes.h5', 'network/v1_node_types.csv', 'output/spikes.h5', group_key='pop_name')
plot_spikes('network/v1_nodes.h5', 'network/v1_node_types.csv', 'output/spikes.h5', group_key='model_name')
7 changes: 4 additions & 3 deletions examples/300_intfire/simulation_config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"manifest": {
"$OUTPUT_DIR": "./output",
"$INPUT_DIR": "./inputs",
"$BASE_DIR": ".",
"$OUTPUT_DIR": "$BASE_DIR/output",
"$INPUT_DIR": "$BASE_DIR/inputs",
"$COMPONENT_DIR": "../shared_components"
},

Expand All @@ -16,7 +17,7 @@

"target_simulator":"NEURON",

"node_sets_file": "node_sets.json",
"node_sets_file": "$BASE_DIR/node_sets.json",

"conditions": {
"celsius": 34.0,
Expand Down
7 changes: 7 additions & 0 deletions examples/300_intfire/test_pynn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pyNN.serialization import import_from_sonata, load_sonata_simulation_plan
import pyNN.neuron as sim

simulation_plan = load_sonata_simulation_plan("simulation_config.json")
simulation_plan.setup(sim)
net = import_from_sonata("circuit_config.json", sim)
simulation_plan.execute(net)
157 changes: 157 additions & 0 deletions examples/300_pointneurons/build_network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import os
import numpy as np

from bmtk.builder import NetworkBuilder
from bmtk.builder.bionet import SWCReader
from bmtk.utils.io.spike_trains import PoissonSpikesGenerator
from bmtk.builder.aux.node_params import positions_columinar, xiter_random

build_recurrent_edges = True

print('Building internal network')
# List of non-virtual cell models
cell_models = [
{
'model_name': 'Scnn1a', 'ei': 'e',
'model_template': 'nest:iaf_psc_alpha',
'dynamics_params': '472363762_point.json'
},
{
'model_name': 'Rorb', 'ei': 'e',
'model_template': 'nest:iaf_psc_alpha',
'dynamics_params': '473863510_point.json'
},
{
'model_name': 'Nr5a1', 'ei': 'e',
'model_template': 'nest:iaf_psc_alpha',
'dynamics_params': '473863035_point.json'
},
{
'model_name': 'PV1', 'ei': 'i',
'model_template': 'nest:iaf_psc_alpha',
'dynamics_params': '472912177_point.json'
},
{
'model_name': 'PV2', 'ei': 'i',
'model_template': 'nest:iaf_psc_alpha',
'dynamics_params': '473862421_point.json'
}
]

'''
morphologies = {p['model_name']: SWCReader(os.path.join('../shared_components/morphologies',
'{}.swc'.format(p['morphology'])))
for p in cell_models}
def build_edges(src, trg, sections=['basal', 'apical'], dist_range=[50.0, 150.0]):
"""Function used to randomly assign a synaptic location based on the section (soma, basal, apical) and an
arc-length dist_range from the soma. This function should be passed into the network and called during the build
process.

:param src: source cell (dict)
:param trg: target cell (dict)
:param sections: list of target cell sections to synapse onto
:param dist_range: range (distance from soma center) to place
:return:
"""
# Get morphology and soma center for the target cell
swc_reader = morphologies[trg['model_name']]
target_coords = [trg['x'], trg['y'], trg['z']]

sec_ids, sec_xs = swc_reader.choose_sections(sections, dist_range) # randomly choose sec_ids
coords = swc_reader.get_coord(sec_ids, sec_xs, soma_center=target_coords) # get coords of sec_ids
dist = swc_reader.get_dist(sec_ids)
swctype = swc_reader.get_type(sec_ids)
return sec_ids, sec_xs, coords[0][0], coords[0][1], coords[0][2], dist[0], swctype[0]
'''

# Build a network of 300 biophysical cells to simulate
internal = NetworkBuilder("internal")
for i, model_props in enumerate(cell_models):
n_cells = 80 if model_props['ei'] == 'e' else 30 # 80% excitatory, 20% inhib

# Randomly get positions uniformly distributed in a column
positions = positions_columinar(N=n_cells, center=[0, 10.0, 0], max_radius=50.0, height=200.0)

internal.add_nodes(N=n_cells,
x=positions[:, 0], y=positions[:, 1], z=positions[:, 2],
rotation_angle_yaxis=xiter_random(N=n_cells, min_x=0.0, max_x=2 * np.pi), # randomly rotate y axis
model_type='point_process',
**model_props)



if build_recurrent_edges:
def n_connections(src, trg, prob=0.5, min_syns=2, max_syns=7):
return 0 if np.random.uniform() > prob else np.random.randint(min_syns, max_syns)

# exc --> exc connections
cm = internal.add_edges(source={'ei': 'e'}, target={'ei': 'e'},
connection_rule=lambda s, t: np.random.binomial(1, 0.2),
dynamics_params='ExcToExc.json',
model_template='static_synapse',
# syn_weight=2.5,
delay=2.0)
cm.add_properties('syn_weight', rule=2.5, dtypes=np.float)

# exc --> inh connections
cm = internal.add_edges(source={'ei': 'e'}, target={'ei': 'i'},
connection_rule=lambda s, t: np.random.binomial(1, 0.5),
dynamics_params='ExcToInh.json',
model_template='static_synapse',
# syn_weight=7.0,
delay=2.0)
cm.add_properties('syn_weight', rule=7.0, dtypes=np.float)

# inh --> exc connections
cm = internal.add_edges(source={'ei': 'i'}, target={'ei': 'e'},
connection_rule=lambda s, t: np.random.binomial(1, 0.5),
#connection_rule=lambda *_: np.random.randint(0, 4),
dynamics_params='InhToExc.json',
model_template='static_synapse',
# syn_weight=-7.5,
delay=2.0)
cm.add_properties('syn_weight', rule=-7.5, dtypes=np.float)

# inh --> inh connections
cm = internal.add_edges(source={'ei': 'i'}, target={'ei': 'i'},
connection_rule=lambda s, t: np.random.binomial(1, 0.5),
dynamics_params='InhToInh.json',
model_template='static_synapse',
# syn_weight=-3.0,
delay=2.0)
cm.add_properties('syn_weight', rule=-3.0, dtypes=np.float)


internal.build()

print('Saving internal')
internal.save(output_dir='network')


print('Building external connections')
external = NetworkBuilder("external")
external.add_nodes(N=100, model_type='virtual', ei='e')
cm = external.add_edges(target=internal.nodes(ei='e'), source=external.nodes(),
connection_rule=lambda *_: np.random.binomial(1, .7),
dynamics_params='ExcToExc.json',
model_template='static_synapse',
# syn_weight=50.0,
delay=2.0)
cm.add_properties('syn_weight', rule=50.0, dtypes=np.float)


cm = external.add_edges(target=internal.nodes(ei='i'), source=external.nodes(),
connection_rule=lambda *_: np.random.binomial(1, .7),
dynamics_params='ExcToInh.json',
model_template='static_synapse',
# syn_weight=75.0,
delay=2.0)
cm.add_properties('syn_weight', rule=65.0, dtypes=np.float)


external.build()

print('Saving external')
external.save(output_dir='network')


Loading