Skip to content

Commit

Permalink
Merge pull request #1 from ModECI/nml_examples
Browse files Browse the repository at this point in the history
Updates to get tests passing
  • Loading branch information
rimjhimittal authored Nov 3, 2024
2 parents d8a6cf4 + 205ffe3 commit c757b05
Show file tree
Hide file tree
Showing 55 changed files with 211 additions and 78 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci_test_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI Test script

on:
push:
branches: [ main, development, experimental, test*, nml* ]
pull_request:
branches: [ main, development, experimental, test*, nml* ]

jobs:

checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
python-version: [ "3.10"]
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install HDF5 for pytables on macos-14/latest
if: ${{ matrix.runs-on == 'macos-latest' }}
run: |
brew install hdf5
- name: Install graphviz
uses: ts-graphviz/setup-graphviz@v2
with:
# Skip to run brew update command on macOS.
macos-skip-brew-update: 'true' # default false

- name: Run test script
run: |
export NEURON_HOME=$pythonLocation
./test_all.sh
- name: Version info for installed packages
run: |
pip list
- name: Final version info for optional installed packages
run: |
pip list
Binary file modified docs/sphinx/source/api/export_format/MDF/images/abc_conditions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/sphinx/source/api/export_format/NeuroML/ABCD.mdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/sphinx/source/api/export_format/NeuroML/LEMS_SimABCD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/sphinx/source/api/export_format/NeuroML/LEMS_SimFN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/sphinx/source/api/export_format/PyTorch/inception.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/MDF/ABCD.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion examples/MDF/Arrays.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion examples/MDF/NewtonCoolingModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion examples/MDF/ParametersFunctions.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
}
}
}
}
}
37 changes: 31 additions & 6 deletions examples/MDF/RNN/IAFs.nmllite.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"iaf_example": {
"version": "NeuroMLlite v0.5.3",
"version": "NeuroMLlite v0.6.0",
"notes": "NeuroMLlite export of MDF graph: iaf_example",
"cells": {
"input_node__instance": {
"current_input_node__instance": {
"lems_source_file": "iaf_example_lems_definitions.xml"
},
"pre__instance": {
"lems_source_file": "iaf_example_lems_definitions.xml"
},
"post__instance": {
"lems_source_file": "iaf_example_lems_definitions.xml"
},
"syn_post__instance": {
"lems_source_file": "iaf_example_lems_definitions.xml"
}
},
"synapses": {
Expand All @@ -20,14 +23,17 @@
"silentSyn_proj_input_edge": {
"lems_source_file": "iaf_example_lems_definitions.xml"
},
"silentSyn_proj_post_internal_edge": {
"lems_source_file": "iaf_example_lems_definitions.xml"
},
"silentSyn_proj_syn_edge": {
"lems_source_file": "iaf_example_lems_definitions.xml"
}
},
"populations": {
"input_node": {
"current_input_node": {
"size": 1,
"component": "input_node__instance",
"component": "current_input_node__instance",
"properties": {
"color": "0.2 0.2 0.2",
"radius": 3
Expand All @@ -48,11 +54,19 @@
"color": "0.2 0.2 0.2",
"radius": 3
}
},
"syn_post": {
"size": 1,
"component": "syn_post__instance",
"properties": {
"color": "0.2 0.2 0.2",
"radius": 3
}
}
},
"projections": {
"proj_input_edge": {
"presynaptic": "input_node",
"presynaptic": "current_input_node",
"postsynaptic": "pre",
"synapse": "rsDL",
"pre_synapse": "silentSyn_proj_input_edge",
Expand All @@ -62,9 +76,20 @@
"probability": 1
}
},
"proj_post_internal_edge": {
"presynaptic": "syn_post",
"postsynaptic": "post",
"synapse": "rsDL",
"pre_synapse": "silentSyn_proj_post_internal_edge",
"type": "continuousProjection",
"weight": 1,
"random_connectivity": {
"probability": 1
}
},
"proj_syn_edge": {
"presynaptic": "pre",
"postsynaptic": "post",
"postsynaptic": "syn_post",
"synapse": "rsDL",
"pre_synapse": "silentSyn_proj_syn_edge",
"type": "continuousProjection",
Expand Down
27 changes: 13 additions & 14 deletions examples/MDF/RNN/Simiaf_example.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
{
"Simiaf_example": {
"version": "NeuroMLlite v0.5.3",
"version": "NeuroMLlite v0.6.0",
"network": "IAFs.nmllite.json",
"duration": 100000.0,
"dt": 10.0,
"seed": 123,
"record_variables": {
"time": {
"input_node": 0
"current_input_node": 0
},
"out_port": {
"input_node": 0
"current_output": {
"current_input_node": 0,
"syn_post": 0
},
"current_input": {
"pre": 0,
"post": 0
},
"spike_input": {
"pre": 0,
"post": 0
},
"syn_i": {
"pre": 0,
"post": 0
},
"spiking": {
"pre": 0,
"post": 0
Expand All @@ -32,13 +25,19 @@
"pre": 0,
"post": 0
},
"out_port_v": {
"v_output": {
"pre": 0,
"post": 0
},
"out_port_spiking": {
"spiking_output": {
"pre": 0,
"post": 0
},
"spike_input": {
"syn_post": 0
},
"syn_i": {
"syn_post": 0
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/regenerate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ python generate_iaf.py -run -net -nogui
python generate_iaf.py -run -net2 -nogui
#Fix dimensions!
#python generate_iaf.py -neuroml
pynml LEMS_Simiaf_example.xml -lems-graph
#pynml LEMS_Simiaf_example.xml -lems-graph
2 changes: 1 addition & 1 deletion examples/MDF/Simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion examples/MDF/States.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
}
}
}
}
}
12 changes: 11 additions & 1 deletion examples/MDF/SwitchedRLC_Circuit.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"SwitchedRLC_Circuit": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.11",
"metadata": {
"preferred_duration": 2,
"preferred_dt": 0.001
},
"graphs": {
"SwitchedRLC_Circuit": {
"nodes": {
Expand All @@ -22,9 +26,15 @@
]
},
"R": {
"metadata": {
"description": "Resistance in Ohms"
},
"value": 100
},
"L": {
"metadata": {
"description": "Inductance in Henrys"
},
"value": 1
},
"C": {
Expand Down Expand Up @@ -62,4 +72,4 @@
}
}
}
}
}
7 changes: 7 additions & 0 deletions examples/MDF/SwitchedRLC_Circuit.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
SwitchedRLC_Circuit:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.11
metadata:
preferred_duration: 2
preferred_dt: 0.001
graphs:
SwitchedRLC_Circuit:
nodes:
Expand All @@ -15,8 +18,12 @@ SwitchedRLC_Circuit:
test: time>=0.5
value: 0.1
R:
metadata:
description: Resistance in Ohms
value: 100
L:
metadata:
description: Inductance in Henrys
value: 1
C:
value: 0.001
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/abc_conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@
}
}
}
}
}
Binary file modified examples/MDF/conditions/images/composite_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/MDF/images/abc_conditions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/MDF/images/switched_rlc_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions examples/MDF/newton.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ def main():
s.append(eg.enodes["cool_node"].evaluable_outputs["out_port"].curr_value)
t += dt

