Skip to main content

Spatio-Flux

▶ live test report ▶ read-only workbench ▶ paper figures paper ecosystem

A reference application for compositional multiscale biological modeling built on the Process-Bigraph framework. Spatio-Flux composes independently developed processes — metabolism, spatial transport, particle dynamics, structural rewrites — into a single executable simulation via typed interfaces and shared orchestration, not tightly coupled solvers.

It's the worked example in Process Bigraphs and the Architecture of Compositional Systems Biology (Agmon & Spangler, arXiv:2512.23754).

▶ Browse the live test suite report → 19 composite scenarios, each with structure diagrams, time series, and plots.

▶ Open the read-only workbench → The same 19 scenarios as a browsable investigation of studies — the composition DAG (standalone processes → pairs → triples → reference demos), each study's runs, reproduced visualizations, and the process/loom explorer — served with no backend.

Spatio-Flux reference composite

Spatio-Flux reference demo


What this repo is

Spatio-Flux is a testbed and reference implementation, not an optimized domain simulator. Its purpose is to make model composition explicit and inspectable.

It demonstrates how to:

  • compose heterogeneous modeling paradigms (ODEs, dFBA, spatial fields, particles)
  • couple mechanisms through shared typed state, not direct process calls
  • coordinate multi-timescale execution with reusable orchestration patterns
  • swap or recombine processes without modifying surrounding models

The test suite

The heart of the repo is spatio_flux/experiments/test_suite.py, which exercises 19 composition patterns and renders the report linked above.

Covered scenarios include:

  • Monod and dynamic FBA metabolism (single-strain + multi-strain communities)
  • COMETS-style spatial dFBA on a lattice
  • Brownian and Newtonian (Pymunk) particle systems
  • Particle–field exchange with embedded metabolism
  • Event-driven division and boundary handling

Each scenario produces a process-bigraph diagram, serialized schemas and state, and domain-specific plots or animations.

Each composite is a @composite_generator-decorated function under spatio_flux/composites/, discoverable by the pbg-superpowers dashboard.

Reusing composites at different scales

Generators expose their lattice and transport parameters as keyword arguments — defaults match what the test-suite report uses, but callers (or the dashboard's parameter form) can override them to reuse the same composite at a different resolution or with different transport rates. Commonly available knobs:

  • n_bins, bounds — lattice resolution and physical extent (default SQUARE_BINS / SQUARE_BOUNDS, or DEFAULT_BINS / DEFAULT_BOUNDS for diffusion-only generators)
  • diffusion_rate, advection_rate — Brownian-particle or field transport coefficients (default DEFAULT_DIFFUSION, DEFAULT_ADVECTION; some generators use a scaled default such as DEFAULT_DIFFUSION / 2)
  • n_particles, add_rate, division_mass_threshold — particle population controls
  • initial_min_max — per-molecule (min, max) ranges used to seed field state
  • field_advection_rate — field-level advection where it must be disambiguated from particle advection (e.g. comets_br_particles_dfba)

Each generator declares only the subset of parameters it actually uses; see the parameters={…} block on each @composite_generator for the authoritative list and types. Build a doc with overrides via:

from pbg_superpowers.composite_generator import build_generator
from spatio_flux.composites import REGISTRY

entry = next(e for e in REGISTRY.values() if e.name == "diffusion_process")
doc = build_generator(entry, overrides={"n_bins": [20, 40], "diffusion_rate": 0.1})

Run it locally

git clone https://github.com/vivarium-collective/spatio-flux.git
cd spatio-flux
uv sync
# Reproduce the whole test suite from the investigation (runs all 19 studies,
# then builds the report) and open it:
uv run python scripts/reproduce.py
open report/index.html

--only <slug> reproduces a single study. Each scenario is a study under studies/<slug>/; the investigation graph lives in investigations/spatio-flux-test-suite/investigation.yaml. To browse it interactively, serve the workbench dashboard:

vivarium-workbench serve --workspace .

The legacy spatio_flux/experiments/test_suite.py runner has been superseded by the investigation + scripts/reproduce.py.


Ecosystem

Spatio-Flux is part of Vivarium 2.0 — an open-source ecosystem for compositional modeling:

Citation

@article{agmon2025spatioflux,
  title   = {Process Bigraphs and the Architecture of Compositional Systems Biology},
  author  = {Agmon, Eran and Spangler, Daniel},
  journal = {PLoS Computational Biology},
  note    = {to appear},
  year    = {2025},
}

Metadata

Release files for spatio-flux 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spatio-flux 1.5.0
File Size Uploaded
spatio_flux-1.5.0.tar.gz 185.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spatio-flux 1.5.0
File Interpreter ABI Platform
spatio_flux-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 383.2 kB

Release files / spatio_flux-1.5.0.tar.gz

Download URL spatio_flux-1.5.0.tar.gz
Size 185.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d5d1705f4b67c34711ad7a7f6f83e191717a82a5860832a77af0cad16a4fce94
BLAKE2b-256 checksum
How to use checksums
4939d13df8d3e18d4d26f45223517df31984fe9f08ea0d638d33862a5ca6c936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / spatio_flux-1.5.0-py3-none-any.whl

Download URL spatio_flux-1.5.0-py3-none-any.whl
Size 198.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c90294664b85d99bb518d0652c407bbe9854da13cfb3412e0531618f7ef125fa
BLAKE2b-256 checksum
How to use checksums
c5165926394d725b02ed549d8c0bb289dc5256849f6dbd993c0a55da5e2d3d1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release history Release notifications | RSS feed

1.5.3

2 release files

1.5.1

2 release files

This release

1.5.0 This release

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page