NetBayesABM
Agent-based models of plant–pollinator networks with Bayesian inference (ABC).
NetBayesABM is a Python library for simulating agent-based models (ABMs) of ecological networks, focusing on plant–pollinator interactions. It provides tools to:
- Initialize agents (plants and pollinators) with different spatial configurations.
- Construct and evolve bipartite networks dynamically.
- Define and sample prior distributions (Gamma, Exponential) for interaction parameters.
- Visualize abundances, priors, networks, and degree distributions.
- Evaluate simulated networks against empirical data using multiple metrics.
🚀 Installation
Once published on PyPI, you can install with:
pip install NetBayesABM
For development (local clone):
git clone https://github.com/galeanojav/NetBayesABM.git
cd NetBayesABM
pip install -e .
📖 Quick Example
import numpy as np
import pandas as pd
from netbayesabm.classes import Environment_plant, Environment_pol
from netbayesabm.modelling import initial_network, update_totalinks, remove_zero
from netbayesabm.visualization import plot_agents, plot_priors
# --- Define plant environment (random positions) ---
df_plants = pd.DataFrame({
"Plant_id": [1, 2, 3],
"Plant_sp": ["rose", "daisy", "sunflower"],
"X": [0, 0, 0],
"Y": [0, 0, 0],
"Plant_sp_complete": ["Rosa sp.", "Bellis perennis", "Helianthus annuus"]
})
envp = Environment_plant(df_plants, random_position=True, xmin=0, xmax=10, ymin=0, ymax=10)
# --- Define pollinators ---
df_pols = pd.DataFrame({
"Pol_id": [1, 2],
"Specie": ["bee", "butterfly"],
"x": [2.0, 8.0],
"y": [3.0, 7.0],
"Radius": [3.0, 3.0]
})
envpol = Environment_pol(df_pols)
# --- Build bipartite network ---
B = initial_network(df_pols['Pol_id'].tolist(), df_plants['Plant_id'].tolist())
# --- Run short simulation ---
update_totalinks(50, envpol, envp, B, xmin=0, xmax=10, ymin=0, ymax=10)
remove_zero(B)
# --- Priors ---
prior_specialist = pd.Series(np.random.gamma(2, 2, size=1000))
prior_generalist = pd.Series(np.random.gamma(2, 2, size=1000))
plot_priors(prior_specialist, prior_generalist, "example_priors")
📁 Example
A complete analysis notebook is available in:
It includes:
- Data loading and filtering
- Network construction
- All main metrics (degree, strength, clustering, betweenness)
- Fitted models and visualizations
The example uses data (CSV files in examples/Data/).
📊 Features
- Agent and environment classes (Environment_plant, Environment_pol).
- Network initialization and evolution functions.
- Visualization utilities for abundances, priors, and degree distributions.
- Evaluation metrics (Hellinger, Jensen–Shannon, KL, Wasserstein, etc.).
- Example notebooks for a quick start.
👩💻 Authors
- Javier Galeano — [javier.galeano@upm.es]
- Blanca Arroyo-Correa — [blanca.arroyo@ebd.csic.es]
- Mario Castro — [marioc@iit.comillas.edu]
📜 License
This project is licensed under the MIT License — see the LICENSE file for details.
🔗 Links • Source code on GitHub [https://github.com/galeanojav/NetBayesABM]
Metadata
Release files for netbayesabm 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| netbayesabm-0.1.2.tar.gz | 18.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netbayesabm-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.7 kB
Release files / netbayesabm-0.1.2.tar.gz
| Download URL | netbayesabm-0.1.2.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81a2f99ca8f4bd09ea6c477c289bb69dc670443a3307c9bb763b504c537c68e4
|
|
BLAKE2b-256 checksum How to use checksums |
8eb4b6438331567468a064ea2f2ee79a055b1219bc24b97f877c62256604b176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / netbayesabm-0.1.2-py3-none-any.whl
| Download URL | netbayesabm-0.1.2-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9bda7a597f6db27e8b01207941e0d1b7687c286aa0b31ff7286a6fb13a3364d
|
|
BLAKE2b-256 checksum How to use checksums |
9f5c47836635112575b6206596774f9a1a0be6a869e7f2f1c396dcaebf13acd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for netbayesabm 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.