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.3

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.3
File Size Uploaded
spatio_flux-1.5.3.tar.gz 65.9 MB Details

Built distribution (wheel)

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

Total release size: 112.9 MB

Release files / spatio_flux-1.5.3.tar.gz

Download URL spatio_flux-1.5.3.tar.gz
Size 65.9 MB
Tags Source
SHA-256 checksum
How to use checksums
c13729971c3f47c15225034896f3e55bccf76cdd69ff9f8b1224acccf93467f4
BLAKE2b-256 checksum
How to use checksums
995243f33705b0af3fd3b5ef3ade37035893daff18bde9e3684e2413d536a5a6
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 Oct 2, 2026.

Transparency log

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

Download URL spatio_flux-1.5.3-py3-none-any.whl
Size 47.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ac6d4d44db85aac691286e2a5fac42d8f3ab02134d34c27451bc228115bb6673
BLAKE2b-256 checksum
How to use checksums
b67f8d1a0114b1eea537c6cd7d69500f29333fff9e19821e8dea709d08cef623
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 Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.5.3 This release

2 release files

1.5.1

2 release files

1.5.0

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