An example of using the Python mappings for the CSDMS Basic Model Interface (BMI) to wrap a model written with AgentPy, an open-source library for developing and analyzing agent-based models in Python.
This is an example of implementing a BMI for a statistical model of diffusion on a uniform rectangular plate. The model, DiffusionModel, is written with AgentPy.
This repository is organized with the following directories:
- diffusion
- Source for the model and a BMI implementation for the model
- examples
- Python scripts and Jupyter Notebooks that demonstrate how to run the model standalone and through its BMI
- tests
- Tests that cover the model and its BMI
This example can be built and installed on Linux, macOS, and Windows.
We recommend setting up a virtual environment--e.g., through venv
or conda
--to install the packages required for this example.
Use pip
to install this example and the dependencies needed to run the sample notebooks.
pip install -e ".[examples]"
Try the example notebooks and scripts in the examples directory.
This work is supported by the U.S. National Science Foundation under Award No. 2148762, Collaborative Research: Facility: CSDMS: Engaging a thriving community of practice in Earth-surface dynamics.
The AgentPy package:
Foramitti, J., (2021). AgentPy: A package for agent-based modeling in Python. Journal of Open Source Software, 6(62), 3065, https://doi.org/10.21105/joss.03065