Skip to main content

viva-cpm

📊 Live dashboard →

Browse every investigation & study interactively, or read the published investigation reports. Auto-published from main on every merge.

A process-bigraph Cellular Potts Model framework — a fast Rust CPM engine (2D/3D, thousands of cells) with a Python layer for pluggable subcellular models, structural constraints, schema-driven world construction, and analysis metrics. A modern, composable remake of CompuCell3D built to do better in 3D, and a research workspace where CPM models are wrapped as typed processes, composed, run as studies, and graded against acceptance-criteria tests.

▶ Live viewer

Explore the demos interactively in your browser → A living 3D colonic crypt (stem cells dividing at the base, differentiating, and sloughing at the mouth), 3D cell sorting, chemotaxis, growth & division, the structural-integrity constraints, and real tissue initialized from Human Reference Atlas / MIBI-TOF imaging — each rotatable, scrubbable, and cell-inspectable.

Install

The importable engine is cpm (a compiled Rust extension) and the research package is viva_cpm_studies. Install from the repo:

# with uv (recommended)
uv pip install "viva-cpm @ git+https://github.com/vivarium-collective/viva-cpm.git"

# extras: [sbml] SBML/ODE subcellular models · [ftu] Human Reference Atlas FTU→CPM · [all] everything
uv pip install "viva-cpm[all] @ git+https://github.com/vivarium-collective/viva-cpm.git"

From source (editable, requires a Rust toolchain + maturin):

python -m venv .venv && source .venv/bin/activate
pip install maturin
maturin develop -m crates/cpm-py/Cargo.toml   # builds viva_cpm.cpm_core
pytest                                          # Python suite; `cargo test` for the Rust core

Use the engine from another project

from viva_cpm import load_world, cpm_core

spec = {
    "potts": {"dims": [50, 50, 1], "boundary": "periodic",
              "neighbor_order": 2, "temperature": 12.0, "seed": 0},
    "cells": [
        {"type": 1, "target_volume": 25, "lambda_volume": 1.0,
         "target_surface": 0, "lambda_surface": 0, "seed_block": [5, 5, 0, 13, 13, 1]},
    ],
    "contact": [{"a": 0, "b": 1, "j": 12.0}],
}
world = load_world(spec)
world.step(100)                     # run 100 Monte-Carlo sweeps
print(world.cell_volumes())

The engine itself is viva_cpm.cpm_core (a compiled Rust extension). load_world builds a world from a plain dict spec (cells or a seeded label array, contact energies, diffusion fields, connectivity, basement membrane). Chemotaxis can operate on the raw field or, via set_chemotaxis_occupancy, in receptor-occupancy space — the substrate for fold-change detection (see the recruitment investigation below).

Process-bigraph composites

Cells are wired as process-bigraph processes via import-path addresses, so any process-bigraph Composite can embed them:

  • local:!viva_cpm.processes.cpm_process.CPMProcess — the CPM step as a process
  • local:!viva_cpm.subcellular.sbml.SBMLSubcell — a per-cell SBML/ODE model (needs [sbml])
  • local:!viva_cpm.subcellular.boolean.BooleanSubcell — a per-cell Boolean fate network
  • local:!viva_cpm.subcellular.adaptive_receptor.AdaptiveReceptorSubcell — a per-cell receptor with slow adaptation

See cpm/composites/crypt.py for a full crypt-differentiation composite (CPM + SBML stemness ODE + Boolean fate switch), run with the process-bigraph Composite engine.

Research workspace: investigations & studies

workspace/ is a process-bigraph research workspace: composites in viva_cpm_studies/, studies under workspace/studies/, grouped into investigations. Each study carries a model, readouts, simulation runs, and acceptance-criteria behavior tests that grade a run into a signed pass/fail verdict. Two investigations ship today (browse them live on the dashboard):

  • glazier-graner-1993 — an 11-study reproduction of the classic Glazier–Graner differential-adhesion results (annealing, global equilibration, checkerboard, cell sorting, engulfment, position reversal, partial sorting, dispersal, vacancy nucleation).
  • chemotactic-recruitment — a secreted cue recruits responder cells, realized at three levels: a phenomenological chemotaxis-λ (baseline + inhibited + adversarial controls), a Kd-calibrated receptor-occupancy model (receptor-baseline + blocked), and an adaptive fold-change-detection refinement built by an agentic model-building loop. That loop — author a contract of tests → audit → feasibility spike → lock → build/run/evaluate → navigate — climbs an emergent mechanism ladder (static → hill_occupancy → adaptive) in which occupancy-space chemotaxis makes the fixed-kd rung collapse at high background and adaptation rescues it; the run is captured as a model_build_trajectory. The calibration tooling (viva_cpm_studies/model_building/calibrate.py) is a sensitivity screen + common-random-numbers + refine, not a hand grid.

