Skip to content

Commit

Permalink
Merge pull request #62 from NeuroML/experimental
Browse files Browse the repository at this point in the history
Updates to sonata import/export
  • Loading branch information
pgleeson authored Oct 18, 2023
2 parents 67d3bb0 + 7381f40 commit 417bc11
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 152 deletions.
14 changes: 7 additions & 7 deletions examples/sonatatest/SimSonataExample.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"SimSonataExample": {
"version": "NeuroMLlite v0.1.9",
"network": "SonataExample.json",
"duration": 1000.0,
"dt": 0.01,
"recordTraces": {
"version": "NeuroMLlite v0.5.8",
"network": "SonataExample.json",
"duration": 1000.0,
"dt": 0.01,
"record_traces": {
"all": "*"
},
"recordSpikes": {
},
"record_spikes": {
"pop0": "*"
}
}
Expand Down
116 changes: 53 additions & 63 deletions examples/sonatatest/SonataExample.json
Original file line number Diff line number Diff line change
@@ -1,74 +1,64 @@
{
"SonataExample": {
"version": "NeuroMLlite v0.1.9",
"version": "NeuroMLlite v0.5.8",
"notes": "Example for testing Sonata",
"parameters": {
"input_del": 100,
"input_dur": 800,
"input_amp": 0.19
},
"notes": "Example for testing Sonata",
"cells": [
{
"testcell": {
"pynn_cell": "IF_cond_alpha",
"parameters": {
"tau_refrac": 3,
"tau_m": 22.1,
"i_offset": 0,
"cm": 0.117,
"v_thresh": -47,
"v_rest": -78,
"v_reset": -50
}
}
"input_amp": 0.19,
"input_del": 100,
"input_dur": 800
},
"cells": {
"testcell": {
"parameters": {
"i_offset": 0,
"cm": 0.117,
"tau_m": 22.1,
"tau_refrac": 3,
"v_reset": -50,
"v_rest": -78,
"v_thresh": -47
},
"pynn_cell": "IF_cond_alpha"
}
],
"input_sources": [
{
"i_clamp": {
"pynn_input": "DCSource",
"parameters": {
"start": "input_del",
"stop": "input_del+input_dur",
"amplitude": "input_amp"
}
}
},
"input_sources": {
"i_clamp": {
"parameters": {
"amplitude": "input_amp",
"start": "input_del",
"stop": "input_del+input_dur"
},
"pynn_input": "DCSource"
}
],
"regions": [
{
"region1": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"width": 1000.0,
"height": 100.0,
"depth": 1000.0
}
},
"regions": {
"region1": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"width": 1000.0,
"height": 100.0,
"depth": 1000.0
}
],
"populations": [
{
"pop0": {
"size": 2,
"component": "testcell",
"properties": {
"color": "1 0 0"
},
"random_layout": {
"region": "region1"
}
},
"populations": {
"pop0": {
"size": 2,
"component": "testcell",
"properties": {
"color": "1 0 0"
},
"random_layout": {
"region": "region1"
}
}
],
"inputs": [
{
"stim": {
"input_source": "i_clamp",
"population": "pop0",
"percentage": 50.0
}
},
"inputs": {
"stim": {
"input_source": "i_clamp",
"population": "pop0",
"percentage": 50
}
]
}
}
}
4 changes: 2 additions & 2 deletions examples/sonatatest/SonataExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
network=new_file,
duration="1000",
dt="0.01",
recordTraces={"all": "*"},
recordSpikes={"pop0": "*"},
record_traces={"all": "*"},
record_spikes={"pop0": "*"},
)

sim.to_json_file()
Expand Down
20 changes: 10 additions & 10 deletions examples/sonatatest/circuit_config.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"manifest": {
"$NETWORK_DIR": "./network",
"$COMPONENT_DIR": "./components"
},
"components": {
"synaptic_models_dir": "$COMPONENT_DIR/synaptic_models",
"point_neuron_models_dir": "$COMPONENT_DIR/point_neuron_models_dir"
},
"networks": {
"nodes": [
{
"node_types_file": "$NETWORK_DIR/SonataExample_node_types.csv",
"nodes_file": "$NETWORK_DIR/SonataExample_nodes.sonata.h5"
"nodes_file": "$NETWORK_DIR/SonataExample_nodes.sonata.h5",
"node_types_file": "$NETWORK_DIR/SonataExample_node_types.csv"
}
]
},
"components": {
"point_neuron_models_dir": "$COMPONENT_DIR/point_neuron_models_dir",
"synaptic_models_dir": "$COMPONENT_DIR/synaptic_models"
},
"manifest": {
"$NETWORK_DIR": "./network",
"$COMPONENT_DIR": "./components"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"tau_m": 22.1,
"V_th": -47.0,
"I_e": 0.0,
"C_m": 117.0,
"V_reset": -50.0,
"t_ref": 3.0,
"E_L": -78.0
"E_L": -78.0,
"C_m": 117.0,
"tau_m": 22.1,
"t_ref": 3.0,
"V_th": -47.0,
"V_reset": -50.0,
"I_e": 0.0
}
2 changes: 1 addition & 1 deletion examples/sonatatest/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"network": "./circuit_config.json",
"network": "./circuit_config.json",
"simulation": "./simulation_config.json"
}
4 changes: 2 additions & 2 deletions examples/sonatatest/network/SonataExample_node_types.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_type_id dynamics_params pop_name model_template model_type model_name
100 testcell.json pop0 nest:iaf_psc_alpha point_process testcell
node_type_id pop_name model_name model_template model_type dynamics_params
100 pop0 testcell nest:iaf_psc_alpha point_process testcell.json
Binary file modified examples/sonatatest/network/SonataExample_nodes.sonata.h5
Binary file not shown.
8 changes: 8 additions & 0 deletions examples/sonatatest/regenerateAndTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -ex

python SonataExample.py -sonata

python run_bmtk.py

./run_pynml.jnml.sh
3 changes: 1 addition & 2 deletions examples/sonatatest/run_bmtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def run(config_file, simulator):

elif simulator == "NEST":
from bmtk.simulator import pointnet

conf = pointnet.Config.from_json(config_file)
conf.build_env()
net = pointnet.PointNetwork.from_config(conf)
Expand All @@ -24,4 +23,4 @@ def run(config_file, simulator):


if __name__ == "__main__":
run("config.json", "NEST")
run("config.json", "NEST")
3 changes: 1 addition & 2 deletions examples/sonatatest/run_pynml.jnml.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

set -e
set -ex

pynml-sonata Back2NML config.json -jnml
68 changes: 34 additions & 34 deletions examples/sonatatest/simulation_config.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"inputs": {
"stim": {
"input_type": "current_clamp",
"node_set": "inputset_stim_i_clamp",
"module": "IClamp",
"delay": 100.0,
"duration": 800.0,
"amp": 190.00000000000003
}
},
"target_simulator": "NEST",
"reports": {
"membrane_potential": {
"enabled": true,
"cells": "point_nodes",
"sections": "soma",
"module": "multimeter_report",
"variable_name": "V_m"
}
},
"manifest": {
"$OUTPUT_DIR": "./output",
"$INPUT_DIR": "./"
},
"run": {
"tstop": 1000.0,
"tstop": 1000.0,
"dt": 0.01
},
},
"target_simulator": "NEST",
"manifest": {
"$OUTPUT_DIR": "./output",
"$INPUT_DIR": "./"
},
"output": {
"output_dir": "$OUTPUT_DIR",
"log_file": "log.txt",
"spikes_file": "spikes.h5",
"spikes_sort_order": "time"
},
"node_sets": {
"point_nodes": {
"model_type": "point_process"
},
},
"inputset_stim_i_clamp": {
"model_type": "point_process",
"model_type": "point_process",
"population": "pop0"
}
},
"output": {
"spikes_sort_order": "time",
"spikes_file": "spikes.h5",
"log_file": "log.txt",
"output_dir": "$OUTPUT_DIR"
},
"reports": {
"membrane_potential": {
"cells": "point_nodes",
"variable_name": "V_m",
"module": "multimeter_report",
"sections": "soma",
"enabled": true
}
},
"inputs": {
"stim": {
"input_type": "current_clamp",
"module": "IClamp",
"amp": 190.00000000000003,
"delay": 100.0,
"duration": 800.0,
"node_set": "inputset_stim_i_clamp"
}
}
}
2 changes: 1 addition & 1 deletion neuromllite/MDFHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def _comp_to_mdf_node(self, nmllite_comp, lems_comp_id, size=1, properties=None)
# node["parameters"][sv.name]["value"] = [0]*size

node["output_ports"][sv.name] = {"value": sv.name}
print_v("Adding %s as an output port"%sv.name)
print_v("Adding %s as an output port" % sv.name)
if sv.exposure:
node["output_ports"][sv.exposure] = {"value": sv.name}

Expand Down
Loading

0 comments on commit 417bc11

Please sign in to comment.