A NetLogo connector for Python.
Project description
## NL4Py
A Python controller interface to NetLogo. NL4Py uses a client-server architecture, allowing Python client code to control NetLogo workspaces on a controller server. NL4Py supports controlling multiple workspaces through a single Python client.
At the moment, only HeadlessWorkspaces are supported.
### Requirements
* NL4Py works with NetLogo 6.0.2
* NL4Py requires [py4j](https://www.py4j.org/) to be installed with your Python distrubtion
You can install py4j with:
```
pip install py4j
```
### Installation
Please set the environment variable on your system NETLOGO_APP to point to the 'app' directory in your NetLogo installation folder.
For example, on Windows, this is typically at: 'C:\Program Files\NetLogo 6.0.2\app'
You can install NL4Py using pip-tools:
```
pip install nl4py
```
### Usage
To use nl4py in your python code use:
```python
import nl4py
```
#### Functions
You can create multiple NetLogo HeadlessWorkspaces from Python using the netLogoWorkspaceFactory:
```python
nl4py.netlogoWorkspaceFactory.newNetLogoHeadlessWorkspace()
```
The following HeadlessWorkspace functions are available:
```python
nl4py.NetLogo_HeadlessWorkspace.openModel(path_to_model)
nl4py.NetLogo_HeadlessWorkspace.closeModel()
nl4py.NetLogo_HeadlessWorkspace.command(netlogo_command_string)
nl4py.NetLogo_HeadlessWorkspace.report(netlogo_command_string)
nl4py.NetLogo_HeadlessWorkspace.setParamsRandom()
nl4py.NetLogo_HeadlessWorkspace.getParamNames()
nl4py.NetLogo_HeadlessWorkspace.getParamRanges()
```
Additionally, the netLogoWorkspaceFactory provides the following functions:
```python
nl4py.netlogoWorkspaceFactory.deleteAllExistingWorkspaces()
nl4py.netlogoWorkspaceFactory.getAllExistingWorkspaces()
```
#### Example
For an example please see this [demo jupyter notebook](https://github.com/chathika/NL4Py/blob/master/examples/Demo%20NL4Py.ipynb)
### Referencing:
Please cite as: Gunaratne, C. (2018). NL4Py. https://github.com/chathika/NL4Py. Complex Adaptive Systems Lab, University of Central Florida, Orlando, FL.
NL4Py is based off of David Masad's [Py2NetLogo](https://github.com/dmasad/Py2NetLogo), available at: https://github.com/dmasad/Py2NetLogo
### Copyright
Copyright (C) 2018 Chathika Gunaratne, Complex Adaptive Systems Lab, University of Central Florida.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
A Python controller interface to NetLogo. NL4Py uses a client-server architecture, allowing Python client code to control NetLogo workspaces on a controller server. NL4Py supports controlling multiple workspaces through a single Python client.
At the moment, only HeadlessWorkspaces are supported.
### Requirements
* NL4Py works with NetLogo 6.0.2
* NL4Py requires [py4j](https://www.py4j.org/) to be installed with your Python distrubtion
You can install py4j with:
```
pip install py4j
```
### Installation
Please set the environment variable on your system NETLOGO_APP to point to the 'app' directory in your NetLogo installation folder.
For example, on Windows, this is typically at: 'C:\Program Files\NetLogo 6.0.2\app'
You can install NL4Py using pip-tools:
```
pip install nl4py
```
### Usage
To use nl4py in your python code use:
```python
import nl4py
```
#### Functions
You can create multiple NetLogo HeadlessWorkspaces from Python using the netLogoWorkspaceFactory:
```python
nl4py.netlogoWorkspaceFactory.newNetLogoHeadlessWorkspace()
```
The following HeadlessWorkspace functions are available:
```python
nl4py.NetLogo_HeadlessWorkspace.openModel(path_to_model)
nl4py.NetLogo_HeadlessWorkspace.closeModel()
nl4py.NetLogo_HeadlessWorkspace.command(netlogo_command_string)
nl4py.NetLogo_HeadlessWorkspace.report(netlogo_command_string)
nl4py.NetLogo_HeadlessWorkspace.setParamsRandom()
nl4py.NetLogo_HeadlessWorkspace.getParamNames()
nl4py.NetLogo_HeadlessWorkspace.getParamRanges()
```
Additionally, the netLogoWorkspaceFactory provides the following functions:
```python
nl4py.netlogoWorkspaceFactory.deleteAllExistingWorkspaces()
nl4py.netlogoWorkspaceFactory.getAllExistingWorkspaces()
```
#### Example
For an example please see this [demo jupyter notebook](https://github.com/chathika/NL4Py/blob/master/examples/Demo%20NL4Py.ipynb)
### Referencing:
Please cite as: Gunaratne, C. (2018). NL4Py. https://github.com/chathika/NL4Py. Complex Adaptive Systems Lab, University of Central Florida, Orlando, FL.
NL4Py is based off of David Masad's [Py2NetLogo](https://github.com/dmasad/Py2NetLogo), available at: https://github.com/dmasad/Py2NetLogo
### Copyright
Copyright (C) 2018 Chathika Gunaratne, Complex Adaptive Systems Lab, University of Central Florida.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
NL4Py-0.1.5.tar.gz
(17.6 kB
view hashes)
Built Distribution
NL4Py-0.1.5-py2.py3-none-any.whl
(11.3 kB
view hashes)
Close
Hashes for NL4Py-0.1.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d587ce251a50ad9418dda347c536e4679bfe1db930afce1519d6b1ffc07eb269 |
|
MD5 | 6265b459f66a7c6e95a1e01b0b641a5a |
|
BLAKE2b-256 | 64f2210d1b52ce75dc5de24bcaf04ae22a551f4a422814f6b30d7ed77de310e3 |