The loop, contract, audit, and grading machinery live in viva-superpowers; this repo is one of its research workspaces.

Structural constraints

  • Connectivity (E1): forbids copy attempts that would fragment a cell or pinch off interior medium (gaps). spec["connectivity"] = {"types": [1, 2], "medium": true}.
  • Basement membrane (E3a): a basal anchor energy keeping epithelial cells in a thin band hugging a fixed membrane surface. spec["membrane"] = {"anchors": [...], "k": ..., "band": ..., "types": [...]}.

Layout

crates/            Rust workspace: cpm-core (engine) + cpm-py (pyo3 bindings → viva_cpm.cpm_core)
cpm/               Python framework: schema, processes, subcellular, composites, metrics, ftu
viva_cpm_studies/   research package: composites, model-building mechanisms + calibrate, visualizations
workspace/         the research workspace: studies/, investigations/, references/, reports/
demos/             runnable demos (each validates + exports a viewer model)
viewer/            browser 2D/3D viewer for the exported models
docs/              specs & implementation plans
tests/             Rust (cargo test) + Python (pytest) suites

License

MIT

Metadata

Release files for viva-cpm 0.1.1

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

Source distribution (sdist)

Source distribution for viva-cpm 0.1.1
File Size Uploaded
viva_cpm-0.1.1.tar.gz 58.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for viva-cpm 0.1.1
File
viva_cpm-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
viva_cpm-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
viva_cpm-0.1.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
viva_cpm-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
viva_cpm-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
viva_cpm-0.1.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 2.5 MB

Release files / viva_cpm-0.1.1.tar.gz

Download URL viva_cpm-0.1.1.tar.gz
Size 58.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0da411be60f5c66acde60a39e29e4a3fa2523e9370625c3a5eb0afc38e04679b
BLAKE2b-256 checksum
How to use checksums
349cbfbe3a926de6491ea1b38f0f16f6c7bd3c9cf7094c25b888e1acb7ea6f3a
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 29, 2026.

Transparency log

Release files / viva_cpm-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL viva_cpm-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 422.0 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d12eaee9008cdb984279740a7e9986cad5e8f723057e7678ade09204473ab5c3
BLAKE2b-256 checksum
How to use checksums
dfca402f359aa2efaa12e9b3aada9e6d1b26788ba38600673deceb950dcfe932
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 29, 2026.

Transparency log

Release files / viva_cpm-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL viva_cpm-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 416.6 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
4fbffef6ea2fa518aa2c9529b0a796135a5b500d5e10e1faafbce92be5f612c6
BLAKE2b-256 checksum
How to use checksums
7e247f5ef8011c6add0c7c9feb7363ed9b729b10cdd6bfdcef9f4a8cbb93634d
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 29, 2026.

Transparency log

Release files / viva_cpm-0.1.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL viva_cpm-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Size 360.6 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c4c54431350fb0118f4c7beae05f5af8bd3a75b616e210ef0d05cafe25c0b234
BLAKE2b-256 checksum
How to use checksums
43a2f1bee0a296e9f5792329aa1e26f3bacb1f5e8ce5d2648ad0b4363d81c2f8
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 29, 2026.

Transparency log

Release files / viva_cpm-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL viva_cpm-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 422.6 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
264773a903bbfdf17d1b168c39969901e314e078f1b4d4542003fbd7b52e62ab
BLAKE2b-256 checksum
How to use checksums
2b6ce9e47d6a7e6cca2c54fb95dc2b7a1bfa3f7fd0e06e9b1197b47ca55c5482
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 29, 2026.

Transparency log

Release files / viva_cpm-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL viva_cpm-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 417.0 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
fc3bee0378f1721fb35475781c1f1661b185475fcf2d4660a552dc86239102f2
BLAKE2b-256 checksum
How to use checksums
d6fcf1f758f066a06281ae4638a1b57e4459bdda956d2a65b7905f869d5058d1
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 29, 2026.

Transparency log

Release files / viva_cpm-0.1.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL viva_cpm-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Size 360.9 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6c4beafc97c91a571b2c74b0fcc6f2320f6dca2cf1e311de2673d681e9ba8ec0
BLAKE2b-256 checksum
How to use checksums
1795871fd5ddcd853bc0296ded02d3b13ca562f811449e442f2a21fbf839b902
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 29, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

7 release files

0.1.2

7 release files

This release

0.1.1 This release

7 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