Skip to content

Commit 1852fce

Browse files
authored
Merge pull request #568 from ModECI/development
Working cyclical networks example
2 parents 073c5ba + d9fd16a commit 1852fce

File tree

113 files changed

+983
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+983
-132
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
python-version: ['3.10', '3.13']
33+
python-version: ['3.11', '3.13']
3434
os: [ubuntu-latest, macos-latest, windows-latest]
3535
test-suite: [core, actr, pytorch, neuroml, tensorflow, psyneulink]
3636
exclude:
@@ -89,11 +89,11 @@ jobs:
8989
- uses: actions/checkout@v4
9090
- uses: actions/setup-python@v5
9191
with:
92-
python-version: '3.10'
92+
python-version: '3.11'
9393
- name: Install uv and set the python version
9494
uses: astral-sh/setup-uv@v6
9595
with:
96-
python-version: '3.10'
96+
python-version: '3.11'
9797
- name: Generate and Build Docs
9898
run: |
9999
uv sync --group docs

.github/workflows/ci_test_all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737

3838
- name: Run test script
3939
run: |
40+
# pip install torch==2.8.0 # pinned to avoid issues with latest version taking up too much space...
4041
export NEURON_HOME=$pythonLocation
4142
./test_all.sh
4243

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ Thumbs.db #thumbnail cache on Windows
274274
/examples/PyTorch/simple_pytorch_to_mdf.1
275275
/examples/MDF/NLP/TestNLP_3
276276
/examples/MDF/NLP/TestNLP
277+
/examples/MDF/networks/Net_acyclical
278+
/examples/MDF/net/Net_acyclical
279+
/examples/MDF/net/weight.py
277280
/examples/MDF/conditions/composite_example
278281
/examples/NeuroML/arm64
279282
/examples/MDF/RNN/iaf.net
@@ -313,3 +316,4 @@ examples/TensorFlow/Keras/keras_to_MDF
313316
/checkoutpngs.sh
314317
/docs/sphinx/source/api/export_format/MDF/images/newton.png
315318
/docs/sphinx/source/api/export_format/MDF/images/newton_plot.png
319+
/examples/MDF/networks/Net_acyclical

.readthedocs.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
# .readthedocs.yml
2-
# Read the Docs configuration file
3-
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4-
5-
# Required
61
version: 2
72

8-
# Build documentation in the docs/ directory with Sphinx
93
sphinx:
10-
configuration: docs/sphinx/source/conf.py
4+
configuration: docs/sphinx/source/conf.py
5+
6+
build:
7+
os: ubuntu-24.04
8+
tools:
9+
python: "3.13"
10+
jobs:
11+
pre_create_environment:
12+
- asdf plugin add uv
13+
- asdf install uv latest
14+
- asdf global uv latest
15+
create_environment:
16+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
17+
install:
18+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --group docs
1119

12-
# Just generate htmlzip version, as pdf failing due to inclusion of svg files (in badges)
1320
formats:
1421
- htmlzip
1522

16-
python:
17-
install:
18-
- requirements: docs/sphinx/requirements.txt
19-
2023
submodules:
2124
exclude: all

docs/MDF_specification.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,21 @@
106106
"type": "str",
107107
"description": "The unique (for this Node) id of the input port,"
108108
},
109+
"default_value": {
110+
"type": "Union",
111+
"description": "Value to set at this input port if no edge connected to it."
112+
},
109113
"shape": {
110114
"type": "Optional",
111115
"description": "The shape of the input port. This uses the same syntax as numpy ndarray shapes\n(e.g., :code:`numpy.zeros(shape)` would produce an array with the correct shape"
112116
},
113117
"type": {
114118
"type": "Optional",
115119
"description": "The data type of the input received at a port."
120+
},
121+
"reduce": {
122+
"type": "Optional",
123+
"description": "Specifies how to deal with multiple inputs to one port during a single timestep: add: add up all the values; multiply: multiply the values, overwrite: just use the last value supplied (default)"
116124
}
117125
}
118126
},

docs/MDF_specification.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ specification:
9191
id:
9292
type: str
9393
description: The unique (for this Node) id of the input port,
94+
default_value:
95+
type: Union
96+
description: Value to set at this input port if no edge connected
97+
to it.
9498
shape:
9599
type: Optional
96100
description: 'The shape of the input port. This uses the same syntax
@@ -101,6 +105,12 @@ specification:
101105
type:
102106
type: Optional
103107
description: The data type of the input received at a port.
108+
reduce:
109+
type: Optional
110+
description: 'Specifies how to deal with multiple inputs to one port
111+
during a single timestep: add: add up all the values; multiply:
112+
multiply the values, overwrite: just use the last value supplied
113+
(default)'
104114
Function:
105115
definition: A single value which is evaluated as a function of values on :class:`InputPort`(s)
106116
and other Functions

docs/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ The <a href="#inputport">InputPort</a> is an attribute of a Node which allows ex
179179
</tr>
180180

181181

182+
<tr>
183+
<td><b>default_value</b></td>
184+
<td>Union</td>
185+
<td><i>Value to set at this input port if no edge connected to it.</i></td>
186+
</tr>
187+
188+
182189
<tr>
183190
<td><b>shape</b></td>
184191
<td>Optional</td>
@@ -194,6 +201,13 @@ The <a href="#inputport">InputPort</a> is an attribute of a Node which allows ex
194201
</tr>
195202

196203

204+
<tr>
205+
<td><b>reduce</b></td>
206+
<td>Optional</td>
207+
<td><i>Specifies how to deal with multiple inputs to one port during a single timestep: add: add up all the values; multiply: multiply the values, overwrite: just use the last value supplied (default)</i></td>
208+
</tr>
209+
210+
197211
</table>
198212

199213
## Function

docs/sphinx/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/sphinx/source/api/Specification.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,17 @@ The `InputPort <#inputport>`__ is an attribute of a Node which allows external i
8787

8888
**Allowed parameters**
8989

90-
=============== =========== =============================================================================================
91-
Allowed field Data Type Description
92-
=============== =========== =============================================================================================
93-
**metadata** Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
94-
**id** str The unique (for this Node) id of the input port,
95-
**shape** Optional The shape of the input port. This uses the same syntax as numpy ndarray shapes
96-
(e.g., **numpy.zeros(shape)** would produce an array with the correct shape
97-
**type** Optional The data type of the input received at a port.
98-
=============== =========== =============================================================================================
90+
================= =========== =================================================================================================================================================================================================
91+
Allowed field Data Type Description
92+
================= =========== =================================================================================================================================================================================================
93+
**metadata** Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
94+
**id** str The unique (for this Node) id of the input port,
95+
**default_value** Union Value to set at this input port if no edge connected to it.
96+
**shape** Optional The shape of the input port. This uses the same syntax as numpy ndarray shapes
97+
(e.g., **numpy.zeros(shape)** would produce an array with the correct shape
98+
**type** Optional The data type of the input received at a port.
99+
**reduce** Optional Specifies how to deal with multiple inputs to one port during a single timestep: add: add up all the values; multiply: multiply the values, overwrite: just use the last value supplied (default)
100+
================= =========== =================================================================================================================================================================================================
99101

100102
========
101103
Function
1 Byte
Loading

0 commit comments

Comments
 (0)