EcospaceCal is an R-based framework that automates the calibration of Ecopath with Ecosim (EwE) Ecospace models using powerful modern optimization techniques. It provides a systematic, transparent, and repeatable process for aligning spatial-temporal models with observational data.
Calibrating complex ecosystem models is essential for credible projections but often involves manual, time-consuming, and subjective tuning—particularly in EwE models where predator-prey vulnerability settings require careful adjustment.
EcospaceCal tackles this by offering an open-source, fully-scripted interface that connects the EwE command-line executable with cutting-edge optimization methods. It’s designed to:
- Simplify and streamline the calibration process.
- Enhance reproducibility and transparency.
- Save researchers valuable time and effort.
-
Multiple Optimization Algorithms
- Genetic Algorithm (GA): Population-based, flexible, and widely used.
- CMA-ES: Covariance Matrix Adaptation Evolution Strategy for efficient real-valued optimization.
- Bayesian Optimization (BO): Perfect for minimizing computational load with fewer model runs.
-
Automated Workflow
- Manages parameter selection, model runs, and results aggregation in a single loop.
-
Parallel Processing
- Speeds up computation by distributing tasks across CPU cores.
-
Smart Caching
- Avoids redundant simulations by reusing previously evaluated parameter sets.
-
Robust Error Handling
- Includes timeouts and graceful recovery from failed model runs.
- R: Version 4.0 or later
- Ecopath with Ecosim (EwE): Installed command-line version
- R Packages:
Install all required packages with:install.packages(c( "GA", "cmaes", "rBayesianOptimization", "dplyr", "digest", "readxl", "doParallel", "R.utils" ))
git clone https://github.com/mattwoodstock/EcospaceCal.git
cd EcospaceCal- Open
setup.Rand edit the necessarry file locations and variables
In RStudio or your preferred IDE, open:
R/CalProject.Rproj
analysis/example.R
Uncomment the relevant run_calibration() call for:
"GA"– Genetic Algorithm"CMAES"– CMA-ES"BO"– Bayesian Optimization
Override defaults by passing a config list:
ga_config <- list(
popSize = 20,
run = 5
)
run_calibration(
method = "GA",
sensitivity_file = "./data/Gulf_of_Mexico/Master Vulnerability Table.xlsx",
sheet_number = 2,
output_base = "GA_Calibration_Run",
n_cores = 8,
config = ga_config
)Execute the script to begin optimization:
source("analysis/example.R")Results are stored in a timestamped directory like:
GA_Calibration_Run/GA_Run_20250804_130900/
EcospaceCal/
├── R/ # Core framework scripts
│ ├── calibration_framework.R
│ └── setup_template.R
│
├── data/ # Input data for case studies
│ ├── Gulf_of_Mexico/
│ └── **To Add More**
│
├── analysis/ # Script to launch analyses
│ └── example.R
│
└── results/ # Output folder (ignored by Git)
If you use EcospaceCal in your research, please cite this repo
Will add full citation once published.
This project is released under the MIT License. See LICENSE.txt for details.
For questions, issues, or feature requests:
👉 Open an Issue