https://github.com/cheesesnakes/multitrophic-risk

Chapter 2 of my Ph.D. thesis

https://github.com/cheesesnakes/multitrophic-risk

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.1%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Chapter 2 of my Ph.D. thesis

Basic Info
  • Host: GitHub
  • Owner: cheesesnakes
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 1.93 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

README: Superpredator Analysis Framework

Overview

This repository contains the code and resources for analyzing the impact of multitrophic risk introduced by human "superpredators" on tritrophic ecosystems. Using an agent-based modeling approach implemented in Python's Mesa framework, the project investigates how superpredators influence population dynamics, coexistence equilibria, and ecosystem stability.

The study explores three models: 1. Base Model: A predator-prey system. 2. Tritrophic Model: A system including apex predators, mesopredators, and prey. 3. Superpredator Model: A system where apex predators are replaced by superpredators with unique characteristics (e.g., 100% lethality, no reproduction, no mortality).

Simulations were conducted across various parameter combinations to assess the effects of superpredator targets, lethality, and behavioral adaptations.


Abstract

Predator-prey interactions involve continuous behavioral adaptations that influence population dynamics and ecosystem stability. While traditional models have examined these dynamics at single trophic levels, the impact of multitrophic risk particularly from human "superpredators" targeting multiple levels remains underexplored. We investigated how pervasive multitrophic risk introduced by a superpredator affects a tritrophic system of apex predators, mesopredators, and primary consumers using an agent-based model in Python’s Mesa framework. We explored the effects of replacing apex predators with superpredators, varying superpredator targets, and altering superpredator lethality. Three models were constructed: (1) a base model with predators and prey, (2) a tritrophic model including an apex predator, and (3) a superpredator model with a superpredator that does not die or reproduce and has 100% lethality. Agents were programmed to exhibit behaviors such as reproduction, movement, and predator avoidance. Simulations were conducted across a range of breeding rates with 100 runs for each parameter combination. Our results demonstrate that superpredators significantly destabilize ecosystems. Replacing apex predators with superpredators eliminated coexistence equilibria seen in the tritrophic model, leading to prey-only equilibria or extinction. Superpredators targeting both mesopredators and prey or only mesopredators resulted in extinction trends, while coexistence occurred when superpredators targeted only prey, within a limited range. Importantly, non-lethal superpredators—inducing antipredator responses without direct mortality—enabled coexistence across scenarios, underscoring the role of behavioral adaptations in stability. These findings highlight the significant impact of human superpredators on multitrophic interactions and underscore the importance of integrating human activities into ecological models and conservation strategies to mitigate unintended ecological consequences.

Keywords: human disturbance, agent-based modeling, predator-prey interactions, behavioral adaptations

Repository Structure

superpredator/ ├── functions/ # helper functions | ├── models.py # ABM models definitions | ├── runner.py # Model runner and plotting functions | ├── debug.py # Debugging functions | ├── example.py # example simulations | ├── strategies.py # example simulations varying predator and prey strategies | ├── funcs.py # analysis functions | ├── plots.py # anlysis plotting functions ├── literature/ # literature survey data and analysis | ├── lit-data.R # R script for literature data processing | ├── articles.csv # Database of articles | ├── articles_full-text.csv # Articles chosen for full-text screeening ├── analysis.py # main analysis script ├── configs.py # configuration file for experiments ├── params.py # globalparameter definitions for model ├── run.py # main script to run the model ├── pyproject.toml # Python project configuration ├── requirements.txt # Python dependencies ├── uv.lock # Python dependency lock file ├── README.md # This file

Installation

Using uv (Recommended)

To install the project using uv, follow these steps:

  1. Install uv: bash pip install uv
  2. Clone the repository
  3. Create a new environment: bash uv sync
  4. Run the desired program e.g.: bash uv run run.py

Using pip

Prerequisites: - Python 3.8+ - R (for literature analysis) - Required Python libraries: mesa, pandas, matplotlib, seaborn, polars, numpy.

Installation Steps:

  1. Clone the repository
  2. Install Python dependencies: bash pip install -r requirements.txt
  3. Install R dependencies: r install.packages(c("dplyr", "tidyr", "stringr", "purrr"))

Usage

The run.py script serves as the main entry point for running various components of the superpredator analysis framework. It provides options to execute debugging, example simulations, strategy visualizations, and experiments.

To run the script, use the following command in the terminal:

bash uv run run.py [<program>] [<option>]

Available Programs:

Debug: Runs debugging scripts for the model.

Examples: Executes predefined example simulations.

Strategies: Runs and visualizes strategy examples.

Experiments: Executes model experiments based on configurations. Options in Detail

Debug

Runs debugging scripts to test the model and visualize debugging outputs.

Command:

bash uv run run.py Debug

What it does:

  • Executes the run_debug function to test the model.
  • Generates debugging plots using plot_debug.

Examples

Runs predefined example simulations for different models (lv, apex, super).

Command:

bash uv run run.py Examples [model_name]

Arguments:

  • model_name (optional): Specifies the model to run.

Available models: - lv: Lotka-Volterra (base predator-prey model). - apex: Tritrophic model with apex predators. - super: Superpredator model.

If no modelname is provided, all models (lv, apex, super) are executed. If an invalid modelname is provided, the script will display an error message.

Strategies

