A demonstration project to experiment with a few different concepts:
- porting polio within-host logic into Rust for use with Bevy gaming engine (related to previous Python code implementations in StarSim, poliosim, and multiscale models)
- experimenting with interactive visualizations for debugging and building intuition about model logic behavior (related to similar effort on malaria coinfection)
- exporting Rust functions and modules to Python package with PyO3 and maturin (for further integration in tutorial notebooks, calibration workflows, etc.)
- providing R integration via reticulate for epidemiological analysis workflows
Click the "Open in GitHub Codespaces" badge above for pre-configured development environment.
- see setup.sh for details
- see demo.ipynb for a demo notebook using the exported python package
To launch the interactive demo yourself, run the following from the commandline:
cd app && cargo run
You'll have to have rustup installed already. Instructions here.
To run the simulation in your web browser:
cd app && trunk serve --openVisit http://localhost:8080 for the same interactive visualization with real-time parameter controls. Requires trunk for WASM deployment (install with cargo install trunk).
Everything is automatically set up! Just run:
python pybevy/test.pyTo build the exported Python package, run maturin from within a new venv:
python -m venv .venv
source .venv/bin/activate
maturin develop --release # Rebuild pybevyTo test if the exported pybevy python library is accessible, you can run:
python pybevy/demo.py
Or also by launching and re-running the code in demo notebook:
jupyter notebook demo.ipynb
And look at time-series outputs for different longitudinal challenge scenarios like below:
To run the R integration example:
# Install R dependencies (first time)
Rscript -e "install.packages(c('reticulate', 'ggplot2', 'dplyr', 'tidyr'))"
# Run comprehensive R example
Rscript R/demo.RSee R/README.md for complete setup guide and troubleshooting.
To enable info-level logging, one can set environment variable like this:
RUST_LOG=info cargo run
or
RUST_LOG=info python demo.py



