Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds switched RLC circuit example; regenerated nml; adds workflow for test_all.sh #538

Merged
merged 23 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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
75 changes: 75 additions & 0 deletions examples/MDF/SwitchedRLC_Circuit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"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": {
"V": {
"parameters": {
"Vs": {
"conditions": [
{
"id": "off",
"test": "time<0.5",
"value": "0"
},
{
"id": "on",
"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
},
"time": {
"default_initial_value": 0,
"time_derivative": "1"
},
"V": {
"default_initial_value": 0,
"time_derivative": "i_C /C"
},
"i_R": {
"value": "V / R"
},
"i_L": {
"default_initial_value": 0,
"time_derivative": "(Vs - V)/L"
},
"i_C": {
"value": "i_L-i_R"
}
},
"output_ports": {
"V_out": {
"value": "V"
},
"i_L_out": {
"value": "i_L"
}
}
}
}
}
}
}
}
47 changes: 47 additions & 0 deletions examples/MDF/SwitchedRLC_Circuit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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:
V:
parameters:
Vs:
conditions:
- id: 'off'
test: time<0.5
value: '0'
- id: 'on'
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
time:
default_initial_value: 0
time_derivative: '1'
V:
default_initial_value: 0
time_derivative: i_C /C
i_R:
value: V / R
i_L:
default_initial_value: 0
time_derivative: (Vs - V)/L
i_C:
value: i_L-i_R
output_ports:
V_out:
value: V
i_L_out:
value: i_L
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 added examples/MDF/images/switched_rlc_circuit.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 added 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
Loading