Skip to content

Commit

Permalink
Merge pull request #311 from ModECI/development
Browse files Browse the repository at this point in the history
Release v0.4.2
  • Loading branch information
pgleeson authored Aug 19, 2022
2 parents 853cbf2 + 1ad3139 commit a4e0e6e
Show file tree
Hide file tree
Showing 165 changed files with 5,845 additions and 824 deletions.
60 changes: 40 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.9]
python-version: [ "3.7", "3.9", "3.10"]
runs-on: [ubuntu-latest, macos-latest, windows-latest]
exclude:
# excludes Python 3.9 windows for now on account of PsyNeuLink
- python-version: 3.9
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -39,31 +35,55 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install modelspec
run: python -m pip install git+https://github.com/ModECI/modelspec.git@main
# Rely on version of modelspec from PyPI as set by setup.cfg...
#- name: Install modelspec
# run: python -m pip install git+https://github.com/ModECI/modelspec.git@main

- name: Install NeuroMLlite
run: python -m pip install NeuroMLlite>=0.5.0
# Rely on version of NeuroMLlite from PyPI as set by setup.py...
# - name: Install NeuroMLlite
# run: python -m pip install NeuroMLlite>=0.5.0

- name: Install GPy (py3.9)
if: ${{ matrix.python-version == '3.9' }}
run: python -m pip install git+https://github.com/SheffieldML/GPy.git@devel
# Rely on version of PsyNeuLink from PyPI as set by setup.py...
#- name: Install specific PsyNeuLink branch
# run: python -m pip install git+https://github.com/ModECI/PsyNeuLink@devel

- name: Install package
run: python -m pip install .[test]
- name: Install core package
run: python -m pip install .[dev]