# Plotting the results
plt.plot(times, s)
plt.xlabel("Time")
plt.ylabel("Temperature")
plt.title("Newton's Cooling Law Simulation")
plt.savefig("newton_plot.png")
if "-nogui" not in sys.argv:
# Plotting the results
plt.plot(times, s)
plt.xlabel("Time")
plt.ylabel("Temperature")
plt.title("Newton's Cooling Law Simulation")
plt.savefig("newton_plot.png")
plt.show()

if "-graph" in sys.argv:
Expand Down
5 changes: 5 additions & 0 deletions examples/MDF/switched_rlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def run_simulation(mod_graph, duration=2, dt=0.001):
V_values.append(V)
t += dt

print(
"Finished simulation of MDF model: %s of duration: %s sec"
% (mod_graph.id, duration)
)

plt.figure(figsize=(10, 5))
plt.plot(times, i_L_values, label="Inductor Current (i_L)")
plt.plot(times, i_R_values, label="Resistor Current (i_R)")
Expand Down
2 changes: 1 addition & 1 deletion examples/NeuroML/ABCD.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ABCD": {
"version": "NeuroMLlite v0.5.9",
"version": "NeuroMLlite v0.6.0",
"notes": "Example of a simplified network",
"parameters": {
"A_initial": 0.1,
Expand Down
Binary file modified examples/NeuroML/ABCD.mdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/NeuroML/ABCD.net.nml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="ABCD">
<notes>Generated by NeuroMLlite v0.5.9
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.1.xsd" id="ABCD">
<notes>Generated by NeuroMLlite v0.6.0
Generated network: ABCD
Generation seed: 1234
NeuroMLlite parameters:
Expand Down
2 changes: 1 addition & 1 deletion examples/NeuroML/FN.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FN": {
"version": "NeuroMLlite v0.5.9",
"version": "NeuroMLlite v0.6.0",
"notes": "FitzHugh Nagumo cell model - originally specified in NeuroML/LEMS",
"parameters": {
"initial_w": 0.0,
Expand Down
4 changes: 2 additions & 2 deletions examples/NeuroML/FN.net.nml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="FN">
<notes>Generated by NeuroMLlite v0.5.9
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.1.xsd" id="FN">
<notes>Generated by NeuroMLlite v0.6.0
Generated network: FN
Generation seed: 1234
NeuroMLlite parameters:
Expand Down
4 changes: 2 additions & 2 deletions examples/NeuroML/IzhikevichTest.net.nml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="IzhikevichTest">
<notes>Generated by NeuroMLlite v0.5.9
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.1.xsd" id="IzhikevichTest">
<notes>Generated by NeuroMLlite v0.6.0
Generated network: IzhikevichTest
Generation seed: 1234
NeuroMLlite parameters:
Expand Down
2 changes: 1 addition & 1 deletion examples/NeuroML/IzhikevichTest.nmllite.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
IzhikevichTest:
version: NeuroMLlite v0.5.9
version: NeuroMLlite v0.6.0
notes: Example Izhikevich
parameters:
N: 1
Expand Down
Binary file modified examples/NeuroML/LEMS_SimABCD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/NeuroML/LEMS_SimABCD.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!--
This LEMS file has been automatically generated using PyNeuroML v1.2.14 (libNeuroML v0.5.8)
This LEMS file has been automatically generated using PyNeuroML v1.3.8 (libNeuroML v0.6.3)
-->

Expand Down
Binary file modified examples/NeuroML/LEMS_SimFN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c757b05

Please sign in to comment.