Releases: qiemem/PythonExtension
Python Extension
This NetLogo extension allows NetLogo models to run Python code. This allows models to make use of powerful Python libraries, such as numpy, TensorFlow, scipy, and others. It works by starting up a Python session that the model can then run code in and get results from. See the documentation here: https://github.com/qiemem/PythonExtension/blob/master/README.md
Installation instructions
- Download the attached zip
- Unzip it into the extensions directory of your NetLogo installation.
Thus, your NetLogo extensions directory should contain a folder called py
with the following contents:
Demo models can be found in the demos
folder. They should work with either Python 2 or Python 3.
The demo models depend on a number of libraries, all installable with pip or conda:
Flocking Clusters
- numpy
- sklearn
Both Wolf Sheep Predation models
- numpy
- matplotlib
Traffic Basic - Reinforcement
- numpy
- tensorflow
- keras
To install all dependencies, run pip install numpy matplotlib sklearn tensorflow keras
in your terminal (assuming you have pip).
Changelist
Improvements:
- Halting the NetLogo model no longer automatically kills the Python session.
- Halt handling is much more robust in general.
- Improve documentation
Python Extension
Installation instructions
- Download the attached zip
- Unzip it into the extensions directory of your NetLogo installation.
Demo models can be found in the demos
folder. They should work with either Python 2 or Python 3.
The demo models depend on a number of libraries, all installable with pip or conda:
Flocking Clusters
- numpy
- sklearn
Both Wolf Sheep Predation models
- numpy
- matplotlib
Traffic Basic - Reinforcement
- numpy
- tensorflow
- keras
To install all dependencies, run pip install numpy matplotlib sklearn tensorflow keras
in your terminal (assuming you have pip).
Changelist
Bug fixes:
- Gracefully handles interruption of the Python process
- Somewhat gracefully handles user halting NetLogo by shutting down the Python process
- Does a better job of cleaning up the Python process
Python Extension alpha
Installation instructions
- Download the attached zip
- Unzip it into the extensions directory of your NetLogo installation.
Warning: This extension is untested on windows. There's a chance it will work if you just do py:setup "python.exe"
or something, but I haven't tried
Demo models can be found in the demos
folder. By default, they use Python 3. If you only have Python 2, simply change the line that reads py:setup "python3"
to py:set "python"
.
The demo models depend on a number of libraries, all installable with pip:
Flocking Clusters
- numpy
- sklearn
Both Wolf Sheep Predation models
- numpy
- matplotlib
Traffic Basic - Reinforcement
- numpy
- tensorflow
- keras
To install all dependencies, run pip install numpy matplotlib sklearn tensorflow keras
in your terminal (assuming you have pip).
Changelist
Features:
- New primitives for referencing correct Python installation in system independent way:
py:python
,py:python2
, andpy:python3
- New configuration file and menu for configuring default Python installations to use
- Much faster data transfer between Python and NetLogo
Bug fixes:
- Fail gracefully on
NaN
andInfinity
Python Extension alpha
Installation instructions
- Download the attached zip
- Unzip it into the extensions directory of your NetLogo installation.
Warning: This extension is untested on windows. There's a chance it will work if you just do py:setup "python.exe"
or something, but I haven't tried
Demo models can be found in the demos
folder. By default, they use Python 3. If you only have Python 2, simply change the line that reads py:setup "python3"
to py:set "python"
.
The demo models depend on a number of libraries, all installable with pip:
Flocking Clusters
- numpy
- sklearn
Both Wolf Sheep Predation models
- numpy
- matplotlib
Traffic Basic - Reinforcement
- numpy
- tensorflow
- keras
To install all dependencies, run pip install numpy matplotlib sklearn tensorflow keras
in your terminal (assuming you have pip).