diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_build/build_network.py b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_build/build_network.py
new file mode 100755
index 0000000..7174787
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_build/build_network.py
@@ -0,0 +1,24 @@
+#!/bin/env python
+
+# Sonata Simulator Test Suite
+# 1-cell circuit, single soma, only cm, 1 step current
+
+# Authors: Werner Van Geit @ BBP
+
+import bmtk.builder
+
+cell_models = [
+ {'model_name': 'soma_cm', 'x': [0.0],
+ 'y': [0.0],
+ 'z': [0.0],
+ 'morphology': 'soma1',
+ 'model_template': 'nml:soma_cm2.nml'}]
+
+bio_cells = bmtk.builder.NetworkBuilder("biophysical")
+for model_props in cell_models:
+ bio_cells.add_nodes(
+ model_type='biophysical',
+ **model_props)
+
+bio_cells.build()
+bio_cells.save_nodes(output_dir='../input/network')
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/.gitignore b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/.gitignore
new file mode 100644
index 0000000..1f57b97
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/.gitignore
@@ -0,0 +1 @@
+/output
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/run.sh b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/run.sh
new file mode 100755
index 0000000..275a227
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/run.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+set -e
+
+rm -rf output
+rm -rf __pycache__
+# python -m trace --trace ../shared_components/scripts/run_bionet.py ../input/config.json
+python ../shared_components/scripts/run_bionet.py ../input/config.json
+
+pytest -vvs
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/test_output.py b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/test_output.py
new file mode 100644
index 0000000..46548ee
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/bmtk_test/test_output.py
@@ -0,0 +1,58 @@
+import os
+
+import numpy
+import h5py
+import pytest
+
+output_path = os.path.abspath(
+ os.path.join(
+ os.path.dirname(__file__),
+ 'output'))
+
+dt = 0.025
+tstop = 60.0
+stim_start = 20.0
+stim_end = 50.0
+
+start_voltage = -80.0
+end_voltage = -20.0
+
+# Using as 'raw' code as possible here, so as not to depend on other code
+# that could contain errors
+
+
+def test_soma_voltage():
+ """Check soma voltages"""
+
+ soma_voltage_path = os.path.join(output_path, 'membrane_potential.h5')
+
+ assert os.path.exists(soma_voltage_path)
+
+ voltage = h5py.File(soma_voltage_path)['data'].value
+
+ assert len(voltage) == tstop / dt
+
+ time = numpy.arange(0, len(voltage)) * dt
+
+ soma_voltage_path = os.path.join(output_path, 'membrane_potential.h5')
+
+ assert os.path.exists(soma_voltage_path)
+ assert voltage[0] == pytest.approx(start_voltage)
+ assert numpy.mean(
+ voltage[
+ numpy.where(time < stim_start)]) == pytest.approx(start_voltage)
+ assert start_voltage < numpy.mean(voltage[numpy.where(
+ (time >= stim_start) & (time <= stim_end))]) < end_voltage
+ assert voltage[-1] == pytest.approx(end_voltage)
+
+
+def test_spikes():
+ """Check spike times"""
+
+ spikes_path = os.path.join(output_path, 'spikes.h5')
+
+ assert os.path.exists(spikes_path)
+
+ spikes = h5py.File(spikes_path)['spikes']['timestamps'].value
+
+ assert len(spikes) == 0
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/expected_output/membrane_potential.h5 b/examples/sim_tests/biophysical/one_cell/soma_cm2/expected_output/membrane_potential.h5
new file mode 100644
index 0000000..04c7302
Binary files /dev/null and b/examples/sim_tests/biophysical/one_cell/soma_cm2/expected_output/membrane_potential.h5 differ
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/expected_output/spikes.h5 b/examples/sim_tests/biophysical/one_cell/soma_cm2/expected_output/spikes.h5
new file mode 100644
index 0000000..a4c6a36
Binary files /dev/null and b/examples/sim_tests/biophysical/one_cell/soma_cm2/expected_output/spikes.h5 differ
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/input/circuit_config.json b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/circuit_config.json
new file mode 100755
index 0000000..ffd4224
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/circuit_config.json
@@ -0,0 +1,20 @@
+{
+ "manifest": {
+ "$NETWORK_DIR": "../input/network",
+ "$COMPONENT_DIR": "../shared_components"
+ },
+
+ "components": {
+ "morphologies_dir": "$COMPONENT_DIR/morphologies",
+ "biophysical_neuron_models_dir": "$COMPONENT_DIR/templates/nml"
+ },
+
+ "networks": {
+ "nodes": [
+ {
+ "nodes_file": "$NETWORK_DIR/biophysical_nodes.h5",
+ "node_types_file": "$NETWORK_DIR/biophysical_node_types.csv"
+ }
+ ]
+ }
+}
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/input/config.json b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/config.json
new file mode 120000
index 0000000..a7569e2
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/config.json
@@ -0,0 +1 @@
+../shared_components/configs/config.json
\ No newline at end of file
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/input/network/biophysical_node_types.csv b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/network/biophysical_node_types.csv
new file mode 100644
index 0000000..4c42dc5
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/network/biophysical_node_types.csv
@@ -0,0 +1,2 @@
+node_type_id model_type model_template morphology model_name
+100 biophysical nml:soma_cm2.nml soma1 soma_cm
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/input/network/biophysical_nodes.h5 b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/network/biophysical_nodes.h5
new file mode 100644
index 0000000..c49819b
Binary files /dev/null and b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/network/biophysical_nodes.h5 differ
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/input/node_sets.json b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/node_sets.json
new file mode 100644
index 0000000..2ebb09c
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/node_sets.json
@@ -0,0 +1,5 @@
+{
+ "soma_cm2": {
+ "model_type": "biophysical"
+ }
+}
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/input/simulation_config.json b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/simulation_config.json
new file mode 100755
index 0000000..c34a77a
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/input/simulation_config.json
@@ -0,0 +1,55 @@
+{
+ "manifest": {
+ "$OUTPUT_DIR": "./output",
+ "$INPUT_DIR": "../input"
+ },
+
+ "run": {
+ "tstop": 60.0,
+ "dt": 0.025,
+ "dL": 20.0,
+ "spike_threshold": -15,
+ "nsteps_block": 5000
+ },
+
+ "target_simulator":"NEURON",
+
+ "network": "$INPUT_DIR/circuit_config.json",
+
+ "conditions": {
+ "celsius": 34.0,
+ "v_init": -80
+ },
+
+ "node_sets_file": "$INPUT_DIR/node_sets.json",
+
+ "mechanisms_dir": "../shared_components_mechanisms",
+
+
+ "inputs": {
+ "current_clamp_1": {
+ "input_type": "current_clamp",
+ "module": "IClamp",
+ "node_set": "soma_cm2",
+ "amp": 0.0001256637,
+ "delay": 20.0,
+ "duration": 30.0
+ }
+ },
+
+ "output": {
+ "log_file": "log.txt",
+ "output_dir": "$OUTPUT_DIR",
+ "spikes_file": "spikes.h5",
+ "spikes_sort_order": "time"
+ },
+
+ "reports": {
+ "membrane_potential": {
+ "cells": "soma_cm2",
+ "variable_name": "v",
+ "module": "membrane_report",
+ "sections": "soma"
+ }
+ }
+}
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/pytest.ini b/examples/sim_tests/biophysical/one_cell/soma_cm2/pytest.ini
new file mode 100644
index 0000000..3d8fe4a
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/pytest.ini
@@ -0,0 +1,3 @@
+[pytest]
+filterwarnings =
+ ignore::FutureWarning
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2/shared_components b/examples/sim_tests/biophysical/one_cell/soma_cm2/shared_components
new file mode 120000
index 0000000..d3ced13
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2/shared_components
@@ -0,0 +1 @@
+../../../shared_components
\ No newline at end of file
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_build/build_network.py b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_build/build_network.py
new file mode 100755
index 0000000..a53aebb
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_build/build_network.py
@@ -0,0 +1,24 @@
+#!/bin/env python
+
+# Sonata Simulator Test Suite
+# 1-cell circuit, single soma, only cm, 1 step current
+
+# Authors: Werner Van Geit @ BBP
+
+import bmtk.builder
+
+cell_models = [
+ {'model_name': 'soma_cm', 'x': [0.0],
+ 'y': [0.0],
+ 'z': [0.0],
+ 'morphology': 'soma1',
+ 'model_template': 'nml:soma_cm2_hh.nml'}]
+
+bio_cells = bmtk.builder.NetworkBuilder("biophysical")
+for model_props in cell_models:
+ bio_cells.add_nodes(
+ model_type='biophysical',
+ **model_props)
+
+bio_cells.build()
+bio_cells.save_nodes(output_dir='../input/network')
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/.gitignore b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/.gitignore
new file mode 100644
index 0000000..1f57b97
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/.gitignore
@@ -0,0 +1 @@
+/output
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/run.sh b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/run.sh
new file mode 100755
index 0000000..5c5107d
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/run.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+rm -rf output
+rm -rf __pycache__
+# python -m trace --trace ../shared_components/scripts/run_bionet.py ../input/config.json
+python ../shared_components/scripts/run_bionet.py ../input/config.json
+
+pytest -vvs
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/test_output.py b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/test_output.py
new file mode 100644
index 0000000..3e16989
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/bmtk_test/test_output.py
@@ -0,0 +1,66 @@
+import os
+
+import numpy
+import h5py
+import pytest
+
+output_path = os.path.abspath(
+ os.path.join(
+ os.path.dirname(__file__),
+ 'output'))
+
+# TBD
+
+'''
+dt = 0.025
+tstop = 60.0
+stim_start = 20.0
+stim_end = 50.0
+
+start_voltage = -80.0
+end_voltage = -20.0
+
+# Using as 'raw' code as possible here, so as not to depend on other code
+# that could contain errors
+
+
+def test_soma_voltage():
+ """Check soma voltages"""
+
+ soma_voltage_path = os.path.join(output_path, 'membrane_potential.h5')
+
+ assert os.path.exists(soma_voltage_path)
+
+ voltage = h5py.File(soma_voltage_path)['data'].value
+
+ assert len(voltage) == tstop / dt
+
+ time = numpy.arange(0, len(voltage)) * dt
+
+ soma_voltage_path = os.path.join(output_path, 'membrane_potential.h5')
+
+ import matplotlib.pyplot as plt
+ plt.plot(voltage)
+ plt.show()
+
+ assert os.path.exists(soma_voltage_path)
+ assert voltage[0] == pytest.approx(start_voltage)
+ assert numpy.mean(
+ voltage[
+ numpy.where(time < stim_start)]) == pytest.approx(start_voltage)
+ assert start_voltage < numpy.mean(voltage[numpy.where(
+ (time >= stim_start) & (time <= stim_end))]) < end_voltage
+ assert voltage[-1] == pytest.approx(end_voltage)
+
+
+def test_spikes():
+ """Check spike times"""
+
+ spikes_path = os.path.join(output_path, 'spikes.h5')
+
+ assert os.path.exists(spikes_path)
+
+ spikes = h5py.File(spikes_path)['spikes']['timestamps'].value
+
+ assert len(spikes) == 0
+'''
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/expected_output/membrane_potential.h5 b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/expected_output/membrane_potential.h5
new file mode 100644
index 0000000..04c7302
Binary files /dev/null and b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/expected_output/membrane_potential.h5 differ
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/expected_output/spikes.h5 b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/expected_output/spikes.h5
new file mode 100644
index 0000000..a4c6a36
Binary files /dev/null and b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/expected_output/spikes.h5 differ
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/circuit_config.json b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/circuit_config.json
new file mode 100755
index 0000000..ffd4224
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/circuit_config.json
@@ -0,0 +1,20 @@
+{
+ "manifest": {
+ "$NETWORK_DIR": "../input/network",
+ "$COMPONENT_DIR": "../shared_components"
+ },
+
+ "components": {
+ "morphologies_dir": "$COMPONENT_DIR/morphologies",
+ "biophysical_neuron_models_dir": "$COMPONENT_DIR/templates/nml"
+ },
+
+ "networks": {
+ "nodes": [
+ {
+ "nodes_file": "$NETWORK_DIR/biophysical_nodes.h5",
+ "node_types_file": "$NETWORK_DIR/biophysical_node_types.csv"
+ }
+ ]
+ }
+}
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/config.json b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/config.json
new file mode 120000
index 0000000..a7569e2
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/config.json
@@ -0,0 +1 @@
+../shared_components/configs/config.json
\ No newline at end of file
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/network/biophysical_node_types.csv b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/network/biophysical_node_types.csv
new file mode 100644
index 0000000..5be64ca
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/network/biophysical_node_types.csv
@@ -0,0 +1,2 @@
+node_type_id model_type model_template morphology model_name
+100 biophysical nml:soma_cm2_hh.nml soma1 soma_cm
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/network/biophysical_nodes.h5 b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/network/biophysical_nodes.h5
new file mode 100644
index 0000000..3a6e422
Binary files /dev/null and b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/network/biophysical_nodes.h5 differ
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/node_sets.json b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/node_sets.json
new file mode 100644
index 0000000..2ebb09c
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/node_sets.json
@@ -0,0 +1,5 @@
+{
+ "soma_cm2": {
+ "model_type": "biophysical"
+ }
+}
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/simulation_config.json b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/simulation_config.json
new file mode 100755
index 0000000..d8d5f03
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/input/simulation_config.json
@@ -0,0 +1,55 @@
+{
+ "manifest": {
+ "$OUTPUT_DIR": "./output",
+ "$INPUT_DIR": "../input"
+ },
+
+ "run": {
+ "tstop": 60.0,
+ "dt": 0.025,
+ "dL": 20.0,
+ "spike_threshold": -15,
+ "nsteps_block": 5000
+ },
+
+ "target_simulator":"NEURON",
+
+ "network": "$INPUT_DIR/circuit_config.json",
+
+ "conditions": {
+ "celsius": 34.0,
+ "v_init": -80
+ },
+
+ "node_sets_file": "$INPUT_DIR/node_sets.json",
+
+ "mechanisms_dir": "../shared_components_mechanisms",
+
+
+ "inputs": {
+ "current_clamp_1": {
+ "input_type": "current_clamp",
+ "module": "IClamp",
+ "node_set": "soma_cm2",
+ "amp": 0.002,
+ "delay": 20.0,
+ "duration": 30.0
+ }
+ },
+
+ "output": {
+ "log_file": "log.txt",
+ "output_dir": "$OUTPUT_DIR",
+ "spikes_file": "spikes.h5",
+ "spikes_sort_order": "time"
+ },
+
+ "reports": {
+ "membrane_potential": {
+ "cells": "soma_cm2",
+ "variable_name": "v",
+ "module": "membrane_report",
+ "sections": "soma"
+ }
+ }
+}
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/pytest.ini b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/pytest.ini
new file mode 100644
index 0000000..3d8fe4a
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/pytest.ini
@@ -0,0 +1,3 @@
+[pytest]
+filterwarnings =
+ ignore::FutureWarning
diff --git a/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/shared_components b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/shared_components
new file mode 120000
index 0000000..d3ced13
--- /dev/null
+++ b/examples/sim_tests/biophysical/one_cell/soma_cm2_hh/shared_components
@@ -0,0 +1 @@
+../../../shared_components
\ No newline at end of file
diff --git a/examples/sim_tests/shared_components/configs/config.json b/examples/sim_tests/shared_components/configs/config.json
new file mode 100755
index 0000000..890caa3
--- /dev/null
+++ b/examples/sim_tests/shared_components/configs/config.json
@@ -0,0 +1,4 @@
+{
+ "network": "./circuit_config.json",
+ "simulation": "./simulation_config.json"
+}
diff --git a/examples/sim_tests/shared_components/morphologies/soma1.swc b/examples/sim_tests/shared_components/morphologies/soma1.swc
new file mode 100644
index 0000000..fa8360a
--- /dev/null
+++ b/examples/sim_tests/shared_components/morphologies/soma1.swc
@@ -0,0 +1,5 @@
+# 3-point soma with diameter of 1
+# id,type,x,y,z,r,pid
+1 1 0.0 0.0 0.0 0.5 -1
+2 1 0.0 -0.5 0.0 0.5 1
+3 1 0.0 0.5 0.0 0.5 1
diff --git a/examples/sim_tests/shared_components/scripts/run_bionet.py b/examples/sim_tests/shared_components/scripts/run_bionet.py
new file mode 100755
index 0000000..b7f65d2
--- /dev/null
+++ b/examples/sim_tests/shared_components/scripts/run_bionet.py
@@ -0,0 +1,19 @@
+#!/bin/env python
+
+import sys
+from bmtk.simulator import bionet
+
+
+def run(config_file):
+ conf = bionet.Config.from_json(config_file, validate=True)
+ conf.build_env()
+ net = bionet.BioNetwork.from_config(conf)
+ sim = bionet.BioSimulator.from_config(conf, network=net)
+ sim.run()
+
+
+if __name__ == '__main__':
+ if __file__ != sys.argv[-1]:
+ run(sys.argv[-1])
+ else:
+ run('config.json')
diff --git a/examples/sim_tests/shared_components/templates/nml/soma_cm2.nml b/examples/sim_tests/shared_components/templates/nml/soma_cm2.nml
new file mode 100755
index 0000000..46c8595
--- /dev/null
+++ b/examples/sim_tests/shared_components/templates/nml/soma_cm2.nml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+ |
+
diff --git a/examples/sim_tests/shared_components/templates/nml/soma_cm2_hh.nml b/examples/sim_tests/shared_components/templates/nml/soma_cm2_hh.nml
new file mode 100755
index 0000000..9bf5c55
--- /dev/null
+++ b/examples/sim_tests/shared_components/templates/nml/soma_cm2_hh.nml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+ |
+