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

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.2
File Size Uploaded
viva_cpm-0.1.2.tar.gz 58.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for viva-cpm 0.1.2
File
viva_cpm-0.1.2-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.2-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.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
viva_cpm-0.1.2-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.2-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.2-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.2.tar.gz

Download URL viva_cpm-0.1.2.tar.gz
Size 58.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6ff6d412973497dbed2697bde5da09b195b3225628c4340a26da4dbe1c8980eb
BLAKE2b-256 checksum
How to use checksums
da3cb64756fb07600578838a73cb7bac0a3f4d843410e6f1cef4f7f2d720cea6
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.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL viva_cpm-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 422.7 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3294fe4eff9b3b030d87ea24f7d132ac73e2e53af8d12abb90788553df277af2
BLAKE2b-256 checksum
How to use checksums
795d769c9a3dcfee4add29932c9df7d3de61b8e95b7565849016c1e39ed1d5fa
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.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL viva_cpm-0.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 417.4 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
374a96c48941f470a6ce8798d579bac0c9f4fdb59b7bf7227a7281d38a2f06b9
BLAKE2b-256 checksum
How to use checksums
712683d35139ea312208499f8c7d88236083ea16c5b93eecb13ecc71e07fb6ed
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.2-cp313-cp313-macosx_11_0_arm64.whl

Download URL viva_cpm-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Size 361.3 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
79d7f423fdc836f1dc9889495226b2792e4c0886601ee5acedb492f081f7c37c
BLAKE2b-256 checksum
How to use checksums
71c8ee740c6dbfc96cb7900ea2ba24164cadcd9ff0cb22e80d93555a5ed688c3
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.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL viva_cpm-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 423.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
37fe9bf5f7aeae0360d80839edcdc536f2143694fd55c93792991739c0fce21c
BLAKE2b-256 checksum
How to use checksums
790f75f664894c764c437c450e06be84be5cc99e349561e298cf7544b4b084d6
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.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL viva_cpm-0.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 417.7 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
3b0e49aa68e71706597f4febb2b1d7f590139fbf4a317c17da76b0f6f8bf4439
BLAKE2b-256 checksum
How to use checksums
f13e1ba8faf0676d2cdd95b16939dc729006bb4d6f4469dfc5f3aa457d62b88f
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.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL viva_cpm-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Size 361.6 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8bd7c9b35ff9df1e8fc56e185075fdfb2ce5c006d46e78a6405ef3459a357c98
BLAKE2b-256 checksum
How to use checksums
af09e8b0c21546cb0d5b9e67a3b1c29ac99d23f92df2fbcb2a41a4818e73b4a5
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

This release

0.1.2 This release

7 release files

0.1.1

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