{"id":21595611,"url":"https://github.com/chathika/nl4py","last_synced_at":"2025-04-11T00:12:00.233Z","repository":{"id":57446311,"uuid":"130414108","full_name":"chathika/NL4Py","owner":"chathika","description":"Bringing Your Turtles From NetLogo to Python 🐍🐢","archived":false,"fork":false,"pushed_at":"2022-05-20T11:41:33.000Z","size":46309,"stargazers_count":52,"open_issues_count":6,"forks_count":9,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-11T00:11:51.159Z","etag":null,"topics":["agent-based-modeling","netlogo","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chathika.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-20T21:09:10.000Z","updated_at":"2024-10-20T21:36:03.000Z","dependencies_parsed_at":"2022-09-02T23:41:10.967Z","dependency_job_id":null,"html_url":"https://github.com/chathika/NL4Py","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chathika%2FNL4Py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chathika%2FNL4Py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chathika%2FNL4Py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chathika%2FNL4Py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chathika","download_url":"https://codeload.github.com/chathika/NL4Py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317729,"owners_count":21083530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-based-modeling","netlogo","python"],"created_at":"2024-11-24T17:40:50.065Z","updated_at":"2025-04-11T00:12:00.199Z","avatar_url":"https://github.com/chathika.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![Build wheel and Run Unittests](https://github.com/chathika/NL4Py/workflows/Build%20wheel%20and%20Run%20Unittests/badge.svg) ![Run Unittests](https://github.com/chathika/NL4Py/workflows/Run%20Unittests/badge.svg)\n## NL4Py\n\nA Python controller interface to NetLogo. NL4Py uses a Remote Procedure Call architecture, allowing Python client code to control NetLogo workspaces on a NetLogoWorkspaceController server. NL4Py supports controlling multiple workspaces through a single Python client. \n\nRead the NL4Py article is on SoftwareX: [https://www.sciencedirect.com/science/article/pii/S2352711021001035](https://www.sciencedirect.com/science/article/pii/S2352711021001035)\n\n[NetLogo with GUI control demo](https://www.youtube.com/watch?v=TXLqbYNYyVg)\n\nNL4Py has been tested Python 3.6.2\n\n\n### Requirements\n* NL4Py works with NetLogo 6.0, 6.1, and 6.2\n* NL4Py requires JDK 1.8 \n* NL4Py requires [py4j](https://www.py4j.org/) to be installed with your Python distrubtion\n\n### Installation\nYou can install NL4Py using pip-tools: \n```\npip install nl4py\n```\n\n### Usage\nTo use nl4py in your python code use: \n\n```python\nimport nl4py \n```\n\nAnd start the NetLogoControllerServer with:\n\n```python\nnl4py.initialize(netlogo_home : str)\n```\n\nWhere netlogo_home refers to the top level directory of your NetLogo installation.\n\n#### Examples\n1. [Example1](https://github.com/chathika/NL4Py/blob/master/examples/Example1_NRunsOfFireSampleModel.py) : An example of how to run concurrent NetLogo models. To run this example enter the number of desired concurrent runs and the path to your netlogo installation as command line arguments:\n\n```\npython Example1_NRunsOfFireSampleModel.py 200 \"C:\\Program Files\\NetLogo 6.0.4\"\n```\n\n2. [Example2](https://github.com/chathika/NL4Py/blob/master/examples/Example2_NRunsOfFireSampleModelScheduledReporters.py) : An example of how to schedule reporters to return simulation state over a range of ticks at a custom tick interval. To run pass in the path to your netlogo installation as a command line argument:\n\n```\npython Example2_ScheduledReporters.py 200 \"C:\\Program Files\\NetLogo 6.0.4\"\n```\n\n3. [Example3](https://github.com/chathika/NL4Py/blob/master/examples/Example3_NRunsOfFireRunExperiment.py\n) : An example of how to run_experiment can be used to easily execute an experiment with parameter variation and return results of multiple reporters. To run pass in the path to your netlogo installation as a command line argument:\n\n```\npython Example3_NRunsOfFireRunExperiment.py 20 \"C:\\Program Files\\NetLogo 6.0.4\"\n```\n\n4. [Example4](https://github.com/chathika/NL4Py/blob/master/examples/Example4_NetLogoGUIAppControl.py\n) : An example of how to control the NetLogoGUI. To run pass in the path to your netlogo installation as a command line argument:\n\n```\npython Example4_NetLogoGUIAppControl.py \"C:\\Program Files\\NetLogo 6.0.4\"\n```\n\nAlso, see these demo jupyter notebooks:\n\n1. [Parameter Calibration](https://github.com/chathika/NL4Py/blob/master/examples/ParameterCalibrationWithDEAP.ipynb)\n2. [Sensitivity Analysis](https://github.com/chathika/NL4Py/blob/master/examples/SensitivityAnalysis.ipynb)\n\n#### Functions\nYou can create multiple NetLogo HeadlessWorkspaces from Python using the netLogoWorkspaceFactory: \n\n```python\nnl4py.create_headless_workspace() -\u003e nl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace\n```\n\nThe following HeadlessWorkspace functions are available:\n\n```python\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.open_model(self, path : str)\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.close_model(self)\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.command(self, command : str)\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.report(self, reporter : str) -\u003e str\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.schedule_reporters(self, reporters : list, startAtTick : int = 0, \n                                                                      intervalTicks : int = 1, stopAtTick : int = -1, goCommand : str = 'go') -\u003e list\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.set_params_random()\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.get_param_names()\nnl4py.NetLogoHeadlessWorkspace.NetLogoHeadlessWorkspace.get_param_ranges()\n```\n\nTo open the NetLogo application in GUI mode use:\n\n```python\nnl4py.netlogo_app() -\u003e nl4py.NetLogoGUI.NetLogoGUI\n```\n\n### Referencing:\n\nPlease cite as: \nGunaratne, C., \u0026 Garibay, I. (2021). NL4Py: Agent-based modeling in Python with parallelizable NetLogo workspaces. SoftwareX, 16, 100801.\n\nNL4Py is based off of David Masad's [Py2NetLogo](https://github.com/dmasad/Py2NetLogo), available at: https://github.com/dmasad/Py2NetLogo\n\n### Copyright\n\nCopyright (C) 2018 Chathika Gunaratne, Complex Adaptive Systems Lab, University of Central Florida.\n\nThis 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.\n\nThis 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.\n\nYou should have received a copy of the GNU General Public License along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchathika%2Fnl4py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchathika%2Fnl4py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchathika%2Fnl4py/lists"}