- name: Version info for installed packages
run: |
pip list
- name: Test package
- name: Test core package
run: |
python -m pytest -ra tests/*.py
python -m pytest -ra tests/interfaces/onnx/*.py
python -m pytest -ra tests/interfaces/pytorch/test_export.py
python -m pytest -ra tests/interfaces/pytorch/test_import.py # inception taking v long
python -m pytest -m coremdf tests/
- name: Final version info for installed packages
- name: Install optional dependencies
run: python -m pip install .[all]

- name: Version info for optional installed packages
run: |
pip list
- name: Test interface ACT-R
run: |
python -m pytest -v -m "actr" tests/
- name: Test interface PyTorch
if: ${{ matrix.python-version != '3.10' || matrix.runs-on != 'windows-latest' }}
run: |
python -m pytest -v -m "pytorch" tests/
- name: Test interface NeuroML
run: |
python -m pytest -v -m "neuroml" tests/
- name: Test interface PsyNeuLink
if: ${{ matrix.python-version != '3.10' }}
run: |
python -m pytest -v -m "psyneulink" tests/
- name: Final version info for optional installed packages
run: |
pip list
Expand Down
18 changes: 14 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# No BSON in the repo
*.bson

/examples/MDF/conditions/everyncalls
/examples/MDF/conditions/threshold
/examples/MDF/conditions/timeinterval
/abc_conditions
examples/ONNX/data
examples/ONNX/*.onnx
Expand Down Expand Up @@ -250,19 +252,27 @@ Thumbs.db #thumbnail cache on Windows
/examples/NeuroML/Izh.png
/examples/NeuroML/Izh_multi
/examples/NeuroML/Izh_multi.png
/examples/NeuroML/Izh_run.png
/examples/NeuroML/IzhikevichTest.mdf.json
/examples/NeuroML/IzhikevichTest.net.nml
/examples/NeuroML/IzhikevichTest.nmllite.yaml
/examples/NeuroML/LEMS_SimIzhikevichTest.xml
/examples/NeuroML/SimIzhikevichTest.json
/examples/NeuroML/SimIzhikevichTest.yaml
/examples/AB
/examples/AB.png
/examples/states
/examples/states.png
/examples/conditions
/examples/conditions.png
*.onnx
/examples/AB.json
/examples/AB.yaml
/examples/MDF/params_funcs_example
/examples/MDF/params_funcs_example_3
/examples/MDF/params_funcs_example_3.png
/examples/MDF/params_funcs_example.png
/examples/NeuroML/LEMS_SimFN_nrn.py
/examples/MDF/RNN/*.gv.png
/examples/MDF/RNN/*.dat
/examples/MDF/RNN/LEMS_Simiaf_example.xml
/examples/MDF/RNN/iaf_example.net.nml
/examples/MDF/RNN/iaf_example__lems.xml
/examples/MDF/RNN/iaf_example_lems_definitions.xml
23 changes: 23 additions & 0 deletions docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@

print("Written main documentation")

# Generate export formats documentation
export_formats_list = [
"MDF",
"ACT-R",
"NeuroML",
"ONNX",
"PsyNeuLink",
"PyTorch",
"Quantum",
"WebGME",
]
for format in export_formats_list:
with open("../examples/" + format + "/README.md") as readfile, open(
"sphinx/source/api/export_format/" + format + "/" + format + ".md", "w"
) as writefile:
# read content from first file
for line in readfile:
# append content to second file
writefile.write(line)


print("Written Export format documentation")

# Generate standard function generate_documentation

from modeci_mdf.functions.standard import mdf_functions, create_python_expression
Expand Down
10 changes: 10 additions & 0 deletions docs/sphinx/source/api/Export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Supported export Models
This is the list of currently supported models which MDF supports

- ACT-R [README](https://github.com/ModECI/MDF/tree/main/examples/ACT-R#readme)
- NeuroML [README](https://github.com/ModECI/MDF/tree/main/examples/NeuroML#readme)
- ONNX [README](https://github.com/ModECI/MDF/tree/main/examples/ONNX#readme)
- PsyNeuLink [README](https://github.com/ModECI/MDF/tree/main/examples/PsyNeuLink#readme)
- PyTorch [README](https://github.com/ModECI/MDF/tree/main/examples/PyTorch#readme)
- Quantum [README](https://github.com/ModECI/MDF/tree/main/examples/Quantum#readme)
- WebGME [README](https://github.com/ModECI/MDF/tree/main/examples/WebGME#readme)
61 changes: 61 additions & 0 deletions docs/sphinx/source/api/export_format/ACT-R/ACT-R.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Interactions between MDF and ACT-R

This directory contains examples of ACT-R models converted to MDF. The ACT-R
models [count.lisp](./count.lisp) and [addition.lisp](addition.lisp) are based on
the [ACT-R tutorial](http://act-r.psy.cmu.edu/software/).

The scripts [count.py](count.py) and [addition.py](addition.py) can be run
to create the MDF .json and .yaml files for the given example and execute it
using the MDF scheduler.

The below graph represents the basic structure of all ACT-R models in MDF:
![actr.png](actr.png)

There are also more detailed graphs [count.png](count.png) and
[addition.png](addition.png) for each example.

### Count Model

[ACT-R](count.lisp) | [JSON](count.json) | [YAML](count.yaml) | [Python Script](count.py) | [Graph](count.png)

![count.png](count.png)

The count model counts from a start value to an end value. The script
[count.py](count.py) first reads the original ACT-R model file
[count.lisp](count.lisp), generates an MDF representation using the MDF ACT-R interface, and outputs the [JSON](count.json) and [YAML](count.yaml) files. It then executes
the MDF model using the MDF scheduler and outputs the final goal set by the
model once execution is finished. The final goal has the form:

`{'name': 'first-goal', 'ISA': 'count-from', 'start': 'two', 'end': 'four', 'count': 'four'}`

In this example, the start value is two, the end value is four, and the final
value of count is four, indicating that the model counted from two to four. The
start and end values can be modified in line 17 of [count.lisp](count.lisp),
which sets the initial goal of the model:

`(first-goal ISA count-from start two end four)`

The script can use any values specified in [count.lisp](count.lisp), so the
model can be modified and run multiple times in order to test different values.
The [count](count.png) graph represents this example.

### Addition Model

[ACT-R](addition.lisp) | [JSON](addition.json) | [YAML](addition.yaml) | [Python Script](addition.py) | [Graph](addition.png)

![addition.png](addition.png)

The addition model computes the sum of two numbers. The script
[addition.py](addition.py) functions identically to the previous example, but
uses the addition model instead. The final goal has the form:

`{'name': 'second-goal', 'ISA': 'add', 'arg1': 'five', 'arg2': 'two', 'sum': 'seven', 'count': 'nil'}`

In this case, the first argument is five, the second argument is two, and the
model has calculated the sum, seven. Like the previous example, the arguments
can be modified in line 23 of [addition.lisp](addition.lisp) in order to test
different values:

`(second-goal ISA add arg1 five arg2 two)`

The [addition](addition.png) graph represents this example.
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 a4e0e6e

Please sign in to comment.