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

Update to v0.4.11, fix tests related to numpy2 & add Newton's law of cooling example #539

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ jobs:
brew install hdf5

- name: Install core package
run: python -m pip install .[dev]
run: |
pip install 'numpy<2.0.0' # due to lingering issues with other modules & numpy v2...
python -m pip install .[dev]

- name: Version info for installed packages
run: |
pip list
pip list

- name: Test core package
run: |
Expand Down Expand Up @@ -102,7 +104,6 @@ jobs:
python -m pytest -v -m "tensorflow" tests/

- name: Test interface PsyNeuLink
if: ${{ matrix.python-version != '3.11'}}
run: |
python -m pip install .[psyneulink]
python -m pytest -v -m "psyneulink" tests/
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,5 @@ examples/TensorFlow/Keras/keras_to_MDF
/examples/TensorFlow/Keras/IRIS/keras_model_on_iris.keras
/examples/TensorFlow/Keras/MNIST/kr_N_model.keras
/checkoutpngs.sh
/docs/sphinx/source/api/export_format/MDF/images/newton.png
/docs/sphinx/source/api/export_format/MDF/images/newton_plot.png
12 changes: 11 additions & 1 deletion docs/sphinx/source/api/export_format/MDF/MDF.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Examples of [Python](https://python.org), [JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON#:~:text=JavaScript%20Object%20Notation%20(JSON)%20is,page%2C%20or%20vice%20versa) and [YAML](https://circleci.com/blog/what-is-yaml-a-beginner-s-guide/) files to illustrate the structure and usage of MDF.

<a href="#simple"> Simple </a>| <a href="#abcd"> ABCD </a> | <a href="#arrays"> Arrays </a> | <a href="#st"> States </a> | <a href="#conditions"> Conditions </a> | <a href="#parameters-and-functions"> Parameters and Functions </a>
<a href="#simple"> Simple </a>| <a href="#abcd"> ABCD </a> | <a href="#arrays"> Arrays </a> | <a href="#st"> States </a> | <a href="#conditions"> Conditions </a> | <a href="#parameters-and-functions"> Parameters and Functions </a>| <a href="#newton"> Newton's Law of Cooling</a>

<p id="simple"></p>

Expand Down Expand Up @@ -73,6 +73,16 @@ A simple 3 [Nodes](https://mdf.readthedocs.io/en/latest/api/Specification.html#n
A simple [Node](https://mdf.readthedocs.io/en/latest/api/Specification.html#node) with a number of different types of [Parameters](https://mdf.readthedocs.io/en/latest/api/Specification.html#parameter) (in blue; fixed and **stateful**) and [Functions](https://mdf.readthedocs.io/en/latest/api/Specification.html#function) (in purple; can be built in or ONNX based).

<img src="https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/images/params_funcs.png" width="250" height="198" />
<p id="newton"></p>

## Newton's Law of Cooling

[Python Source](https://github.com/ModECI/MDF/blob/main/examples/MDF/newton.py) | [JSON](https://github.com/ModECI/MDF/blob/main/examples/MDF/NewtonCoolingModel.json) | [YAML](https://github.com/ModECI/MDF/blob/main/examples/MDF/NewtonCoolingModel.yaml)

A simple [Newtonian cooling process](https://en.wikipedia.org/wiki/Newton%27s_law_of_cooling) model that demonstrates the use of time derivative simulating the cooling of an object to the ambient temperature over time.

<img src="https://raw.githubusercontent.com/ModECI/MDF/development/examples/MDF/images/newton.png" width="250"/>
<img src="https://raw.githubusercontent.com/ModECI/MDF/development/examples/MDF/images/newton_plot.png" width="250"/>


## More examples
Expand Down
2 changes: 1 addition & 1 deletion examples/ACT-R/addition.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"addition": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"addition_graph": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/ACT-R/addition.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addition:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
addition_graph:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/ACT-R/count.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"count": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"count_graph": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/ACT-R/count.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
count:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
count_graph:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/ABCD.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ABCD": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"abcd_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/ABCD.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ABCD:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
abcd_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/Arrays.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Arrays": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"array_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/Arrays.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Arrays:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
array_example:
nodes:
Expand Down
38 changes: 38 additions & 0 deletions examples/MDF/NewtonCoolingModel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"NewtonCoolingModel": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"cooling_process": {
"nodes": {
"cool_node": {
"parameters": {
"cooling_coeff": {
"value": 0.1
},
"T_a": {
"value": 20
},
"T_curr": {
"default_initial_value": 90,
"time_derivative": "dT_dt"
},
"dT_dt": {
"value": "-cooling_coeff*(T_curr - T_a)",
"default_initial_value": 0
}
},
"output_ports": {
"out_port": {
"value": "T_curr"
},
"out_port2": {
"value": "dT_dt"
}
}
}
}
}
}
}
}
23 changes: 23 additions & 0 deletions examples/MDF/NewtonCoolingModel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
NewtonCoolingModel:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.11
graphs:
cooling_process:
nodes:
cool_node:
parameters:
cooling_coeff:
value: 0.1
T_a:
value: 20
T_curr:
default_initial_value: 90
time_derivative: dT_dt
dT_dt:
value: -cooling_coeff*(T_curr - T_a)
default_initial_value: 0
output_ports:
out_port:
value: T_curr
out_port2:
value: dT_dt
2 changes: 1 addition & 1 deletion examples/MDF/ParametersFunctions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ParametersFunctions": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"params_funcs_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/ParametersFunctions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ParametersFunctions:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
params_funcs_example:
nodes:
Expand Down
12 changes: 11 additions & 1 deletion examples/MDF/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Examples of [Python](https://python.org), [JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON#:~:text=JavaScript%20Object%20Notation%20(JSON)%20is,page%2C%20or%20vice%20versa) and [YAML](https://circleci.com/blog/what-is-yaml-a-beginner-s-guide/) files to illustrate the structure and usage of MDF.

<a href="#simple"> Simple </a>| <a href="#abcd"> ABCD </a> | <a href="#arrays"> Arrays </a> | <a href="#st"> States </a> | <a href="#conditions"> Conditions </a> | <a href="#parameters-and-functions"> Parameters and Functions </a>
<a href="#simple"> Simple </a>| <a href="#abcd"> ABCD </a> | <a href="#arrays"> Arrays </a> | <a href="#st"> States </a> | <a href="#conditions"> Conditions </a> | <a href="#parameters-and-functions"> Parameters and Functions </a>| <a href="#newton"> Newton's Law of Cooling</a>

<p id="simple"></p>

Expand Down Expand Up @@ -73,6 +73,16 @@ A simple 3 [Nodes](https://mdf.readthedocs.io/en/latest/api/Specification.html#n
A simple [Node](https://mdf.readthedocs.io/en/latest/api/Specification.html#node) with a number of different types of [Parameters](https://mdf.readthedocs.io/en/latest/api/Specification.html#parameter) (in blue; fixed and **stateful**) and [Functions](https://mdf.readthedocs.io/en/latest/api/Specification.html#function) (in purple; can be built in or ONNX based).

<img src="https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/images/params_funcs.png" width="250" height="198" />
<p id="newton"></p>

## Newton's Law of Cooling

[Python Source](https://github.com/ModECI/MDF/blob/main/examples/MDF/newton.py) | [JSON](https://github.com/ModECI/MDF/blob/main/examples/MDF/NewtonCoolingModel.json) | [YAML](https://github.com/ModECI/MDF/blob/main/examples/MDF/NewtonCoolingModel.yaml)

A simple [Newtonian cooling process](https://en.wikipedia.org/wiki/Newton%27s_law_of_cooling) model that demonstrates the use of time derivative simulating the cooling of an object to the ambient temperature over time.

<img src="https://raw.githubusercontent.com/ModECI/MDF/development/examples/MDF/images/newton.png" width="250"/>
<img src="https://raw.githubusercontent.com/ModECI/MDF/development/examples/MDF/images/newton_plot.png" width="250"/>


## More examples
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/IAF_net.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"IAF_net": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"iaf_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/IAF_net.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IAF_net:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
iaf_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/IAF_net2.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"IAF_net2": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"iaf_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/IAF_net2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IAF_net2:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
iaf_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/IAFs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"IAFs": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"iaf_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/IAFs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IAFs:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
iaf_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/RNNs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"RNNs": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"rnn_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/RNN/RNNs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RNNs:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
rnn_example:
nodes:
Expand Down
Binary file modified examples/MDF/Simple.bson
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/MDF/Simple.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Simple": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"simple_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/Simple.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Simple:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
simple_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/States.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"States": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"state_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/States.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
States:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
state_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/abc_conditions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"abc_conditions": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"abc_conditions_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/abc_conditions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
abc_conditions:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
abc_conditions_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/conditions/Composite_mdf_condition.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Composite_mdf_condition": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"Composite_mdf_condition_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/conditions/Composite_mdf_condition.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Composite_mdf_condition:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
Composite_mdf_condition_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/conditions/everyncalls_condition.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"everyncalls_condition": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"everyncalls_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/conditions/everyncalls_condition.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
everyncalls_condition:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
everyncalls_example:
nodes:
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/conditions/threshold_condition.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"threshold_condition": {
"format": "ModECI MDF v0.4",
"generating_application": "Python modeci-mdf v0.4.10",
"generating_application": "Python modeci-mdf v0.4.11",
"graphs": {
"threshold_example": {
"nodes": {
Expand Down
2 changes: 1 addition & 1 deletion examples/MDF/conditions/threshold_condition.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
threshold_condition:
format: ModECI MDF v0.4
generating_application: Python modeci-mdf v0.4.10
generating_application: Python modeci-mdf v0.4.11
graphs:
threshold_example:
nodes:
Expand Down
Loading