diff --git a/.gitignore b/.gitignore
index 8c2c758f..71863ff9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -281,18 +281,25 @@ Thumbs.db #thumbnail cache on Windows
/examples/TensorFlow/Keras/keras_to_MDF
/examples/NeuroML/PyNN/All*
/examples/NeuroML/PyNN/*dat
-/examples/NeuroML/PyNN/*.png
+/examples/NeuroML/PyNN/*1.png
/examples/NeuroML/PyNN/*.1
-/examples/NeuroML/PyNN/InputWeights*
-/examples/NeuroML/PyNN/OneCell*
-/examples/NeuroML/PyNN/Sim*
-/examples/NeuroML/PyNN/LEMS_Sim*
-/examples/NeuroML/PyNN/HH*
/examples/NeuroML/PyNN/arm64
/examples/NeuroML/PyNN/*.pkl
+/examples/NeuroML/PyNN/*.json
+/examples/NeuroML/PyNN/*.mdf
+/examples/NeuroML/PyNN/*.spikes
*_code.gen.c
-/examples/NeuroML/PyNN/Net1*
examples/TensorFlow/Keras/Keras_to_MDF_IRIS/keras_to_MDF
examples/TensorFlow/Keras/keras_to_MDF
/examples/TensorFlow/Keras/Keras_MDF/Keras_to_MDF_IRIS/keras_to_MDF
/examples/TensorFlow/Keras/Keras_MDF/keras_to_MDF
+/examples/NeuroML/PyNN/HH.yaml
+/examples/NeuroML/PyNN/InputWeights.yaml
+/examples/NeuroML/PyNN/Net1.yaml
+/examples/NeuroML/PyNN/OneCell.yaml
+/examples/NeuroML/PyNN/SimHH.yaml
+/examples/NeuroML/PyNN/SimNet1.yaml
+/examples/NeuroML/PyNN/SimOneCell.yaml
+/examples/NeuroML/PyNN/SimSimpleNet.yaml
+/examples/NeuroML/PyNN/SimpleNet.yaml
+/examples/NeuroML/PyNN/SimInputWeights.yaml
diff --git a/docs/sphinx/source/api/QuickStart.md b/docs/sphinx/source/api/QuickStart.md
index 42f582b8..119222e5 100644
--- a/docs/sphinx/source/api/QuickStart.md
+++ b/docs/sphinx/source/api/QuickStart.md
@@ -2,6 +2,12 @@
This is a quick guide to the various parts of the ModECI Model Description Format (MDF) specification, API and examples.
+
+
## Specification of MDF language
The specification for the language, including the core types Graph, Node, Edge etc. is available here.
diff --git a/examples/NeuroML/ABCD.json b/examples/NeuroML/ABCD.json
index ba35670b..e9b6c3e1 100644
--- a/examples/NeuroML/ABCD.json
+++ b/examples/NeuroML/ABCD.json
@@ -1,6 +1,6 @@
{
"ABCD": {
- "version": "NeuroMLlite v0.5.5",
+ "version": "NeuroMLlite v0.5.7",
"notes": "Example of a simplified network",
"parameters": {
"A_initial": 0.1,
diff --git a/examples/NeuroML/ABCD.net.nml b/examples/NeuroML/ABCD.net.nml
index fe25999e..bfe6acb3 100644
--- a/examples/NeuroML/ABCD.net.nml
+++ b/examples/NeuroML/ABCD.net.nml
@@ -1,5 +1,5 @@
- Generated by NeuroMLlite v0.5.5
+ Generated by NeuroMLlite v0.5.7
Generated network: ABCD
Generation seed: 1234
NeuroMLlite parameters:
diff --git a/examples/NeuroML/FN.json b/examples/NeuroML/FN.json
index 8e6a436c..c1235a5e 100644
--- a/examples/NeuroML/FN.json
+++ b/examples/NeuroML/FN.json
@@ -1,6 +1,6 @@
{
"FN": {
- "version": "NeuroMLlite v0.5.5",
+ "version": "NeuroMLlite v0.5.7",
"notes": "FitzHugh Nagumo cell model - originally specified in NeuroML/LEMS",
"parameters": {
"initial_w": 0.0,
diff --git a/examples/NeuroML/FN.net.nml b/examples/NeuroML/FN.net.nml
index bacd03af..c3649de6 100644
--- a/examples/NeuroML/FN.net.nml
+++ b/examples/NeuroML/FN.net.nml
@@ -1,5 +1,5 @@
- Generated by NeuroMLlite v0.5.5
+ Generated by NeuroMLlite v0.5.7
Generated network: FN
Generation seed: 1234
NeuroMLlite parameters:
diff --git a/examples/NeuroML/IzhikevichTest.net.nml b/examples/NeuroML/IzhikevichTest.net.nml
index 8eb84423..65b7372f 100644
--- a/examples/NeuroML/IzhikevichTest.net.nml
+++ b/examples/NeuroML/IzhikevichTest.net.nml
@@ -1,5 +1,5 @@
- Generated by NeuroMLlite v0.5.5
+ Generated by NeuroMLlite v0.5.7
Generated network: IzhikevichTest
Generation seed: 1234
NeuroMLlite parameters:
diff --git a/examples/NeuroML/IzhikevichTest.nmllite.yaml b/examples/NeuroML/IzhikevichTest.nmllite.yaml
index 9865e878..79fe02a8 100644
--- a/examples/NeuroML/IzhikevichTest.nmllite.yaml
+++ b/examples/NeuroML/IzhikevichTest.nmllite.yaml
@@ -1,5 +1,5 @@
IzhikevichTest:
- version: NeuroMLlite v0.5.5
+ version: NeuroMLlite v0.5.7
notes: Example Izhikevich
parameters:
N: 1
@@ -47,5 +47,5 @@ IzhikevichTest:
stim:
input_source: iclamp_0
population: izhPop
- percentage: 100.0
+ percentage: 100
weight: 1
diff --git a/examples/NeuroML/LEMS_SimABCD.xml b/examples/NeuroML/LEMS_SimABCD.xml
index b4fd77ef..90571f19 100644
--- a/examples/NeuroML/LEMS_SimABCD.xml
+++ b/examples/NeuroML/LEMS_SimABCD.xml
@@ -2,7 +2,7 @@
diff --git a/examples/NeuroML/LEMS_SimFN.xml b/examples/NeuroML/LEMS_SimFN.xml
index e3ae5764..5463b195 100644
--- a/examples/NeuroML/LEMS_SimFN.xml
+++ b/examples/NeuroML/LEMS_SimFN.xml
@@ -2,7 +2,7 @@
diff --git a/examples/NeuroML/LEMS_SimIzhikevichTest.xml b/examples/NeuroML/LEMS_SimIzhikevichTest.xml
index 1bf4ac59..80e90760 100644
--- a/examples/NeuroML/LEMS_SimIzhikevichTest.xml
+++ b/examples/NeuroML/LEMS_SimIzhikevichTest.xml
@@ -2,7 +2,7 @@
diff --git a/examples/NeuroML/PyNN/Generate.py b/examples/NeuroML/PyNN/Generate.py
new file mode 100644
index 00000000..8be9bc2a
--- /dev/null
+++ b/examples/NeuroML/PyNN/Generate.py
@@ -0,0 +1,202 @@
+from neuromllite import (
+ Network,
+ Cell,
+ InputSource,
+ Population,
+ Synapse,
+ RectangularRegion,
+ RandomLayout,
+)
+from neuromllite import Projection, RandomConnectivity, Input, Simulation
+import sys
+
+
+def generate(
+ ref,
+ num_pop0=2,
+ num_pop1=2,
+ conn_prob=1,
+ conn_weight=0.3,
+ input_percentage=50,
+ input_weight=".8",
+ pynn_cell="IF_curr_alpha",
+):
+
+ ################################################################################
+ ### Build new network
+
+ net = Network(id=ref)
+ net.notes = "Example: %s" % ref
+ net.parameters = {"input_amp": 0.99}
+
+ cell = Cell(id="testcell", pynn_cell=pynn_cell)
+
+ cell.parameters = {"i_offset": 0.0}
+ if "IF_" in pynn_cell:
+ cell.parameters["tau_refrac"] = 5
+ else:
+ cell.parameters = {"i_offset": 0.05}
+ net.parameters = {"input_amp": 0}
+ net.cells.append(cell)
+
+ input_source = InputSource(
+ id="i_clamp",
+ pynn_input="DCSource",
+ parameters={"amplitude": "input_amp", "start": 200.0, "stop": 800.0},
+ )
+ net.input_sources.append(input_source)
+
+ r1 = RectangularRegion(
+ id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000
+ )
+ net.regions.append(r1)
+
+ p0 = Population(
+ id="pop0",
+ size=num_pop0,
+ component=cell.id,
+ properties={"color": "1 0 0", "radius": 20},
+ random_layout=RandomLayout(region=r1.id),
+ )
+ net.populations.append(p0)
+
+ if num_pop1 > 0:
+ p1 = Population(
+ id="pop1",
+ size=num_pop1,
+ component=cell.id,
+ properties={"color": "0 1 0", "radius": 20},
+ random_layout=RandomLayout(region=r1.id),
+ )
+ net.populations.append(p1)
+
+ """p2 = Population(
+ id="pop2",
+ size=1,
+ component=cell2.id,
+ properties={"color": "0 0 1", "radius": 20},
+ random_layout=RandomLayout(region=r1.id),
+ )
+
+ net.populations.append(p2)"""
+
+ net.synapses.append(
+ Synapse(
+ id="ampaSyn",
+ pynn_receptor_type="excitatory",
+ pynn_synapse_type="curr_alpha",
+ parameters={"tau_syn": 20},
+ )
+ )
+ """net.synapses.append(
+ Synapse(
+ id="gabaSyn",
+ pynn_receptor_type="inhibitory",
+ pynn_synapse_type="cond_alpha",
+ parameters={"e_rev": -80, "tau_syn": 10},
+ )
+ )"""
+
+ if num_pop1 > 0:
+ net.projections.append(
+ Projection(
+ id="proj0",
+ presynaptic=p0.id,
+ postsynaptic=p1.id,
+ synapse="ampaSyn",
+ delay=2,
+ weight=conn_weight,
+ )
+ )
+ net.projections[0].random_connectivity = RandomConnectivity(
+ probability=conn_prob
+ )
+
+ """net.projections.append(
+ Projection(
+ id="proj1",
+ presynaptic=p0.id,
+ postsynaptic=p2.id,
+ synapse="gabaSyn",
+ delay=2,
+ weight=0.01,
+ )
+ )
+ net.projections[1].random_connectivity = RandomConnectivity(probability=1)"""
+
+ net.inputs.append(
+ Input(
+ id="stim",
+ input_source=input_source.id,
+ population=p0.id,
+ percentage=input_percentage,
+ weight=input_weight,
+ )
+ )
+
+ net_json_file = net.to_json_file("%s.json" % net.id)
+ net_yaml_file = net.to_yaml_file("%s.yaml" % net.id)
+
+ ################################################################################
+ ### Build Simulation object & save as JSON
+
+ sim = Simulation(
+ id="Sim%s" % net.id,
+ network=net_json_file,
+ duration="1000",
+ dt="0.01",
+ record_traces={"all": "*"},
+ record_spikes={"all": "*"} if "IF_" in pynn_cell else {},
+ )
+
+ sim.to_json_file()
+ sim.network = net_yaml_file
+ sim.to_yaml_file("%s.yaml" % sim.id)
+
+ sim.network = net_json_file # reverting, for call below...
+
+ return sim, net
+
+
+if __name__ == "__main__":
+
+ if "-one" in sys.argv:
+ sim, net = generate("OneCell", num_pop0=1, num_pop1=0, input_percentage=100)
+ elif "-hh" in sys.argv:
+ sim, net = generate(
+ "HH", num_pop0=1, num_pop1=0, input_percentage=0, pynn_cell="HH_cond_exp"
+ )
+ elif "-input_weights" in sys.argv:
+ sim, net = generate(
+ "InputWeights",
+ num_pop0=4,
+ num_pop1=0,
+ input_percentage=62,
+ input_weight=".8*random()",
+ )
+ elif "-simple_net" in sys.argv:
+ sim, net = generate(
+ "SimpleNet",
+ num_pop0=1,
+ num_pop1=1,
+ input_percentage=100,
+ input_weight="1",
+ )
+ elif "-net1" in sys.argv:
+ sim, net = generate(
+ "Net1",
+ num_pop0=2,
+ num_pop1=3,
+ conn_weight="random()",
+ input_percentage=100,
+ input_weight="2*random()",
+ )
+ else:
+ sim, net = generate("All")
+
+ ################################################################################
+ ### Run in some simulators
+
+ from neuromllite.NetworkGenerator import check_to_generate_or_run
+
+ check_to_generate_or_run(sys.argv, sim)
diff --git a/examples/NeuroML/PyNN/HH.mdf.png b/examples/NeuroML/PyNN/HH.mdf.png
new file mode 100644
index 00000000..d508826a
Binary files /dev/null and b/examples/NeuroML/PyNN/HH.mdf.png differ
diff --git a/examples/NeuroML/PyNN/HH.mdf.yaml b/examples/NeuroML/PyNN/HH.mdf.yaml
new file mode 100644
index 00000000..d3d7bc25
--- /dev/null
+++ b/examples/NeuroML/PyNN/HH.mdf.yaml
@@ -0,0 +1,191 @@
+HH:
+ format: ModECI MDF v0.4
+ graphs:
+ HH:
+ notes: 'Example: HH'
+ nodes:
+ pop0:
+ metadata:
+ color: 1 0 0
+ radius: 20
+ region: region1
+ parameters:
+ cm:
+ value:
+ - 0.2
+ i_offset:
+ value:
+ - 0.05
+ tau_syn_E:
+ value:
+ - 0.2
+ tau_syn_I:
+ value:
+ - 2.0
+ v_init:
+ value:
+ - -65.0
+ v_offset:
+ value:
+ - -63.0
+ e_rev_E:
+ value:
+ - 0.0
+ e_rev_I:
+ value:
+ - -80.0
+ e_rev_K:
+ value:
+ - -90.0
+ e_rev_Na:
+ value:
+ - 50.0
+ e_rev_leak:
+ value:
+ - -65.0
+ g_leak:
+ value:
+ - 0.01
+ gbar_K:
+ value:
+ - 6.0
+ gbar_Na:
+ value:
+ - 20.0
+ MSEC:
+ value:
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ NFARAD:
+ value:
+ - 1.0e-09
+ spike:
+ value:
+ - 0
+ v:
+ default_initial_value: v_init * MVOLT
+ time_derivative: (MVOLT * (iMemb / cm) / MSEC) + (iSyn
+ / (cm * NFARAD))
+ m:
+ time_derivative: (alpham * (1 - m) - betam * m) / MSEC
+ default_initial_value:
+ - 0
+ h:
+ time_derivative: (alphah * (1 - h) - betah * h) / MSEC
+ default_initial_value:
+ - 0
+ n:
+ time_derivative: (alphan * (1 - n) - betan * n) / MSEC
+ default_initial_value:
+ - 0
+ iSyn:
+ value: synapses_i
+ iLeak:
+ value: g_leak * (e_rev_leak - (v / MVOLT))
+ iNa:
+ value: gbar_Na * (m * m * m) * h * (e_rev_Na - (v / MVOLT))
+ iK:
+ value: gbar_K * (n * n * n * n) * (e_rev_K - (v / MVOLT))
+ iMemb:
+ value: iLeak + iNa + iK + i_offset
+ alpham:
+ value: 0.32 * (13 - (v / MVOLT) + v_offset) / (numpy.exp((13
+ - (v / MVOLT) + v_offset) / 4.0) - 1)
+ betam:
+ value: 0.28 * ((v / MVOLT) - v_offset - 40) / (numpy.exp(((v
+ / MVOLT) - v_offset - 40) / 5.0) - 1)
+ alphah:
+ value: 0.128 * numpy.exp((17 - (v / MVOLT) + v_offset)
+ / 18.0)
+ betah:
+ value: 4.0 / (1 + numpy.exp((40 - (v / MVOLT) + v_offset)
+ / 5))
+ alphan:
+ value: 0.032 * (15 - (v / MVOLT) + v_offset) / (numpy.exp((15
+ - (v / MVOLT) + v_offset) / 5) - 1)
+ betan:
+ value: 0.5 * numpy.exp((10 - (v / MVOLT) + v_offset) /
+ 40)
+ input_ports:
+ spike_in_E:
+ shape:
+ - 1
+ reduce: add
+ spike_in_I:
+ shape:
+ - 1
+ reduce: add
+ synapses_i: {}
+ output_ports:
+ spike:
+ value: spike
+ v:
+ value: v
+ m:
+ value: m
+ h:
+ value: h
+ n:
+ value: n
+ notes: "Cell: [Cell(notes=None, id='testcell', parameters={'i_offset':\
+ \ 0.05}, neuroml2_source_file=None, lems_source_file=None,\
+ \ neuroml2_cell=None, pynn_cell='HH_cond_exp', arbor_cell=None,\
+ \ bindsnet_node=None)] is defined in None and in Lems is:\
+ \ Component, id: testcell, type: HH_cond_exp,\n parameters:\
+ \ {'cm': '0.2', 'i_offset': 0.05, 'tau_syn_E': '0.2', 'tau_syn_I':\
+ \ '2.', 'v_init': '-65.', 'v_offset': '-63.', 'e_rev_E': '0.',\
+ \ 'e_rev_I': '-80.', 'e_rev_K': '-90.', 'e_rev_Na': '50.',\
+ \ 'e_rev_leak': '-65.', 'g_leak': '0.01', 'gbar_K': '6.',\
+ \ 'gbar_Na': '20.'}\n parent: None\n"
+ InputList_stim:
+ parameters:
+ delay:
+ value:
+ - 0.2
+ duration:
+ value:
+ - 0.6
+ amplitude:
+ value:
+ - 0.0
+ weight:
+ value:
+ - 0.0
+ i:
+ conditions:
+ condition_0:
+ test: t < delay
+ value: '0'
+ condition_1:
+ test: t >= delay and t < duration + delay
+ value: weight * amplitude
+ condition_2:
+ test: t >= duration + delay
+ value: '0'
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ input_ports:
+ spike_input:
+ shape:
+ - 1
+ reduce: add
+ output_ports:
+ i:
+ value: i
+ notes: "Cell: [InputSource(notes=None, id='i_clamp', parameters={'amplitude':\
+ \ 'input_amp', 'start': 200.0, 'stop': 800.0}, neuroml2_source_file=None,\
+ \ neuroml2_input=None, lems_source_file=None, pynn_input='DCSource')]\
+ \ is defined in None and in Lems is: Component, id: i_clamp,\
+ \ type: pulseGenerator,\n parameters: {'delay': '200.0ms',\
+ \ 'duration': '600.0ms', 'amplitude': '0.0nA'}\n parent:\
+ \ None\n"
+ edges:
+ Edge InputList_stim to pop0:
+ name: Edge InputList_stim to pop0
+ sender_port: i
+ receiver_port: synapses_i
+ sender: InputList_stim
+ receiver: pop0
diff --git a/examples/NeuroML/PyNN/HH.net.nml b/examples/NeuroML/PyNN/HH.net.nml
new file mode 100644
index 00000000..46da98e6
--- /dev/null
+++ b/examples/NeuroML/PyNN/HH.net.nml
@@ -0,0 +1,24 @@
+
+ Generated by NeuroMLlite v0.5.7
+ Generated network: HH
+ Generation seed: 1234
+ NeuroMLlite parameters:
+ input_amp = 0
+
+
+
+
+ Example: HH
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/NeuroML/PyNN/InputWeights.mdf.png b/examples/NeuroML/PyNN/InputWeights.mdf.png
new file mode 100644
index 00000000..8c07eec1
Binary files /dev/null and b/examples/NeuroML/PyNN/InputWeights.mdf.png differ
diff --git a/examples/NeuroML/PyNN/InputWeights.mdf.yaml b/examples/NeuroML/PyNN/InputWeights.mdf.yaml
new file mode 100644
index 00000000..c0aa1a66
--- /dev/null
+++ b/examples/NeuroML/PyNN/InputWeights.mdf.yaml
@@ -0,0 +1,244 @@
+InputWeights:
+ format: ModECI MDF v0.4
+ graphs:
+ InputWeights:
+ notes: 'Example: InputWeights'
+ nodes:
+ pop0:
+ metadata:
+ color: 1 0 0
+ radius: 20
+ region: region1
+ parameters:
+ cm:
+ value:
+ - 1.0
+ - 1.0
+ - 1.0
+ - 1.0
+ i_offset:
+ value:
+ - 0.0
+ - 0.0
+ - 0.0
+ - 0.0
+ tau_syn_E:
+ value:
+ - 0.5
+ - 0.5
+ - 0.5
+ - 0.5
+ tau_syn_I:
+ value:
+ - 0.5
+ - 0.5
+ - 0.5
+ - 0.5
+ v_init:
+ value:
+ - -65.0
+ - -65.0
+ - -65.0
+ - -65.0
+ tau_m:
+ value:
+ - 20.0
+ - 20.0
+ - 20.0
+ - 20.0
+ tau_refrac:
+ value:
+ - 5.0
+ - 5.0
+ - 5.0
+ - 5.0
+ v_reset:
+ value:
+ - -65.0
+ - -65.0
+ - -65.0
+ - -65.0
+ v_rest:
+ value:
+ - -65.0
+ - -65.0
+ - -65.0
+ - -65.0
+ v_thresh:
+ value:
+ - -50.0
+ - -50.0
+ - -50.0
+ - -50.0
+ MSEC:
+ value:
+ - 0.001
+ - 0.001
+ - 0.001
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ - 0.001
+ - 0.001
+ - 0.001
+ NFARAD:
+ value:
+ - 1.0e-09
+ - 1.0e-09
+ - 1.0e-09
+ - 1.0e-09
+ spike:
+ default_initial_value:
+ - 0
+ - 0
+ - 0
+ - 0
+ conditions:
+ condition_spike_on:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: 1
+ condition_spike_off:
+ test: spike > 0
+ value: 0
+ v:
+ time_derivative: REGIME_integrating * ((MVOLT * ((i_offset/cm)
+ + ((v_rest - (v/MVOLT)) / tau_m))/MSEC) + (iSyn /
+ (cm * NFARAD)))
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: v_reset * MVOLT
+ default_initial_value: v_init * MVOLT
+ lastSpikeTime:
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: t
+ ACTIVE_REGIME:
+ value:
+ - 1
+ - 1
+ - 1
+ - 1
+ INACTIVE_REGIME:
+ value:
+ - 0
+ - 0
+ - 0
+ - 0
+ REGIME_refractory:
+ value: REGIME_refractory
+ default_initial_value: INACTIVE_REGIME
+ conditions:
+ regime_exit_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: INACTIVE_REGIME
+ regime_entry_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: ACTIVE_REGIME
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ REGIME_integrating:
+ conditions:
+ regime_entry_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: ACTIVE_REGIME
+ regime_exit_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: INACTIVE_REGIME
+ value: REGIME_integrating
+ default_initial_value: ACTIVE_REGIME
+ iSyn:
+ value: synapses_i
+ input_ports:
+ spike_in_E:
+ shape:
+ - 4
+ reduce: add
+ spike_in_I:
+ shape:
+ - 4
+ reduce: add
+ synapses_i: {}
+ output_ports:
+ spike:
+ value: spike
+ REGIME_refractory:
+ value: REGIME_refractory
+ REGIME_integrating:
+ value: REGIME_integrating
+ v:
+ value: v
+ lastSpikeTime:
+ value: lastSpikeTime
+ notes: "Cell: [Cell(notes=None, id='testcell', parameters={'i_offset':\
+ \ 0.0, 'tau_refrac': 5}, neuroml2_source_file=None, lems_source_file=None,\
+ \ neuroml2_cell=None, pynn_cell='IF_curr_alpha', arbor_cell=None,\
+ \ bindsnet_node=None)] is defined in None and in Lems is:\
+ \ Component, id: testcell, type: IF_curr_alpha,\n parameters:\
+ \ {'cm': '1.', 'i_offset': 0.0, 'tau_syn_E': '0.5', 'tau_syn_I':\
+ \ '0.5', 'v_init': '-65.', 'tau_m': '20.', 'tau_refrac': 5,\
+ \ 'v_reset': '-65.', 'v_rest': '-65.', 'v_thresh': '-50.'}\n\
+ \ parent: None\n"
+ InputList_stim:
+ parameters:
+ delay:
+ value:
+ - 0.2
+ duration:
+ value:
+ - 0.6
+ amplitude:
+ value:
+ - 9.9e-10
+ weight:
+ value:
+ - 0.4926525560828922
+ - 0.09153037575095012
+ - 0.7719212487329726
+ - 0.37271884720664766
+ i:
+ conditions:
+ condition_0:
+ test: t < delay
+ value: '0'
+ condition_1:
+ test: t >= delay and t < duration + delay
+ value: weight * amplitude
+ condition_2:
+ test: t >= duration + delay
+ value: '0'
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ input_ports:
+ spike_input:
+ shape:
+ - 1
+ reduce: add
+ output_ports:
+ i:
+ value: i
+ notes: "Cell: [InputSource(notes=None, id='i_clamp', parameters={'amplitude':\
+ \ 'input_amp', 'start': 200.0, 'stop': 800.0}, neuroml2_source_file=None,\
+ \ neuroml2_input=None, lems_source_file=None, pynn_input='DCSource')]\
+ \ is defined in None and in Lems is: Component, id: i_clamp,\
+ \ type: pulseGenerator,\n parameters: {'delay': '200.0ms',\
+ \ 'duration': '600.0ms', 'amplitude': '0.99nA'}\n parent:\
+ \ None\n"
+ edges:
+ Edge InputList_stim to pop0:
+ name: Edge InputList_stim to pop0
+ sender_port: i
+ receiver_port: synapses_i
+ sender: InputList_stim
+ receiver: pop0
diff --git a/examples/NeuroML/PyNN/InputWeights.net.nml b/examples/NeuroML/PyNN/InputWeights.net.nml
new file mode 100644
index 00000000..52581ad5
--- /dev/null
+++ b/examples/NeuroML/PyNN/InputWeights.net.nml
@@ -0,0 +1,38 @@
+
+ Generated by NeuroMLlite v0.5.7
+ Generated network: InputWeights
+ Generation seed: 1234
+ NeuroMLlite parameters:
+ input_amp = 0.99
+
+
+
+
+ Example: InputWeights
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/NeuroML/PyNN/Net1.mdf.png b/examples/NeuroML/PyNN/Net1.mdf.png
new file mode 100644
index 00000000..4854e99d
Binary files /dev/null and b/examples/NeuroML/PyNN/Net1.mdf.png differ
diff --git a/examples/NeuroML/PyNN/Net1.mdf.yaml b/examples/NeuroML/PyNN/Net1.mdf.yaml
new file mode 100644
index 00000000..f99d318f
--- /dev/null
+++ b/examples/NeuroML/PyNN/Net1.mdf.yaml
@@ -0,0 +1,461 @@
+Net1:
+ format: ModECI MDF v0.4
+ graphs:
+ Net1:
+ notes: 'Example: Net1'
+ nodes:
+ pop0:
+ metadata:
+ color: 1 0 0
+ radius: 20
+ region: region1
+ parameters:
+ cm:
+ value:
+ - 1.0
+ - 1.0
+ i_offset:
+ value:
+ - 0.0
+ - 0.0
+ tau_syn_E:
+ value:
+ - 20.0
+ - 20.0
+ tau_syn_I:
+ value:
+ - 0.5
+ - 0.5
+ v_init:
+ value:
+ - -65.0
+ - -65.0
+ tau_m:
+ value:
+ - 20.0
+ - 20.0
+ tau_refrac:
+ value:
+ - 5.0
+ - 5.0
+ v_reset:
+ value:
+ - -65.0
+ - -65.0
+ v_rest:
+ value:
+ - -65.0
+ - -65.0
+ v_thresh:
+ value:
+ - -50.0
+ - -50.0
+ MSEC:
+ value:
+ - 0.001
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ - 0.001
+ NFARAD:
+ value:
+ - 1.0e-09
+ - 1.0e-09
+ spike:
+ default_initial_value:
+ - 0
+ - 0
+ conditions:
+ condition_spike_on:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: 1
+ condition_spike_off:
+ test: spike > 0
+ value: 0
+ v:
+ time_derivative: REGIME_integrating * ((MVOLT * ((i_offset/cm)
+ + ((v_rest - (v/MVOLT)) / tau_m))/MSEC) + (iSyn /
+ (cm * NFARAD)))
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: v_reset * MVOLT
+ default_initial_value: v_init * MVOLT
+ lastSpikeTime:
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: t
+ ACTIVE_REGIME:
+ value:
+ - 1
+ - 1
+ INACTIVE_REGIME:
+ value:
+ - 0
+ - 0
+ REGIME_refractory:
+ value: REGIME_refractory
+ default_initial_value: INACTIVE_REGIME
+ conditions:
+ regime_exit_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: INACTIVE_REGIME
+ regime_entry_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: ACTIVE_REGIME
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ REGIME_integrating:
+ conditions:
+ regime_entry_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: ACTIVE_REGIME
+ regime_exit_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: INACTIVE_REGIME
+ value: REGIME_integrating
+ default_initial_value: ACTIVE_REGIME
+ iSyn:
+ value: synapses_i
+ input_ports:
+ spike_in_E:
+ shape:
+ - 2
+ reduce: add
+ spike_in_I:
+ shape:
+ - 2
+ reduce: add
+ synapses_i: {}
+ output_ports:
+ spike:
+ value: spike
+ REGIME_refractory:
+ value: REGIME_refractory
+ REGIME_integrating:
+ value: REGIME_integrating
+ v:
+ value: v
+ lastSpikeTime:
+ value: lastSpikeTime
+ notes: "Cell: [Cell(notes=None, id='testcell', parameters={'i_offset':\
+ \ 0.0, 'tau_refrac': 5}, neuroml2_source_file=None, lems_source_file=None,\
+ \ neuroml2_cell=None, pynn_cell='IF_curr_alpha', arbor_cell=None,\
+ \ bindsnet_node=None)] is defined in None and in Lems is:\
+ \ Component, id: testcell, type: IF_curr_alpha,\n parameters:\
+ \ {'cm': '1.', 'i_offset': 0.0, 'tau_syn_E': '20.', 'tau_syn_I':\
+ \ '0.5', 'v_init': '-65.', 'tau_m': '20.', 'tau_refrac': 5,\
+ \ 'v_reset': '-65.', 'v_rest': '-65.', 'v_thresh': '-50.'}\n\
+ \ parent: None\n"
+ pop1:
+ metadata:
+ color: 0 1 0
+ radius: 20
+ region: region1
+ parameters:
+ cm:
+ value:
+ - 1.0
+ - 1.0
+ - 1.0
+ i_offset:
+ value:
+ - 0.0
+ - 0.0
+ - 0.0
+ tau_syn_E:
+ value:
+ - 20.0
+ - 20.0
+ - 20.0
+ tau_syn_I:
+ value:
+ - 0.5
+ - 0.5
+ - 0.5
+ v_init:
+ value:
+ - -65.0
+ - -65.0
+ - -65.0
+ tau_m:
+ value:
+ - 20.0
+ - 20.0
+ - 20.0
+ tau_refrac:
+ value:
+ - 5.0
+ - 5.0
+ - 5.0
+ v_reset:
+ value:
+ - -65.0
+ - -65.0
+ - -65.0
+ v_rest:
+ value:
+ - -65.0
+ - -65.0
+ - -65.0
+ v_thresh:
+ value:
+ - -50.0
+ - -50.0
+ - -50.0
+ MSEC:
+ value:
+ - 0.001
+ - 0.001
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ - 0.001
+ - 0.001
+ NFARAD:
+ value:
+ - 1.0e-09
+ - 1.0e-09
+ - 1.0e-09
+ spike:
+ default_initial_value:
+ - 0
+ - 0
+ - 0
+ conditions:
+ condition_spike_on:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: 1
+ condition_spike_off:
+ test: spike > 0
+ value: 0
+ v:
+ time_derivative: REGIME_integrating * ((MVOLT * ((i_offset/cm)
+ + ((v_rest - (v/MVOLT)) / tau_m))/MSEC) + (iSyn /
+ (cm * NFARAD)))
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: v_reset * MVOLT
+ default_initial_value: v_init * MVOLT
+ lastSpikeTime:
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: t
+ ACTIVE_REGIME:
+ value:
+ - 1
+ - 1
+ - 1
+ INACTIVE_REGIME:
+ value:
+ - 0
+ - 0
+ - 0
+ REGIME_refractory:
+ value: REGIME_refractory
+ default_initial_value: INACTIVE_REGIME
+ conditions:
+ regime_exit_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: INACTIVE_REGIME
+ regime_entry_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: ACTIVE_REGIME
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ REGIME_integrating:
+ conditions:
+ regime_entry_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: ACTIVE_REGIME
+ regime_exit_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: INACTIVE_REGIME
+ value: REGIME_integrating
+ default_initial_value: ACTIVE_REGIME
+ iSyn:
+ value: synapses_i
+ input_ports:
+ spike_in_E:
+ shape:
+ - 3
+ reduce: add
+ spike_in_I:
+ shape:
+ - 3
+ reduce: add
+ synapses_i: {}
+ output_ports:
+ spike:
+ value: spike
+ REGIME_refractory:
+ value: REGIME_refractory
+ REGIME_integrating:
+ value: REGIME_integrating
+ v:
+ value: v
+ lastSpikeTime:
+ value: lastSpikeTime
+ notes: "Cell: [Cell(notes=None, id='testcell', parameters={'i_offset':\
+ \ 0.0, 'tau_refrac': 5}, neuroml2_source_file=None, lems_source_file=None,\
+ \ neuroml2_cell=None, pynn_cell='IF_curr_alpha', arbor_cell=None,\
+ \ bindsnet_node=None)] is defined in None and in Lems is:\
+ \ Component, id: testcell, type: IF_curr_alpha,\n parameters:\
+ \ {'cm': '1.', 'i_offset': 0.0, 'tau_syn_E': '20.', 'tau_syn_I':\
+ \ '0.5', 'v_init': '-65.', 'tau_m': '20.', 'tau_refrac': 5,\
+ \ 'v_reset': '-65.', 'v_rest': '-65.', 'v_thresh': '-50.'}\n\
+ \ parent: None\n"
+ proj0_ampaSyn:
+ parameters:
+ tau_syn:
+ value:
+ - 20.0
+ - 20.0
+ - 20.0
+ weight:
+ function: MatMul
+ args:
+ A: spike_input
+ B: weighted_inputs
+ MSEC:
+ value:
+ - 0.001
+ - 0.001
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ - 0.001
+ - 0.001
+ NAMP:
+ value:
+ - 1.0e-09
+ - 1.0e-09
+ - 1.0e-09
+ I:
+ time_derivative: (2.7182818*A - I)/(tau_syn*MSEC)
+ default_initial_value:
+ - 0
+ - 0
+ - 0
+ A:
+ conditions:
+ condition_spike_input_on_eh:
+ test: weighted_inputs > 0
+ value: A + weight
+ time_derivative: -A /(tau_syn*MSEC)
+ default_initial_value:
+ - 0
+ - 0
+ - 0
+ i:
+ value: I * NAMP
+ weighted_inputs:
+ value:
+ - - 0.11441296968868764
+ - 0.48675154060475834
+ - 0.06456228097718608
+ - - 0.46589855900830957
+ - 0.08892882999066232
+ - 0.26958550381944824
+ input_ports:
+ spike_input:
+ shape:
+ - 2
+ reduce: add
+ output_ports:
+ I:
+ value: I
+ A:
+ value: A
+ i:
+ value: i
+ notes: "Cell: [Synapse(notes=None, id='ampaSyn', parameters={'tau_syn':\
+ \ 20}, neuroml2_source_file=None, lems_source_file=None, pynn_synapse_type='curr_alpha',\
+ \ pynn_receptor_type='excitatory')] is defined in None and\
+ \ in Lems is: Component, id: ampaSyn, type: alphaCurrSynapse,\n\
+ \ parameters: {'tau_syn': 20}\n parent: None\n"
+ InputList_stim:
+ parameters:
+ delay:
+ value:
+ - 0.2
+ duration:
+ value:
+ - 0.6
+ amplitude:
+ value:
+ - 9.9e-10
+ weight:
+ value:
+ - 0.9620727427330369
+ - 1.8670309960846934
+ i:
+ conditions:
+ condition_0:
+ test: t < delay
+ value: '0'
+ condition_1:
+ test: t >= delay and t < duration + delay
+ value: weight * amplitude
+ condition_2:
+ test: t >= duration + delay
+ value: '0'
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ input_ports:
+ spike_input:
+ shape:
+ - 1
+ reduce: add
+ output_ports:
+ i:
+ value: i
+ notes: "Cell: [InputSource(notes=None, id='i_clamp', parameters={'amplitude':\
+ \ 'input_amp', 'start': 200.0, 'stop': 800.0}, neuroml2_source_file=None,\
+ \ neuroml2_input=None, lems_source_file=None, pynn_input='DCSource')]\
+ \ is defined in None and in Lems is: Component, id: i_clamp,\
+ \ type: pulseGenerator,\n parameters: {'delay': '200.0ms',\
+ \ 'duration': '600.0ms', 'amplitude': '0.99nA'}\n parent:\
+ \ None\n"
+ edges:
+ pop0_TO_proj0_ampaSyn:
+ name: pop0_TO_proj0_ampaSyn
+ sender_port: spike
+ receiver_port: spike_input
+ sender: pop0
+ receiver: proj0_ampaSyn
+ proj0_ampaSyn_TO_pop1:
+ name: proj0_ampaSyn_TO_pop1
+ sender_port: i
+ receiver_port: synapses_i
+ sender: proj0_ampaSyn
+ receiver: pop1
+ Edge InputList_stim to pop0:
+ name: Edge InputList_stim to pop0
+ sender_port: i
+ receiver_port: synapses_i
+ sender: InputList_stim
+ receiver: pop0
diff --git a/examples/NeuroML/PyNN/Net1.net.nml b/examples/NeuroML/PyNN/Net1.net.nml
new file mode 100644
index 00000000..cd0236f1
--- /dev/null
+++ b/examples/NeuroML/PyNN/Net1.net.nml
@@ -0,0 +1,52 @@
+
+ Generated by NeuroMLlite v0.5.7
+ Generated network: Net1
+ Generation seed: 1234
+ NeuroMLlite parameters:
+ input_amp = 0.99
+
+
+
+
+ Example: Net1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/NeuroML/PyNN/OneCell.mdf.png b/examples/NeuroML/PyNN/OneCell.mdf.png
new file mode 100644
index 00000000..1f5d25a0
Binary files /dev/null and b/examples/NeuroML/PyNN/OneCell.mdf.png differ
diff --git a/examples/NeuroML/PyNN/OneCell.mdf.yaml b/examples/NeuroML/PyNN/OneCell.mdf.yaml
new file mode 100644
index 00000000..2d0fe4ac
--- /dev/null
+++ b/examples/NeuroML/PyNN/OneCell.mdf.yaml
@@ -0,0 +1,193 @@
+OneCell:
+ format: ModECI MDF v0.4
+ graphs:
+ OneCell:
+ notes: 'Example: OneCell'
+ nodes:
+ pop0:
+ metadata:
+ color: 1 0 0
+ radius: 20
+ region: region1
+ parameters:
+ cm:
+ value:
+ - 1.0
+ i_offset:
+ value:
+ - 0.0
+ tau_syn_E:
+ value:
+ - 0.5
+ tau_syn_I:
+ value:
+ - 0.5
+ v_init:
+ value:
+ - -65.0
+ tau_m:
+ value:
+ - 20.0
+ tau_refrac:
+ value:
+ - 5.0
+ v_reset:
+ value:
+ - -65.0
+ v_rest:
+ value:
+ - -65.0
+ v_thresh:
+ value:
+ - -50.0
+ MSEC:
+ value:
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ NFARAD:
+ value:
+ - 1.0e-09
+ spike:
+ default_initial_value:
+ - 0
+ conditions:
+ condition_spike_on:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: 1
+ condition_spike_off:
+ test: spike > 0
+ value: 0
+ v:
+ time_derivative: REGIME_integrating * ((MVOLT * ((i_offset/cm)
+ + ((v_rest - (v/MVOLT)) / tau_m))/MSEC) + (iSyn /
+ (cm * NFARAD)))
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: v_reset * MVOLT
+ default_initial_value: v_init * MVOLT
+ lastSpikeTime:
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: t
+ ACTIVE_REGIME:
+ value:
+ - 1
+ INACTIVE_REGIME:
+ value:
+ - 0
+ REGIME_refractory:
+ value: REGIME_refractory
+ default_initial_value: INACTIVE_REGIME
+ conditions:
+ regime_exit_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: INACTIVE_REGIME
+ regime_entry_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: ACTIVE_REGIME
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ REGIME_integrating:
+ conditions:
+ regime_entry_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: ACTIVE_REGIME
+ regime_exit_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: INACTIVE_REGIME
+ value: REGIME_integrating
+ default_initial_value: ACTIVE_REGIME
+ iSyn:
+ value: synapses_i
+ input_ports:
+ spike_in_E:
+ shape:
+ - 1
+ reduce: add
+ spike_in_I:
+ shape:
+ - 1
+ reduce: add
+ synapses_i: {}
+ output_ports:
+ spike:
+ value: spike
+ REGIME_refractory:
+ value: REGIME_refractory
+ REGIME_integrating:
+ value: REGIME_integrating
+ v:
+ value: v
+ lastSpikeTime:
+ value: lastSpikeTime
+ notes: "Cell: [Cell(notes=None, id='testcell', parameters={'i_offset':\
+ \ 0.0, 'tau_refrac': 5}, neuroml2_source_file=None, lems_source_file=None,\
+ \ neuroml2_cell=None, pynn_cell='IF_curr_alpha', arbor_cell=None,\
+ \ bindsnet_node=None)] is defined in None and in Lems is:\
+ \ Component, id: testcell, type: IF_curr_alpha,\n parameters:\
+ \ {'cm': '1.', 'i_offset': 0.0, 'tau_syn_E': '0.5', 'tau_syn_I':\
+ \ '0.5', 'v_init': '-65.', 'tau_m': '20.', 'tau_refrac': 5,\
+ \ 'v_reset': '-65.', 'v_rest': '-65.', 'v_thresh': '-50.'}\n\
+ \ parent: None\n"
+ InputList_stim:
+ parameters:
+ delay:
+ value:
+ - 0.2
+ duration:
+ value:
+ - 0.6
+ amplitude:
+ value:
+ - 9.9e-10
+ weight:
+ value:
+ - 0.8
+ i:
+ conditions:
+ condition_0:
+ test: t < delay
+ value: '0'
+ condition_1:
+ test: t >= delay and t < duration + delay
+ value: weight * amplitude
+ condition_2:
+ test: t >= duration + delay
+ value: '0'
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ input_ports:
+ spike_input:
+ shape:
+ - 1
+ reduce: add
+ output_ports:
+ i:
+ value: i
+ notes: "Cell: [InputSource(notes=None, id='i_clamp', parameters={'amplitude':\
+ \ 'input_amp', 'start': 200.0, 'stop': 800.0}, neuroml2_source_file=None,\
+ \ neuroml2_input=None, lems_source_file=None, pynn_input='DCSource')]\
+ \ is defined in None and in Lems is: Component, id: i_clamp,\
+ \ type: pulseGenerator,\n parameters: {'delay': '200.0ms',\
+ \ 'duration': '600.0ms', 'amplitude': '0.99nA'}\n parent:\
+ \ None\n"
+ edges:
+ Edge InputList_stim to pop0:
+ name: Edge InputList_stim to pop0
+ sender_port: i
+ receiver_port: synapses_i
+ sender: InputList_stim
+ receiver: pop0
diff --git a/examples/NeuroML/PyNN/OneCell.net.nml b/examples/NeuroML/PyNN/OneCell.net.nml
new file mode 100644
index 00000000..6d5b4c08
--- /dev/null
+++ b/examples/NeuroML/PyNN/OneCell.net.nml
@@ -0,0 +1,26 @@
+
+ Generated by NeuroMLlite v0.5.7
+ Generated network: OneCell
+ Generation seed: 1234
+ NeuroMLlite parameters:
+ input_amp = 0.99
+
+
+
+
+ Example: OneCell
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/NeuroML/PyNN/RunInMDF.py b/examples/NeuroML/PyNN/RunInMDF.py
new file mode 100644
index 00000000..25efd009
--- /dev/null
+++ b/examples/NeuroML/PyNN/RunInMDF.py
@@ -0,0 +1,107 @@
+from modeci_mdf.utils import load_mdf, print_summary
+
+import sys
+import matplotlib.pyplot as plt
+
+
+def execute(mdf_filename):
+ mdf_model = load_mdf(mdf_filename)
+ mod_graph = mdf_model.graphs[0]
+
+ dt = 0.001
+ duration = 1
+
+ mdf_model.to_graph_image(
+ engine="dot",
+ output_format="png",
+ view_on_render=False,
+ level=1,
+ filename_root=mdf_filename.replace(".yaml", ".1").replace(".json", ".1"),
+ only_warn_on_fail=True, # Makes sure test of this doesn't fail on Windows on GitHub Actions
+ )
+ mdf_model.to_graph_image(
+ engine="dot",
+ output_format="png",
+ view_on_render=False,
+ level=2,
+ filename_root=mdf_filename.replace(".yaml", "").replace(".json", ""),
+ only_warn_on_fail=True, # Makes sure test of this doesn't fail on Windows on GitHub Actions
+ )
+
+ verbose = "-v" in sys.argv
+
+ from modeci_mdf.execution_engine import EvaluableGraph
+
+ eg = EvaluableGraph(mod_graph, verbose)
+ # duration= 2
+
+ t = 0
+ times = []
+ vv = {}
+ uu = {}
+ ii = {}
+
+ outputs = {}
+ for n in mod_graph.nodes:
+ outputs[n.id] = {}
+ for op in n.output_ports:
+ outputs[n.id][op.id] = {}
+
+ while t <= duration:
+ times.append(t)
+ print("====== Evaluating at t = %s ======" % (t))
+ if t == 0:
+ eg.evaluate(array_format=format) # replace with initialize?
+ else:
+ eg.evaluate(array_format=format, time_increment=dt)
+
+ for n in mod_graph.nodes:
+ for op in n.output_ports:
+ ov = eg.enodes[n.id].evaluable_outputs[op.id].curr_value
+ if type(ov) == int or type(ov) == float:
+ ov = [ov]
+ if ov is None:
+ raise Exception(
+ "Error getting value of output port: %s on node: %s"
+ % (op, n.id)
+ )
+ for i in range(len(ov)):
+ if not i in outputs[n.id][op.id]:
+ outputs[n.id][op.id][i] = []
+
+ outputs[n.id][op.id][i].append(ov[i])
+
+ t += dt
+
+ # print(times)
+ # print(outputs)
+
+ for n in mod_graph.nodes:
+ for op in n.output_ports:
+ vals = outputs[n.id][op.id]
+ plt.figure()
+ for i in vals:
+ label = "%s_%s_%i" % (n.id, op.id, i)
+ print(
+ " - Plotting %s, points in times: %i, val: %s"
+ % (label, len(times), len(vals[i]))
+ )
+ try:
+ plt.plot(times, vals[i], label=label)
+ plt.legend()
+ except Exception as e:
+ print(e)
+
+ # plt.savefig("Izh_run.png", bbox_inches="tight")
+
+ if not "-nogui" in sys.argv:
+ plt.show()
+
+
+if __name__ == "__main__":
+
+ if len(sys.argv) == 1 or sys.argv[1] == "-run":
+ print("Please specify the MDF file to run")
+ else:
+ f = sys.argv[1]
+ execute(f)
diff --git a/examples/NeuroML/PyNN/SimpleNet.mdf.png b/examples/NeuroML/PyNN/SimpleNet.mdf.png
new file mode 100644
index 00000000..3942ac5c
Binary files /dev/null and b/examples/NeuroML/PyNN/SimpleNet.mdf.png differ
diff --git a/examples/NeuroML/PyNN/SimpleNet.mdf.yaml b/examples/NeuroML/PyNN/SimpleNet.mdf.yaml
new file mode 100644
index 00000000..03d480d0
--- /dev/null
+++ b/examples/NeuroML/PyNN/SimpleNet.mdf.yaml
@@ -0,0 +1,395 @@
+SimpleNet:
+ format: ModECI MDF v0.4
+ graphs:
+ SimpleNet:
+ notes: 'Example: SimpleNet'
+ nodes:
+ pop0:
+ metadata:
+ color: 1 0 0
+ radius: 20
+ region: region1
+ parameters:
+ cm:
+ value:
+ - 1.0
+ i_offset:
+ value:
+ - 0.0
+ tau_syn_E:
+ value:
+ - 20.0
+ tau_syn_I:
+ value:
+ - 0.5
+ v_init:
+ value:
+ - -65.0
+ tau_m:
+ value:
+ - 20.0
+ tau_refrac:
+ value:
+ - 5.0
+ v_reset:
+ value:
+ - -65.0
+ v_rest:
+ value:
+ - -65.0
+ v_thresh:
+ value:
+ - -50.0
+ MSEC:
+ value:
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ NFARAD:
+ value:
+ - 1.0e-09
+ spike:
+ default_initial_value:
+ - 0
+ conditions:
+ condition_spike_on:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: 1
+ condition_spike_off:
+ test: spike > 0
+ value: 0
+ v:
+ time_derivative: REGIME_integrating * ((MVOLT * ((i_offset/cm)
+ + ((v_rest - (v/MVOLT)) / tau_m))/MSEC) + (iSyn /
+ (cm * NFARAD)))
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: v_reset * MVOLT
+ default_initial_value: v_init * MVOLT
+ lastSpikeTime:
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: t
+ ACTIVE_REGIME:
+ value:
+ - 1
+ INACTIVE_REGIME:
+ value:
+ - 0
+ REGIME_refractory:
+ value: REGIME_refractory
+ default_initial_value: INACTIVE_REGIME
+ conditions:
+ regime_exit_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: INACTIVE_REGIME
+ regime_entry_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: ACTIVE_REGIME
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ REGIME_integrating:
+ conditions:
+ regime_entry_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: ACTIVE_REGIME
+ regime_exit_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: INACTIVE_REGIME
+ value: REGIME_integrating
+ default_initial_value: ACTIVE_REGIME
+ iSyn:
+ value: synapses_i
+ input_ports:
+ spike_in_E:
+ shape:
+ - 1
+ reduce: add
+ spike_in_I:
+ shape:
+ - 1
+ reduce: add
+ synapses_i: {}
+ output_ports:
+ spike:
+ value: spike
+ REGIME_refractory:
+ value: REGIME_refractory
+ REGIME_integrating:
+ value: REGIME_integrating
+ v:
+ value: v
+ lastSpikeTime:
+ value: lastSpikeTime
+ notes: "Cell: [Cell(notes=None, id='testcell', parameters={'i_offset':\
+ \ 0.0, 'tau_refrac': 5}, neuroml2_source_file=None, lems_source_file=None,\
+ \ neuroml2_cell=None, pynn_cell='IF_curr_alpha', arbor_cell=None,\
+ \ bindsnet_node=None)] is defined in None and in Lems is:\
+ \ Component, id: testcell, type: IF_curr_alpha,\n parameters:\
+ \ {'cm': '1.', 'i_offset': 0.0, 'tau_syn_E': '20.', 'tau_syn_I':\
+ \ '0.5', 'v_init': '-65.', 'tau_m': '20.', 'tau_refrac': 5,\
+ \ 'v_reset': '-65.', 'v_rest': '-65.', 'v_thresh': '-50.'}\n\
+ \ parent: None\n"
+ pop1:
+ metadata:
+ color: 0 1 0
+ radius: 20
+ region: region1
+ parameters:
+ cm:
+ value:
+ - 1.0
+ i_offset:
+ value:
+ - 0.0
+ tau_syn_E:
+ value:
+ - 20.0
+ tau_syn_I:
+ value:
+ - 0.5
+ v_init:
+ value:
+ - -65.0
+ tau_m:
+ value:
+ - 20.0
+ tau_refrac:
+ value:
+ - 5.0
+ v_reset:
+ value:
+ - -65.0
+ v_rest:
+ value:
+ - -65.0
+ v_thresh:
+ value:
+ - -50.0
+ MSEC:
+ value:
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ NFARAD:
+ value:
+ - 1.0e-09
+ spike:
+ default_initial_value:
+ - 0
+ conditions:
+ condition_spike_on:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: 1
+ condition_spike_off:
+ test: spike > 0
+ value: 0
+ v:
+ time_derivative: REGIME_integrating * ((MVOLT * ((i_offset/cm)
+ + ((v_rest - (v/MVOLT)) / tau_m))/MSEC) + (iSyn /
+ (cm * NFARAD)))
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: v_reset * MVOLT
+ default_initial_value: v_init * MVOLT
+ lastSpikeTime:
+ conditions:
+ entering_regime_refractory:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: t
+ ACTIVE_REGIME:
+ value:
+ - 1
+ INACTIVE_REGIME:
+ value:
+ - 0
+ REGIME_refractory:
+ value: REGIME_refractory
+ default_initial_value: INACTIVE_REGIME
+ conditions:
+ regime_exit_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: INACTIVE_REGIME
+ regime_entry_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: ACTIVE_REGIME
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ REGIME_integrating:
+ conditions:
+ regime_entry_condition:
+ test: (REGIME_refractory == ACTIVE_REGIME) * (t
+ > lastSpikeTime + (tau_refrac*MSEC))
+ value: ACTIVE_REGIME
+ regime_exit_condition:
+ test: (REGIME_integrating == ACTIVE_REGIME) *
+ (v > v_thresh * MVOLT)
+ value: INACTIVE_REGIME
+ value: REGIME_integrating
+ default_initial_value: ACTIVE_REGIME
+ iSyn:
+ value: synapses_i
+ input_ports:
+ spike_in_E:
+ shape:
+ - 1
+ reduce: add
+ spike_in_I:
+ shape:
+ - 1
+ reduce: add
+ synapses_i: {}
+ output_ports:
+ spike:
+ value: spike
+ REGIME_refractory:
+ value: REGIME_refractory
+ REGIME_integrating:
+ value: REGIME_integrating
+ v:
+ value: v
+ lastSpikeTime:
+ value: lastSpikeTime
+ notes: "Cell: [Cell(notes=None, id='testcell', parameters={'i_offset':\
+ \ 0.0, 'tau_refrac': 5}, neuroml2_source_file=None, lems_source_file=None,\
+ \ neuroml2_cell=None, pynn_cell='IF_curr_alpha', arbor_cell=None,\
+ \ bindsnet_node=None)] is defined in None and in Lems is:\
+ \ Component, id: testcell, type: IF_curr_alpha,\n parameters:\
+ \ {'cm': '1.', 'i_offset': 0.0, 'tau_syn_E': '20.', 'tau_syn_I':\
+ \ '0.5', 'v_init': '-65.', 'tau_m': '20.', 'tau_refrac': 5,\
+ \ 'v_reset': '-65.', 'v_rest': '-65.', 'v_thresh': '-50.'}\n\
+ \ parent: None\n"
+ proj0_ampaSyn:
+ parameters:
+ tau_syn:
+ value:
+ - 20.0
+ weight:
+ function: MatMul
+ args:
+ A: spike_input
+ B: weighted_inputs
+ MSEC:
+ value:
+ - 0.001
+ MVOLT:
+ value:
+ - 0.001
+ NAMP:
+ value:
+ - 1.0e-09
+ I:
+ time_derivative: (2.7182818*A - I)/(tau_syn*MSEC)
+ default_initial_value:
+ - 0
+ A:
+ conditions:
+ condition_spike_input_on_eh:
+ test: weighted_inputs > 0
+ value: A + weight
+ time_derivative: -A /(tau_syn*MSEC)
+ default_initial_value:
+ - 0
+ i:
+ value: I * NAMP
+ weighted_inputs:
+ value:
+ - - 0.3
+ input_ports:
+ spike_input:
+ shape:
+ - 1
+ reduce: add
+ output_ports:
+ I:
+ value: I
+ A:
+ value: A
+ i:
+ value: i
+ notes: "Cell: [Synapse(notes=None, id='ampaSyn', parameters={'tau_syn':\
+ \ 20}, neuroml2_source_file=None, lems_source_file=None, pynn_synapse_type='curr_alpha',\
+ \ pynn_receptor_type='excitatory')] is defined in None and\
+ \ in Lems is: Component, id: ampaSyn, type: alphaCurrSynapse,\n\
+ \ parameters: {'tau_syn': 20}\n parent: None\n"
+ InputList_stim:
+ parameters:
+ delay:
+ value:
+ - 0.2
+ duration:
+ value:
+ - 0.6
+ amplitude:
+ value:
+ - 9.9e-10
+ weight:
+ value:
+ - 1
+ i:
+ conditions:
+ condition_0:
+ test: t < delay
+ value: '0'
+ condition_1:
+ test: t >= delay and t < duration + delay
+ value: weight * amplitude
+ condition_2:
+ test: t >= duration + delay
+ value: '0'
+ t:
+ default_initial_value: 0
+ time_derivative: '1'
+ input_ports:
+ spike_input:
+ shape:
+ - 1
+ reduce: add
+ output_ports:
+ i:
+ value: i
+ notes: "Cell: [InputSource(notes=None, id='i_clamp', parameters={'amplitude':\
+ \ 'input_amp', 'start': 200.0, 'stop': 800.0}, neuroml2_source_file=None,\
+ \ neuroml2_input=None, lems_source_file=None, pynn_input='DCSource')]\
+ \ is defined in None and in Lems is: Component, id: i_clamp,\
+ \ type: pulseGenerator,\n parameters: {'delay': '200.0ms',\
+ \ 'duration': '600.0ms', 'amplitude': '0.99nA'}\n parent:\
+ \ None\n"
+ edges:
+ pop0_TO_proj0_ampaSyn:
+ name: pop0_TO_proj0_ampaSyn
+ sender_port: spike
+ receiver_port: spike_input
+ sender: pop0
+ receiver: proj0_ampaSyn
+ proj0_ampaSyn_TO_pop1:
+ name: proj0_ampaSyn_TO_pop1
+ sender_port: i
+ receiver_port: synapses_i
+ sender: proj0_ampaSyn
+ receiver: pop1
+ Edge InputList_stim to pop0:
+ name: Edge InputList_stim to pop0
+ sender_port: i
+ receiver_port: synapses_i
+ sender: InputList_stim
+ receiver: pop0
diff --git a/examples/NeuroML/PyNN/SimpleNet.net.nml b/examples/NeuroML/PyNN/SimpleNet.net.nml
new file mode 100644
index 00000000..fd1d6097
--- /dev/null
+++ b/examples/NeuroML/PyNN/SimpleNet.net.nml
@@ -0,0 +1,37 @@
+
+ Generated by NeuroMLlite v0.5.7
+ Generated network: SimpleNet
+ Generation seed: 1234
+ NeuroMLlite parameters:
+ input_amp = 0.99
+
+
+
+
+ Example: SimpleNet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/NeuroML/PyNN/clean.sh b/examples/NeuroML/PyNN/clean.sh
new file mode 100755
index 00000000..6ac7357d
--- /dev/null
+++ b/examples/NeuroML/PyNN/clean.sh
@@ -0,0 +1,3 @@
+rm -rf *gv* *dat *spikes x86_64 arm64
+
+mv *pkl *txt *mdf* *png *mod LEMS* *nml All* Input* One* Sim* HH* Net1* /tmp
diff --git a/examples/NeuroML/PyNN/regenerateAndTest.sh b/examples/NeuroML/PyNN/regenerateAndTest.sh
new file mode 100755
index 00000000..41ef9a61
--- /dev/null
+++ b/examples/NeuroML/PyNN/regenerateAndTest.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+set -ex
+
+run_gui_examples=true
+
+if [[ ($# -eq 1) && ($1 == '-nogui') ]]; then
+ run_gui_examples=false
+fi
+
+#### Generate single cell example
+python Generate.py -one -nml
+pynml -validate OneCell.net.nml
+
+python Generate.py -one -mdf
+python RunInMDF.py OneCell.mdf.json -nogui
+
+
+#### Generate HH example
+python Generate.py -hh -nml
+pynml -validate HH.net.nml
+
+python Generate.py -hh -mdf
+python RunInMDF.py HH.mdf.json -nogui
+
+
+#### Generate multiple input example
+python Generate.py -input_weights -nml
+pynml -validate InputWeights.net.nml
+
+python Generate.py -input_weights -mdf
+python RunInMDF.py InputWeights.mdf.json -nogui
+
+
+#### Generate simple net example
+python Generate.py -simple_net -nml
+pynml -validate SimpleNet.net.nml
+
+python Generate.py -simple_net -mdf
+python RunInMDF.py SimpleNet.mdf.json -nogui
+
+
+#### Generate bigger net example
+python Generate.py -net1 -nml
+pynml -validate Net1.net.nml
+
+python Generate.py -net1 -mdf
+python RunInMDF.py Net1.mdf.json -nogui
diff --git a/examples/NeuroML/SimABCD.json b/examples/NeuroML/SimABCD.json
index 35bf02eb..c4404a5a 100644
--- a/examples/NeuroML/SimABCD.json
+++ b/examples/NeuroML/SimABCD.json
@@ -1,6 +1,6 @@
{
"SimABCD": {
- "version": "NeuroMLlite v0.5.5",
+ "version": "NeuroMLlite v0.5.7",
"network": "ABCD.json",
"duration": 5000.0,
"dt": 100.0,
diff --git a/examples/NeuroML/SimFN.json b/examples/NeuroML/SimFN.json
index cc8efc22..ba82f883 100644
--- a/examples/NeuroML/SimFN.json
+++ b/examples/NeuroML/SimFN.json
@@ -1,6 +1,6 @@
{
"SimFN": {
- "version": "NeuroMLlite v0.5.5",
+ "version": "NeuroMLlite v0.5.7",
"network": "FN.json",
"duration": 100.0,
"dt": 0.05,
diff --git a/examples/NeuroML/SimIzhikevichTest.yaml b/examples/NeuroML/SimIzhikevichTest.yaml
index aa52243c..6fe61ef2 100644
--- a/examples/NeuroML/SimIzhikevichTest.yaml
+++ b/examples/NeuroML/SimIzhikevichTest.yaml
@@ -1,5 +1,5 @@
SimIzhikevichTest:
- version: NeuroMLlite v0.5.5
+ version: NeuroMLlite v0.5.7
network: IzhikevichTest.nmllite.yaml
duration: 700.0
dt: 0.025
diff --git a/examples/NeuroML/regenerateAndTest.sh b/examples/NeuroML/regenerateAndTest.sh
index 1213237a..c70d0b24 100755
--- a/examples/NeuroML/regenerateAndTest.sh
+++ b/examples/NeuroML/regenerateAndTest.sh
@@ -83,4 +83,10 @@ python -m modeci_mdf.execution_engine IzhikevichTest.mdf.yaml
python Izh_run.py -nogui
+#### Test PyNN based examples
+cd PyNN
+./regenerateAndTest.sh
+
+
+
echo "Successfully ran all tests"
diff --git a/setup.cfg b/setup.cfg
index a2e591ce..f07b21fe 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -59,8 +59,9 @@ psyneulink =
psyneulink
neuroml =
- pyNeuroML>=0.5.20
- neuromllite>=0.5.2
+ pyNeuroML>=1.0.10
+ neuromllite>=0.5.6
+ PyNN==0.10.1
tensorflow =