diff --git a/.gitignore b/.gitignore
index 6b4a509f..5009199d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -109,3 +109,4 @@ arm64
/examples/parametersweep/IClamp_GenericNeuronCellX__lems.xml
/examples/parametersweep/LEMS_SimCanonical_X.png
/examples/parametersweep/Canonical_X__lems.xml
+/examples/parametersweep/average_last_1percent_GenericNeuronCellX.png
diff --git a/examples/parametersweep/CanonicalCircuit.py b/examples/parametersweep/CanonicalCircuit.py
index 9c8e65f9..0177bb8a 100644
--- a/examples/parametersweep/CanonicalCircuit.py
+++ b/examples/parametersweep/CanonicalCircuit.py
@@ -80,10 +80,18 @@ def generate(duration=1000, paramset="C"):
net = Network(id=reference)
net.parameters = {}
+
+ cell_params = {"bias": 0, "gain": 1, "tau": "100ms"}
+
if paramset == "X":
neuron_id = "GenericNeuronCellX"
- neuron_nmllite = Cell(id=neuron_id, lems_source_file='cell_X.xml')
+ neuron_nmllite = Cell(id=neuron_id, lems_source_file="cell_X.xml")
+ neuron_nmllite.parameters = {}
+
+ for p in cell_params:
+ neuron_nmllite.parameters[p] = p
+ net.parameters[p] = cell_params[p]
exc_syn = Synapse(
id="neuron_to_neuron_exc_syn_x", neuroml2_source_file="test_syns.xml"
@@ -126,11 +134,11 @@ def generate(duration=1000, paramset="C"):
net.parameters["scaleDinout"] = 0.5
if paramset == "X":
- net.parameters["stim_duration"] = "250ms"
- net.parameters["stim_amp"] = "1pA"
+ net.parameters["stim_duration"] = "2000ms"
+ net.parameters["stim_amp"] = "0.2pA"
net.parameters["weight_IN_MN"] = 1
net.parameters["weight_MN_MN_Exc"] = 1
- net.parameters["weight_MN_MN_Inh"] = -1
+ net.parameters["weight_MN_MN_Inh"] = -5
net.parameters["scaleDinout"] = 0.5
mode = "circ"
@@ -150,20 +158,22 @@ def generate(duration=1000, paramset="C"):
add_connection(net, "DD", "DB", inh_syn, "weight_MN_MN_Inh")
if mode == "iclamp":
-
- add_connection(net, "AVB", "VD", exc_syn, "weight_IN_MN")
- add_connection(net, "VD", "VB", exc_syn, "weight_MN_MN_Inh")
+ add_connection(net, "AVB", "VB", exc_syn, "weight_IN_MN")
+ add_connection(net, "VB", "VD", exc_syn, "weight_MN_MN_Exc")
+ # add_connection(net, "VB", "DD", exc_syn, "weight_MN_MN_Exc")
+
+ add_connection(net, "VD", "VB", inh_syn, "weight_MN_MN_Inh")
if paramset == "X":
- input_source = InputSource(
- id="iclamp_0",
- neuroml2_input="PulseGenerator",
- parameters={
- "amplitude": "stim_amp",
- "delay": "500ms",
- "duration": "stim_duration",
- },
- )
+ input_source = InputSource(
+ id="iclamp_0",
+ neuroml2_input="PulseGenerator",
+ parameters={
+ "amplitude": "stim_amp",
+ "delay": "500ms",
+ "duration": "stim_duration",
+ },
+ )
else:
input_source = InputSource(
@@ -202,13 +212,15 @@ def generate(duration=1000, paramset="C"):
},
)
- if paramset=="X":
-
- sim.record_traces={}
- sim.record_variables={"state": {"all": "*"}, "output": {"all": "*"}} # "V": {"all": "*"},
- sim.plots2D={
+ if paramset == "X":
+ sim.record_traces = {}
+ sim.record_variables = {
+ "state": {"all": "*"},
+ "output": {"all": "*"},
+ } # "V": {"all": "*"},
+ sim.plots2D = {
"DB-VB": {
- "x_axis": "DB/0/%s/output" % neuron_id,
+ "x_axis": "VD/0/%s/output" % neuron_id,
"y_axis": "VB/0/%s/output" % neuron_id,
}
}
diff --git a/examples/parametersweep/Canonical_X.json b/examples/parametersweep/Canonical_X.json
index 9c1d05f3..5581c6ee 100644
--- a/examples/parametersweep/Canonical_X.json
+++ b/examples/parametersweep/Canonical_X.json
@@ -2,15 +2,23 @@
"Canonical_X": {
"version": "NeuroMLlite v0.6.1",
"parameters": {
- "stim_duration": "250ms",
- "stim_amp": "1pA",
+ "bias": 0,
+ "gain": 1,
+ "tau": "100ms",
+ "stim_duration": "2000ms",
+ "stim_amp": "0.2pA",
"weight_IN_MN": 1,
"weight_MN_MN_Exc": 1,
- "weight_MN_MN_Inh": -1,
+ "weight_MN_MN_Inh": -5,
"scaleDinout": 0.5
},
"cells": {
"GenericNeuronCellX": {
+ "parameters": {
+ "bias": "bias",
+ "gain": "gain",
+ "tau": "tau"
+ },
"lems_source_file": "cell_X.xml"
}
},
@@ -119,9 +127,9 @@
}
},
"projections": {
- "proj_AVB_VD": {
+ "proj_AVB_VB": {
"presynaptic": "AVB",
- "postsynaptic": "VD",
+ "postsynaptic": "VB",
"synapse": "neuron_to_neuron_exc_syn_x",
"type": "continuousProjection",
"delay": 0,
@@ -130,10 +138,21 @@
"probability": 1
}
},
+ "proj_VB_VD": {
+ "presynaptic": "VB",
+ "postsynaptic": "VD",
+ "synapse": "neuron_to_neuron_exc_syn_x",
+ "type": "continuousProjection",
+ "delay": 0,
+ "weight": "weight_MN_MN_Exc",
+ "random_connectivity": {
+ "probability": 1
+ }
+ },
"proj_VD_VB": {
"presynaptic": "VD",
"postsynaptic": "VB",
- "synapse": "neuron_to_neuron_exc_syn_x",
+ "synapse": "neuron_to_neuron_inh_syn_x",
"type": "continuousProjection",
"delay": 0,
"weight": "weight_MN_MN_Inh",
diff --git a/examples/parametersweep/Canonical_X.net.nml b/examples/parametersweep/Canonical_X.net.nml
index 79faa0bd..24583893 100644
--- a/examples/parametersweep/Canonical_X.net.nml
+++ b/examples/parametersweep/Canonical_X.net.nml
@@ -3,17 +3,21 @@
Generated network: Canonical_X
Generation seed: 1234
NeuroMLlite parameters:
+ bias = 0
+ gain = 1
scaleDinout = 0.5
- stim_amp = 1pA
- stim_duration = 250ms
+ stim_amp = 0.2pA
+ stim_duration = 2000ms
+ tau = 100ms
weight_IN_MN = 1
weight_MN_MN_Exc = 1
- weight_MN_MN_Inh = -1
+ weight_MN_MN_Inh = -5
-
+
+
-
+
@@ -52,11 +56,14 @@
-
-
+
+
+
+
+
-
+
diff --git a/examples/parametersweep/GenerateExamples.py b/examples/parametersweep/GenerateExamples.py
index c0116ff3..85886092 100644
--- a/examples/parametersweep/GenerateExamples.py
+++ b/examples/parametersweep/GenerateExamples.py
@@ -17,9 +17,9 @@ def generate(cell, duration=3000, config="IClamp", parameters=None):
reference = "%s_%s" % (config, cell)
cell_id = "%s" % cell
-
- if cell_id=='GenericNeuronCellX':
- cell_nmll = Cell(id=cell_id, lems_source_file='cell_X.xml')
+
+ if cell_id == "GenericNeuronCellX":
+ cell_nmll = Cell(id=cell_id, lems_source_file="cell_X.xml")
else:
cell_nmll = Cell(id=cell_id, neuroml2_source_file="%s.cell.nml" % (cell))
@@ -30,15 +30,21 @@ def generate(cell, duration=3000, config="IClamp", parameters=None):
if not parameters:
parameters = {}
parameters["stim_amp"] = "350pA"
+
+ parameters["stim_delay"] = "2000ms"
+ parameters["stim_duration"] = "6000ms"
+
+ if cell_id is not "GenericNeuronCellX":
- if cell_id is not 'GenericNeuronCellX':
+ parameters["stim_delay"] = "500ms"
+ parameters["stim_duration"] = "2000ms"
input_source = InputSource(
id="iclamp_0",
neuroml2_input="PulseGenerator",
parameters={
"amplitude": "stim_amp",
- "delay": "500ms",
- "duration": "2000ms",
+ "delay": "stim_delay",
+ "duration": "stim_duration",
},
)
else:
@@ -47,8 +53,8 @@ def generate(cell, duration=3000, config="IClamp", parameters=None):
neuroml2_input="PulseGenerator",
parameters={
"amplitude": "stim_amp",
- "delay": "2000ms",
- "duration": "6000ms",
+ "delay": "stim_delay",
+ "duration": "stim_duration",
},
)
@@ -80,25 +86,28 @@ def generate(cell, duration=3000, config="IClamp", parameters=None):
input_for_default_population=input_source,
)
- if cell_id=='GenericNeuronCellX':
- sim.record_traces={}
- sim.record_variables={"v": {"all": "*"}, "state": {"all": "*"}, "output": {"all": "*"}}
+ if cell_id == "GenericNeuronCellX":
+ sim.record_traces={"all": "*"}
+ sim.record_variables = {
+ "state": {"all": "*"},
+ "output": {"all": "*"},
+ }
- #qprint(dir(sim))
+ # qprint(dir(sim))
sim.to_json_file()
return sim, net
if __name__ == "__main__":
-
if "-all" in sys.argv:
for cell in colors:
generate(cell, 3000, config="IClamp", parameters={"stim_amp": "4pA"})
elif "-x" in sys.argv:
-
- sim, net = generate("GenericNeuronCellX", 10000, config="IClamp", parameters={"stim_amp": "1pA"})
+ sim, net = generate(
+ "GenericNeuronCellX", 10000, config="IClamp", parameters={"stim_amp": "1pA"}
+ )
check_to_generate_or_run(sys.argv, sim)
else:
diff --git a/examples/parametersweep/IClamp_GenericMuscleCell.json b/examples/parametersweep/IClamp_GenericMuscleCell.json
index 2af36940..e49f5fcb 100644
--- a/examples/parametersweep/IClamp_GenericMuscleCell.json
+++ b/examples/parametersweep/IClamp_GenericMuscleCell.json
@@ -3,7 +3,9 @@
"version": "NeuroMLlite v0.6.1",
"notes": "A network model: IClamp_GenericMuscleCell",
"parameters": {
- "stim_amp": "4pA"
+ "stim_amp": "4pA",
+ "stim_delay": "500ms",
+ "stim_duration": "2000ms"
},
"cells": {
"GenericMuscleCell": {
@@ -14,8 +16,8 @@
"iclamp_0": {
"parameters": {
"amplitude": "stim_amp",
- "delay": "500ms",
- "duration": "2000ms"
+ "delay": "stim_delay",
+ "duration": "stim_duration"
},
"neuroml2_input": "PulseGenerator"
}
diff --git a/examples/parametersweep/IClamp_GenericMuscleCell.net.nml b/examples/parametersweep/IClamp_GenericMuscleCell.net.nml
index 83935fad..902f8ed8 100644
--- a/examples/parametersweep/IClamp_GenericMuscleCell.net.nml
+++ b/examples/parametersweep/IClamp_GenericMuscleCell.net.nml
@@ -3,7 +3,9 @@
Generated network: IClamp_GenericMuscleCell
Generation seed: 1234
NeuroMLlite parameters:
- stim_amp = 4pA
+ stim_amp = 4pA
+ stim_delay = 500ms
+ stim_duration = 2000ms
diff --git a/examples/parametersweep/IClamp_GenericNeuronCell.json b/examples/parametersweep/IClamp_GenericNeuronCell.json
index 879a3eb4..ff7ce419 100644
--- a/examples/parametersweep/IClamp_GenericNeuronCell.json
+++ b/examples/parametersweep/IClamp_GenericNeuronCell.json
@@ -3,7 +3,9 @@
"version": "NeuroMLlite v0.6.1",
"notes": "A network model: IClamp_GenericNeuronCell",
"parameters": {
- "stim_amp": "4pA"
+ "stim_amp": "4pA",
+ "stim_delay": "500ms",
+ "stim_duration": "2000ms"
},
"cells": {
"GenericNeuronCell": {
@@ -14,8 +16,8 @@
"iclamp_0": {
"parameters": {
"amplitude": "stim_amp",
- "delay": "500ms",
- "duration": "2000ms"
+ "delay": "stim_delay",
+ "duration": "stim_duration"
},
"neuroml2_input": "PulseGenerator"
}
diff --git a/examples/parametersweep/IClamp_GenericNeuronCell.net.nml b/examples/parametersweep/IClamp_GenericNeuronCell.net.nml
index 7c985ecf..d6428edf 100644
--- a/examples/parametersweep/IClamp_GenericNeuronCell.net.nml
+++ b/examples/parametersweep/IClamp_GenericNeuronCell.net.nml
@@ -3,7 +3,9 @@
Generated network: IClamp_GenericNeuronCell
Generation seed: 1234
NeuroMLlite parameters:
- stim_amp = 4pA
+ stim_amp = 4pA
+ stim_delay = 500ms
+ stim_duration = 2000ms
diff --git a/examples/parametersweep/SimCanonical_X.json b/examples/parametersweep/SimCanonical_X.json
index f6c49233..2c33b1e7 100644
--- a/examples/parametersweep/SimCanonical_X.json
+++ b/examples/parametersweep/SimCanonical_X.json
@@ -15,7 +15,7 @@
},
"plots2D": {
"DB-VB": {
- "x_axis": "DB/0/GenericNeuronCellX/output",
+ "x_axis": "VD/0/GenericNeuronCellX/output",
"y_axis": "VB/0/GenericNeuronCellX/output"
}
}
diff --git a/examples/parametersweep/Sweep.py b/examples/parametersweep/Sweep.py
index 0571168a..eb9c0316 100644
--- a/examples/parametersweep/Sweep.py
+++ b/examples/parametersweep/Sweep.py
@@ -248,6 +248,56 @@
print("Showing plots")
plt.show()
+ elif "-x" in sys.argv:
+
+ fixed = {"dt": 0.025, "duration": 3000, "stim_delay": "500ms", "stim_duration": "2000ms"}
+
+ quick = False
+ # quick=True
+
+ vary = {"stim_amp": ["%spA" % (i / 1) for i in range(-3, 6, 1)]}
+
+ type = "GenericMuscleCell"
+ type = "GenericNeuronCell"
+ type = "GenericNeuronCellX"
+ # type='poolosyn'
+ config = "IClamp"
+ # config = 'PoissonFiringSynapse'
+
+ nmllr = NeuroMLliteRunner(
+ "Sim_%s_%s.json" % (config, type), simulator="jNeuroML"
+ )
+
+ if quick:
+ pass
+
+ ps = ParameterSweep(
+ nmllr,
+ vary,
+ fixed,
+ num_parallel_runs=1,
+ plot_all=True,
+ save_plot_all_to="firing_rates_%s.png" % type,
+ heatmap_all=True,
+ save_heatmap_to="heatmap_%s.png" % type,
+ heatmap_lims=heatmap_lims,
+ show_plot_already=False,
+ )
+
+ report = ps.run()
+ ps.print_report()
+
+ ps.plotLines('stim_amp','average_last_1percent',save_figure_to='average_last_1percent_%s.png'%type)
+
+ # ps.plotLines('dt','mean_spike_frequency',save_figure_to='mean_spike_frequency_%s.png'%type, logx=True)
+ # ps.plotLines('number_per_cell','mean_spike_frequency',save_figure_to='poisson_mean_spike_frequency_%s.png'%type)
+
+ import matplotlib.pyplot as plt
+
+ if "-nogui" not in sys.argv:
+ print("Showing plots")
+ plt.show()
+
else:
fixed = {"dt": 0.025, "duration": 3000}
@@ -278,6 +328,7 @@
type = "GenericMuscleCell"
type = "GenericNeuronCell"
+ type = "GenericNeuronCellX"
# type='poolosyn'
config = "IClamp"
# config = 'PoissonFiringSynapse'
diff --git a/examples/parametersweep/cell_X.xml b/examples/parametersweep/cell_X.xml
index 5d1001cb..678b17f0 100644
--- a/examples/parametersweep/cell_X.xml
+++ b/examples/parametersweep/cell_X.xml
@@ -13,7 +13,6 @@
-
diff --git a/examples/parametersweep/clean.sh b/examples/parametersweep/clean.sh
index b60a0830..691e6dde 100755
--- a/examples/parametersweep/clean.sh
+++ b/examples/parametersweep/clean.sh
@@ -1 +1,2 @@
-mv *dat *mod *nrn.py *hoc *gv* *pyc rep*txt LEMS* /tmp
+rm -rf arm64 x86_64 __pycache__
+mv *dat *mod *nrn.py *hoc *gv* *pyc rep*txt LEMS* ParamSweep* /tmp
diff --git a/examples/parametersweep/firing_rates_GenericMuscleCell.png b/examples/parametersweep/firing_rates_GenericMuscleCell.png
index b815c3d9..2c73c552 100644
Binary files a/examples/parametersweep/firing_rates_GenericMuscleCell.png and b/examples/parametersweep/firing_rates_GenericMuscleCell.png differ
diff --git a/examples/parametersweep/firing_rates_GenericNeuronCell.png b/examples/parametersweep/firing_rates_GenericNeuronCell.png
index 28c9c2ee..ede78a32 100644
Binary files a/examples/parametersweep/firing_rates_GenericNeuronCell.png and b/examples/parametersweep/firing_rates_GenericNeuronCell.png differ
diff --git a/examples/parametersweep/firing_rates_GenericNeuronCellX.png b/examples/parametersweep/firing_rates_GenericNeuronCellX.png
index fe16f78a..d4b97e5d 100644
Binary files a/examples/parametersweep/firing_rates_GenericNeuronCellX.png and b/examples/parametersweep/firing_rates_GenericNeuronCellX.png differ
diff --git a/examples/parametersweep/heatmap_GenericMuscleCell.png b/examples/parametersweep/heatmap_GenericMuscleCell.png
index 94368ec6..803eec9a 100644
Binary files a/examples/parametersweep/heatmap_GenericMuscleCell.png and b/examples/parametersweep/heatmap_GenericMuscleCell.png differ
diff --git a/examples/parametersweep/heatmap_GenericNeuronCell.png b/examples/parametersweep/heatmap_GenericNeuronCell.png
index 492c3486..1ff72944 100644
Binary files a/examples/parametersweep/heatmap_GenericNeuronCell.png and b/examples/parametersweep/heatmap_GenericNeuronCell.png differ
diff --git a/examples/parametersweep/heatmap_GenericNeuronCellX.png b/examples/parametersweep/heatmap_GenericNeuronCellX.png
index 9bda1b58..759d2af3 100644
Binary files a/examples/parametersweep/heatmap_GenericNeuronCellX.png and b/examples/parametersweep/heatmap_GenericNeuronCellX.png differ
diff --git a/examples/parametersweep/mean_spike_frequency_GenericMuscleCell.png b/examples/parametersweep/mean_spike_frequency_GenericMuscleCell.png
index 9e6235f8..b55379af 100644
Binary files a/examples/parametersweep/mean_spike_frequency_GenericMuscleCell.png and b/examples/parametersweep/mean_spike_frequency_GenericMuscleCell.png differ
diff --git a/examples/parametersweep/mean_spike_frequency_GenericNeuronCell.png b/examples/parametersweep/mean_spike_frequency_GenericNeuronCell.png
index 6f424e92..ecf67b38 100644
Binary files a/examples/parametersweep/mean_spike_frequency_GenericNeuronCell.png and b/examples/parametersweep/mean_spike_frequency_GenericNeuronCell.png differ
diff --git a/examples/parametersweep/mean_spike_frequency_GenericNeuronCellX.png b/examples/parametersweep/mean_spike_frequency_GenericNeuronCellX.png
index d19c9cfd..a4744882 100644
Binary files a/examples/parametersweep/mean_spike_frequency_GenericNeuronCellX.png and b/examples/parametersweep/mean_spike_frequency_GenericNeuronCellX.png differ