Developer Guide¶
This guide is for developers and contributors who want to understand the internal architecture of the Generalized Compartmental Modeling Framework.
The User-facing pages explain how to run models and interpret results, but this section focuses on the code internals — how modules, classes, and functions work together.
Purpose¶
The Developer Guide will help you: - Understand the structure and flow of the codebase - Extend the framework with new models, fitting methods, or visualizations - Maintain and debug existing functionality
High-Level Architecture¶
The framework follows a modular design:
-
Main Controller (
main.py
)- Parses CLI arguments (
--model <model_name>
) - Loads the YAML configuration
- Orchestrates the workflow: simulation → noise injection → sampling → calibration → plotting → saving outputs
- Parses CLI arguments (
-
Core Model Logic (
model.py
)Population
— Population size & assumptionsCompartmentalModel
— Builds and simulates the ODE system
-
Calibration Layer (
calibration.py
)- Optimization (Nelder-Mead, BFGS, L-BFGS-B, etc.)
- MCMC for Bayesian inference
- Loss calculation functions
-
Plotting Layer (
plotting.py
)- Generates simulation plots, noisy data plots, comparisons, parameter estimation graphs, and MCMC corner plots
Workflow for Developers¶
- Add or modify models in the YAML configuration
- Update model logic in
model.py
if new compartments or transitions are needed - Extend calibration methods in
calibration.py
for new fitting techniques - Enhance visualization in
plotting.py
for additional plots or formats - Test your changes with:
python main.py --model <model_name>