Runs and visualizes strategy examples for the model.

Command:

bash uv run run.py Strategies

What it does:

  • Executes the run_strategies function to simulate various predator and prey strategies.
  • Generates strategy plots using plot_strategy.

Experiments

Runs model experiments based on predefined configurations in configs.py.

Command:

bash uv run run.py Experiments [experiment_number]

Arguments:

  • experiment_number (optional): Specifies the experiment to run (e.g., 2 for Experiment-2).

Behavior:

  • If no experiment_number is provided, all experiments in configs.py are executed.
  • If an invalid experiment_number is provided, the script will display available experiment names.

Examples:

Run all experiments:

bash uv run run.py Experiments

Run a specific experiment (e.g., Experiment-2):

bash uv run run.py Experiments 2

Configuration

The configuration for experiments is defined in the configs.py file. Global model parameters are set in params.py.

Citation

This project is currently in development. If you use this code or data in your research, please contact the authors for citation information.

License

This project is licensed under the MIT License. See LICENSE for details.

Owner

  • Name: Shawn Dsouza
  • Login: cheesesnakes
  • Kind: user
  • Company: Dakshin Foundation

GitHub Events

Total
  • Push event: 12
  • Public event: 1
Last Year
  • Push event: 12
  • Public event: 1

Dependencies

pyproject.toml pypi
  • mesa ==2.4.0
  • numpy >=2.2.4
  • pandas >=2.2.3
  • polars >=1.26.0
  • pyarrow >=19.0.1
  • ray >=2.44.1
  • scipy >=1.15.2
  • seaborn >=0.13.2
requirements.txt pypi
  • Jinja2 ==3.1.4
  • Markdown ==3.7
  • MarkupSafe ==3.0.2
  • Mesa ==2.4.0
  • Mesa-Viz-Tornado ==0.1.3
  • PyYAML ==6.0.2
  • Pygments ==2.18.0
  • aiosignal ==1.3.1
  • anyio ==4.6.2.post1
  • arrow ==1.3.0
  • asttokens ==2.4.1
  • attrs ==24.2.0
  • binaryornot ==0.4.4
  • cachetools ==5.5.0
  • certifi ==2024.8.30
  • chardet ==5.2.0
  • charset-normalizer ==3.4.0
  • click ==8.1.7
  • comm ==0.2.2
  • contourpy ==1.3.0
  • cookiecutter ==2.6.0
  • cycler ==0.12.1
  • debugpy ==1.8.7
  • decorator ==5.1.1
  • exceptiongroup ==1.2.2
  • executing ==2.1.0
  • fastjsonschema ==2.20.0
  • filelock ==3.16.1
  • fonttools ==4.54.1
  • frozenlist ==1.5.0
  • h11 ==0.14.0
  • humanize ==4.11.0
  • idna ==3.10
  • ipykernel ==6.29.5
  • ipython ==8.29.0
  • ipyvue ==1.11.1
  • ipyvuetify ==1.10.0
  • ipywidgets ==8.1.5
  • jedi ==0.19.1
  • jsonschema ==4.23.0
  • jsonschema-specifications ==2024.10.1
  • jupyter_client ==8.6.3
  • jupyter_core ==5.7.2
  • jupyterlab_widgets ==3.0.13
  • kiwisolver ==1.4.7
  • markdown-it-py ==3.0.0
  • matplotlib ==3.9.2
  • matplotlib-inline ==0.1.7
  • mdurl ==0.1.2
  • msgpack ==1.1.0
  • nbformat ==5.10.4
  • nest-asyncio ==1.6.0
  • networkx ==3.4.2
  • numpy ==2.1.3
  • packaging ==24.1
  • pandas ==2.2.3
  • parso ==0.8.4
  • pexpect ==4.9.0
  • pillow ==11.0.0
  • platformdirs ==4.3.6
  • prompt_toolkit ==3.0.48
  • protobuf ==5.28.3
  • psutil ==6.1.0
  • ptyprocess ==0.7.0
  • pure_eval ==0.2.3
  • pymdown-extensions ==10.12
  • pyparsing ==3.2.0
  • python-dateutil ==2.9.0.post0
  • python-slugify ==8.0.4
  • pytz ==2024.2
  • pyzmq ==26.2.0
  • ray ==2.38.0
  • reacton ==1.8.3
  • referencing ==0.35.1
  • requests ==2.32.3
  • rich ==13.9.4
  • rich-click ==1.8.3
  • rpds-py ==0.21.0
  • scipy ==1.14.1
  • six ==1.16.0
  • sniffio ==1.3.1
  • solara ==1.41.0
  • solara-server ==1.41.0
  • solara-ui ==1.41.0
  • stack-data ==0.6.3
  • starlette ==0.41.2
  • text-unidecode ==1.3
  • tornado ==6.4.1
  • tqdm ==4.67.0
  • traitlets ==5.14.3
  • types-python-dateutil ==2.9.0.20241003
  • typing_extensions ==4.12.2
  • tzdata ==2024.2
  • urllib3 ==2.2.3
  • uvicorn ==0.32.0
  • watchdog ==6.0.0
  • watchfiles ==0.24.0
  • wcwidth ==0.2.13
  • websockets ==13.1
  • widgetsnbextension ==4.0.13
uv.lock pypi
  • 109 dependencies