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.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 viva-cpm 0.1.3
File Size Uploaded
viva_cpm-0.1.3.tar.gz 22.9 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for viva-cpm 0.1.3
File
viva_cpm-0.1.3-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.3-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.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
viva_cpm-0.1.3-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.3-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.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 162.2 MB

Release files / viva_cpm-0.1.3.tar.gz

Download URL viva_cpm-0.1.3.tar.gz
Size 22.9 MB
Tags Source
SHA-256 checksum
How to use checksums
bec2d7299d4eabf26a0b979533e6c74eb7bdea72dd35e8489a6d41e483e7a158
BLAKE2b-256 checksum
How to use checksums
94e2a828687b67953a4333b46c31f077bf9881d338f72768b8dc2844998865df
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 / viva_cpm-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL viva_cpm-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 23.2 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ff30054afacf7d185d2afc3ad63d0dd0eb00641a9af25f5da084e1c1401c9a5b
BLAKE2b-256 checksum
How to use checksums
1b0b337dc7059f1297442c129cd05224985898c8b871d1ec6dca28c4b5333272
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 / viva_cpm-0.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL viva_cpm-0.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 23.2 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
0f61df34455fd9bca861ced3dcc2895146f096c9c6c1fe5fe1ffda4c39c2945e
BLAKE2b-256 checksum
How to use checksums
e49ef5b78d6620cea3c78722da075f232584f324420a2952e8e8efd9e1ba4c67
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 / viva_cpm-0.1.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL viva_cpm-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Size 23.2 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
87bed5b71f6943652dd08fc8073738b95e1509b84be1b67de91c9473af56251f
BLAKE2b-256 checksum
How to use checksums
d2aaf0e615ad49ee805dd1b28cb9badfb3f5ba0685e6089902d1485840ae842b
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 / viva_cpm-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL viva_cpm-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 23.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
12dbceb0b6ce3857d115bb8f4509e30fb0d49fc8b935b84adfb2dae70430971a
BLAKE2b-256 checksum
How to use checksums
a26a154be43e43ae3c25b208072e6f02e3aac1e238f5aee99a67a98b5a0f8f96
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 / viva_cpm-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL viva_cpm-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 23.2 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
a3d6693a6c57309652b135ea050dc10ab0609f4aeece13f768a5a8ed835bb6e0
BLAKE2b-256 checksum
How to use checksums
51edf9a73631f98241c311b32ea72d5c46161ab57a329cb4bcfaf6e46a5a5a75
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 / viva_cpm-0.1.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL viva_cpm-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Size 23.2 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bdffc3ead794d22a8332e008deb3252ccd95fa4c70ad7474114402507edfabf6
BLAKE2b-256 checksum
How to use checksums
01af1f560394867bd5543b2bad5ac5436ded136cb4628eeffd6ae7fefa4770ce
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

0.1.3 This release

7 release files

0.1.2

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