viva-cpm 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. viva_cpm-0.1.1/Cargo.lock +331 -0
  2. viva_cpm-0.1.1/Cargo.toml +12 -0
  3. viva_cpm-0.1.1/LICENSE +21 -0
  4. viva_cpm-0.1.1/PKG-INFO +164 -0
  5. viva_cpm-0.1.1/README.md +123 -0
  6. viva_cpm-0.1.1/crates/cpm-core/Cargo.toml +13 -0
  7. viva_cpm-0.1.1/crates/cpm-core/src/connectivity.rs +62 -0
  8. viva_cpm-0.1.1/crates/cpm-core/src/energy.rs +123 -0
  9. viva_cpm-0.1.1/crates/cpm-core/src/external.rs +89 -0
  10. viva_cpm-0.1.1/crates/cpm-core/src/field.rs +388 -0
  11. viva_cpm-0.1.1/crates/cpm-core/src/init.rs +110 -0
  12. viva_cpm-0.1.1/crates/cpm-core/src/junction.rs +76 -0
  13. viva_cpm-0.1.1/crates/cpm-core/src/lattice.rs +216 -0
  14. viva_cpm-0.1.1/crates/cpm-core/src/length.rs +182 -0
  15. viva_cpm-0.1.1/crates/cpm-core/src/lib.rs +25 -0
  16. viva_cpm-0.1.1/crates/cpm-core/src/membrane.rs +119 -0
  17. viva_cpm-0.1.1/crates/cpm-core/src/mitosis.rs +204 -0
  18. viva_cpm-0.1.1/crates/cpm-core/src/parallel.rs +285 -0
  19. viva_cpm-0.1.1/crates/cpm-core/src/sweep.rs +125 -0
  20. viva_cpm-0.1.1/crates/cpm-core/src/world.rs +570 -0
  21. viva_cpm-0.1.1/crates/cpm-core/tests/contact_area.rs +87 -0
  22. viva_cpm-0.1.1/crates/cpm-core/tests/field_scale.rs +92 -0
  23. viva_cpm-0.1.1/crates/cpm-core/tests/junction.rs +95 -0
  24. viva_cpm-0.1.1/crates/cpm-core/tests/membrane.rs +64 -0
  25. viva_cpm-0.1.1/crates/cpm-core/tests/property.rs +158 -0
  26. viva_cpm-0.1.1/crates/cpm-core/tests/remove.rs +26 -0
  27. viva_cpm-0.1.1/crates/cpm-py/Cargo.toml +12 -0
  28. viva_cpm-0.1.1/crates/cpm-py/src/lib.rs +285 -0
  29. viva_cpm-0.1.1/pyproject.toml +69 -0
  30. viva_cpm-0.1.1/viva_cpm/__init__.py +21 -0
  31. viva_cpm-0.1.1/viva_cpm/composites/__init__.py +0 -0
  32. viva_cpm-0.1.1/viva_cpm/composites/crypt.py +151 -0
  33. viva_cpm-0.1.1/viva_cpm/coupling.py +52 -0
  34. viva_cpm-0.1.1/viva_cpm/crypt3d.py +167 -0
  35. viva_cpm-0.1.1/viva_cpm/ftu.py +120 -0
  36. viva_cpm-0.1.1/viva_cpm/metrics.py +244 -0
  37. viva_cpm-0.1.1/viva_cpm/pack.py +15 -0
  38. viva_cpm-0.1.1/viva_cpm/processes/__init__.py +0 -0
  39. viva_cpm-0.1.1/viva_cpm/processes/cpm_process.py +95 -0
  40. viva_cpm-0.1.1/viva_cpm/schema.py +98 -0
  41. viva_cpm-0.1.1/viva_cpm/subcellular/__init__.py +0 -0
  42. viva_cpm-0.1.1/viva_cpm/subcellular/adaptive_receptor.py +66 -0
  43. viva_cpm-0.1.1/viva_cpm/subcellular/boolean.py +32 -0
  44. viva_cpm-0.1.1/viva_cpm/subcellular/receptor.py +49 -0
  45. viva_cpm-0.1.1/viva_cpm/subcellular/sbml.py +32 -0
@@ -0,0 +1,331 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "cfg-if"
13
+ version = "1.0.4"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
16
+
17
+ [[package]]
18
+ name = "cpm-bench"
19
+ version = "0.1.0"
20
+ dependencies = [
21
+ "cpm-core",
22
+ "rayon",
23
+ ]
24
+
25
+ [[package]]
26
+ name = "cpm-core"
27
+ version = "0.1.0"
28
+ dependencies = [
29
+ "rand",
30
+ "rayon",
31
+ "smallvec",
32
+ ]
33
+
34
+ [[package]]
35
+ name = "cpm-py"
36
+ version = "0.1.0"
37
+ dependencies = [
38
+ "cpm-core",
39
+ "pyo3",
40
+ ]
41
+
42
+ [[package]]
43
+ name = "crossbeam-deque"
44
+ version = "0.8.6"
45
+ source = "registry+https://github.com/rust-lang/crates.io-index"
46
+ checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
47
+ dependencies = [
48
+ "crossbeam-epoch",
49
+ "crossbeam-utils",
50
+ ]
51
+
52
+ [[package]]
53
+ name = "crossbeam-epoch"
54
+ version = "0.9.18"
55
+ source = "registry+https://github.com/rust-lang/crates.io-index"
56
+ checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
57
+ dependencies = [
58
+ "crossbeam-utils",
59
+ ]
60
+
61
+ [[package]]
62
+ name = "crossbeam-utils"
63
+ version = "0.8.21"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
66
+
67
+ [[package]]
68
+ name = "either"
69
+ version = "1.16.0"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
72
+
73
+ [[package]]
74
+ name = "getrandom"
75
+ version = "0.2.17"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
78
+ dependencies = [
79
+ "cfg-if",
80
+ "libc",
81
+ "wasi",
82
+ ]
83
+
84
+ [[package]]
85
+ name = "heck"
86
+ version = "0.5.0"
87
+ source = "registry+https://github.com/rust-lang/crates.io-index"
88
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
89
+
90
+ [[package]]
91
+ name = "indoc"
92
+ version = "2.0.7"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
95
+ dependencies = [
96
+ "rustversion",
97
+ ]
98
+
99
+ [[package]]
100
+ name = "libc"
101
+ version = "0.2.186"
102
+ source = "registry+https://github.com/rust-lang/crates.io-index"
103
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
104
+
105
+ [[package]]
106
+ name = "memoffset"
107
+ version = "0.9.1"
108
+ source = "registry+https://github.com/rust-lang/crates.io-index"
109
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
110
+ dependencies = [
111
+ "autocfg",
112
+ ]
113
+
114
+ [[package]]
115
+ name = "once_cell"
116
+ version = "1.21.4"
117
+ source = "registry+https://github.com/rust-lang/crates.io-index"
118
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
119
+
120
+ [[package]]
121
+ name = "portable-atomic"
122
+ version = "1.13.1"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
125
+
126
+ [[package]]
127
+ name = "ppv-lite86"
128
+ version = "0.2.21"
129
+ source = "registry+https://github.com/rust-lang/crates.io-index"
130
+ checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
131
+ dependencies = [
132
+ "zerocopy",
133
+ ]
134
+
135
+ [[package]]
136
+ name = "proc-macro2"
137
+ version = "1.0.106"
138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
139
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
140
+ dependencies = [
141
+ "unicode-ident",
142
+ ]
143
+
144
+ [[package]]
145
+ name = "pyo3"
146
+ version = "0.22.6"
147
+ source = "registry+https://github.com/rust-lang/crates.io-index"
148
+ checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
149
+ dependencies = [
150
+ "cfg-if",
151
+ "indoc",
152
+ "libc",
153
+ "memoffset",
154
+ "once_cell",
155
+ "portable-atomic",
156
+ "pyo3-build-config",
157
+ "pyo3-ffi",
158
+ "pyo3-macros",
159
+ "unindent",
160
+ ]
161
+
162
+ [[package]]
163
+ name = "pyo3-build-config"
164
+ version = "0.22.6"
165
+ source = "registry+https://github.com/rust-lang/crates.io-index"
166
+ checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
167
+ dependencies = [
168
+ "once_cell",
169
+ "target-lexicon",
170
+ ]
171
+
172
+ [[package]]
173
+ name = "pyo3-ffi"
174
+ version = "0.22.6"
175
+ source = "registry+https://github.com/rust-lang/crates.io-index"
176
+ checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
177
+ dependencies = [
178
+ "libc",
179
+ "pyo3-build-config",
180
+ ]
181
+
182
+ [[package]]
183
+ name = "pyo3-macros"
184
+ version = "0.22.6"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
187
+ dependencies = [
188
+ "proc-macro2",
189
+ "pyo3-macros-backend",
190
+ "quote",
191
+ "syn",
192
+ ]
193
+
194
+ [[package]]
195
+ name = "pyo3-macros-backend"
196
+ version = "0.22.6"
197
+ source = "registry+https://github.com/rust-lang/crates.io-index"
198
+ checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
199
+ dependencies = [
200
+ "heck",
201
+ "proc-macro2",
202
+ "pyo3-build-config",
203
+ "quote",
204
+ "syn",
205
+ ]
206
+
207
+ [[package]]
208
+ name = "quote"
209
+ version = "1.0.46"
210
+ source = "registry+https://github.com/rust-lang/crates.io-index"
211
+ checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
212
+ dependencies = [
213
+ "proc-macro2",
214
+ ]
215
+
216
+ [[package]]
217
+ name = "rand"
218
+ version = "0.8.6"
219
+ source = "registry+https://github.com/rust-lang/crates.io-index"
220
+ checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
221
+ dependencies = [
222
+ "libc",
223
+ "rand_chacha",
224
+ "rand_core",
225
+ ]
226
+
227
+ [[package]]
228
+ name = "rand_chacha"
229
+ version = "0.3.1"
230
+ source = "registry+https://github.com/rust-lang/crates.io-index"
231
+ checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
232
+ dependencies = [
233
+ "ppv-lite86",
234
+ "rand_core",
235
+ ]
236
+
237
+ [[package]]
238
+ name = "rand_core"
239
+ version = "0.6.4"
240
+ source = "registry+https://github.com/rust-lang/crates.io-index"
241
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
242
+ dependencies = [
243
+ "getrandom",
244
+ ]
245
+
246
+ [[package]]
247
+ name = "rayon"
248
+ version = "1.12.0"
249
+ source = "registry+https://github.com/rust-lang/crates.io-index"
250
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
251
+ dependencies = [
252
+ "either",
253
+ "rayon-core",
254
+ ]
255
+
256
+ [[package]]
257
+ name = "rayon-core"
258
+ version = "1.13.0"
259
+ source = "registry+https://github.com/rust-lang/crates.io-index"
260
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
261
+ dependencies = [
262
+ "crossbeam-deque",
263
+ "crossbeam-utils",
264
+ ]
265
+
266
+ [[package]]
267
+ name = "rustversion"
268
+ version = "1.0.22"
269
+ source = "registry+https://github.com/rust-lang/crates.io-index"
270
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
271
+
272
+ [[package]]
273
+ name = "smallvec"
274
+ version = "1.15.2"
275
+ source = "registry+https://github.com/rust-lang/crates.io-index"
276
+ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
277
+
278
+ [[package]]
279
+ name = "syn"
280
+ version = "2.0.118"
281
+ source = "registry+https://github.com/rust-lang/crates.io-index"
282
+ checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
283
+ dependencies = [
284
+ "proc-macro2",
285
+ "quote",
286
+ "unicode-ident",
287
+ ]
288
+
289
+ [[package]]
290
+ name = "target-lexicon"
291
+ version = "0.12.16"
292
+ source = "registry+https://github.com/rust-lang/crates.io-index"
293
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
294
+
295
+ [[package]]
296
+ name = "unicode-ident"
297
+ version = "1.0.24"
298
+ source = "registry+https://github.com/rust-lang/crates.io-index"
299
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
300
+
301
+ [[package]]
302
+ name = "unindent"
303
+ version = "0.2.4"
304
+ source = "registry+https://github.com/rust-lang/crates.io-index"
305
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
306
+
307
+ [[package]]
308
+ name = "wasi"
309
+ version = "0.11.1+wasi-snapshot-preview1"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
312
+
313
+ [[package]]
314
+ name = "zerocopy"
315
+ version = "0.8.52"
316
+ source = "registry+https://github.com/rust-lang/crates.io-index"
317
+ checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f"
318
+ dependencies = [
319
+ "zerocopy-derive",
320
+ ]
321
+
322
+ [[package]]
323
+ name = "zerocopy-derive"
324
+ version = "0.8.52"
325
+ source = "registry+https://github.com/rust-lang/crates.io-index"
326
+ checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930"
327
+ dependencies = [
328
+ "proc-macro2",
329
+ "quote",
330
+ "syn",
331
+ ]
@@ -0,0 +1,12 @@
1
+ [workspace]
2
+ resolver = "2"
3
+ members = ["crates/cpm-core", "crates/cpm-py"]
4
+
5
+ [workspace.package]
6
+ version = "0.1.0"
7
+ edition = "2021"
8
+ license = "Apache-2.0"
9
+
10
+ [workspace.dependencies]
11
+ cpm-core = { path = "crates/cpm-core" }
12
+ rand = "0.8"
viva_cpm-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vivarium Collective
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.4
2
+ Name: viva-cpm
3
+ Version: 0.1.1
4
+ Classifier: Programming Language :: Python :: 3
5
+ Classifier: Programming Language :: Rust
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Intended Audience :: Science/Research
8
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
9
+ Requires-Dist: process-bigraph>=1.8.3
10
+ Requires-Dist: bigraph-schema>=1.4.4
11
+ Requires-Dist: bigraph-viz>=2.0.3
12
+ Requires-Dist: pyyaml>=6.0
13
+ Requires-Dist: jsonschema[format-nongpl]>=4.21
14
+ Requires-Dist: jinja2>=3.1
15
+ Requires-Dist: pypdf>=4.0
16
+ Requires-Dist: matplotlib
17
+ Requires-Dist: plotly
18
+ Requires-Dist: vivarium-workbench
19
+ Requires-Dist: viva-cpm[sbml,ftu] ; extra == 'all'
20
+ Requires-Dist: pytest>=7 ; extra == 'dev'
21
+ Requires-Dist: viva-cpm[sbml,ftu] ; extra == 'dev'
22
+ Requires-Dist: numpy ; extra == 'ftu'
23
+ Requires-Dist: matplotlib ; extra == 'ftu'
24
+ Requires-Dist: libroadrunner>=2.9 ; extra == 'sbml'
25
+ Requires-Dist: tellurium>=2.2 ; extra == 'sbml'
26
+ Requires-Dist: viva-tellurium ; extra == 'sbml'
27
+ Provides-Extra: all
28
+ Provides-Extra: dev
29
+ Provides-Extra: ftu
30
+ Provides-Extra: sbml
31
+ License-File: LICENSE
32
+ Summary: A process-bigraph Cellular Potts Model framework: a fast Rust CPM engine (2D/3D) with pluggable subcellular models, structural constraints, and metrics.
33
+ Keywords: cellular-potts-model,process-bigraph,multiscale,tissue,vivarium
34
+ Author: Vivarium Collective
35
+ License: MIT
36
+ Requires-Python: >=3.12
37
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
38
+ Project-URL: Homepage, https://github.com/vivarium-collective/viva-cpm
39
+ Project-URL: Repository, https://github.com/vivarium-collective/viva-cpm
40
+
41
+ # viva-cpm
42
+
43
+ <!-- BEGIN dashboard -->
44
+ > ## πŸ“Š [**Live dashboard β†’**](https://vivarium-collective.github.io/viva-cpm/dashboard/)
45
+ > Browse every investigation & study interactively, or read the [published investigation reports](https://vivarium-collective.github.io/viva-cpm/). Auto-published from `main` on every merge.
46
+ <!-- END dashboard -->
47
+
48
+ A [process-bigraph](https://github.com/vivarium-collective/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.
49
+
50
+ ## β–Ά Live viewer
51
+
52
+ **[Explore the demos interactively in your browser β†’](https://vivarium-collective.github.io/viva-cpm/dashboard/)**
53
+ 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.
54
+
55
+ ## Install
56
+
57
+ The importable engine is `cpm` (a compiled Rust extension) and the research package is `viva_cpm_studies`. Install from the repo:
58
+
59
+ ```bash
60
+ # with uv (recommended)
61
+ uv pip install "viva-cpm @ git+https://github.com/vivarium-collective/viva-cpm.git"
62
+
63
+ # extras: [sbml] SBML/ODE subcellular models · [ftu] Human Reference Atlas FTU→CPM · [all] everything
64
+ uv pip install "viva-cpm[all] @ git+https://github.com/vivarium-collective/viva-cpm.git"
65
+ ```
66
+
67
+ From source (editable, requires a Rust toolchain + [maturin](https://www.maturin.rs)):
68
+
69
+ ```bash
70
+ python -m venv .venv && source .venv/bin/activate
71
+ pip install maturin
72
+ maturin develop -m crates/cpm-py/Cargo.toml # builds viva_cpm.cpm_core
73
+ pytest # Python suite; `cargo test` for the Rust core
74
+ ```
75
+
76
+ ## Use the engine from another project
77
+
78
+ ```python
79
+ from viva_cpm import load_world, cpm_core
80
+
81
+ spec = {
82
+ "potts": {"dims": [50, 50, 1], "boundary": "periodic",
83
+ "neighbor_order": 2, "temperature": 12.0, "seed": 0},
84
+ "cells": [
85
+ {"type": 1, "target_volume": 25, "lambda_volume": 1.0,
86
+ "target_surface": 0, "lambda_surface": 0, "seed_block": [5, 5, 0, 13, 13, 1]},
87
+ ],
88
+ "contact": [{"a": 0, "b": 1, "j": 12.0}],
89
+ }
90
+ world = load_world(spec)
91
+ world.step(100) # run 100 Monte-Carlo sweeps
92
+ print(world.cell_volumes())
93
+ ```
94
+
95
+ The engine itself is `viva_cpm.cpm_core` (a compiled Rust extension). `load_world` builds a
96
+ world from a plain dict spec (cells or a seeded label array, contact energies, diffusion
97
+ fields, connectivity, basement membrane). Chemotaxis can operate on the raw field or, via
98
+ `set_chemotaxis_occupancy`, in receptor-**occupancy** space β€” the substrate for fold-change
99
+ detection (see the recruitment investigation below).
100
+
101
+ ## Process-bigraph composites
102
+
103
+ Cells are wired as process-bigraph processes via import-path addresses, so any
104
+ process-bigraph `Composite` can embed them:
105
+
106
+ - `local:!viva_cpm.processes.cpm_process.CPMProcess` β€” the CPM step as a process
107
+ - `local:!viva_cpm.subcellular.sbml.SBMLSubcell` β€” a per-cell SBML/ODE model (needs `[sbml]`)
108
+ - `local:!viva_cpm.subcellular.boolean.BooleanSubcell` β€” a per-cell Boolean fate network
109
+ - `local:!viva_cpm.subcellular.adaptive_receptor.AdaptiveReceptorSubcell` β€” a per-cell receptor with slow adaptation
110
+
111
+ See `cpm/composites/crypt.py` for a full crypt-differentiation composite (CPM + SBML
112
+ stemness ODE + Boolean fate switch), run with the process-bigraph `Composite` engine.
113
+
114
+ ## Research workspace: investigations & studies
115
+
116
+ `workspace/` is a process-bigraph research workspace: composites in `viva_cpm_studies/`,
117
+ studies under `workspace/studies/`, grouped into **investigations**. Each study carries a
118
+ model, readouts, simulation runs, and acceptance-criteria **behavior tests** that grade a
119
+ run into a signed pass/fail verdict. Two investigations ship today (browse them live on the
120
+ [dashboard](https://vivarium-collective.github.io/viva-cpm/dashboard/)):
121
+
122
+ - **glazier-graner-1993** β€” an 11-study reproduction of the classic Glazier–Graner
123
+ differential-adhesion results (annealing, global equilibration, checkerboard, cell
124
+ sorting, engulfment, position reversal, partial sorting, dispersal, vacancy nucleation).
125
+ - **chemotactic-recruitment** β€” a secreted cue recruits responder cells, realized at three
126
+ levels: a phenomenological chemotaxis-Ξ» (baseline + inhibited + adversarial controls), a
127
+ Kd-calibrated receptor-occupancy model (receptor-baseline + blocked), and an **adaptive**
128
+ fold-change-detection refinement built by an agentic model-building loop. That loop β€”
129
+ author a contract of tests β†’ audit β†’ feasibility spike β†’ lock β†’ build/run/evaluate β†’
130
+ navigate β€” climbs an emergent mechanism ladder (`static β†’ hill_occupancy β†’ adaptive`) in
131
+ which occupancy-space chemotaxis makes the fixed-`kd` rung collapse at high background and
132
+ adaptation rescues it; the run is captured as a `model_build_trajectory`. The
133
+ calibration tooling (`viva_cpm_studies/model_building/calibrate.py`) is a sensitivity
134
+ screen + common-random-numbers + refine, not a hand grid.
135
+
136
+ The loop, contract, audit, and grading machinery live in
137
+ [viva-superpowers](https://github.com/vivarium-collective/viva-superpowers); this repo is one
138
+ of its research workspaces.
139
+
140
+ ## Structural constraints
141
+
142
+ - **Connectivity** (E1): forbids copy attempts that would fragment a cell or pinch off
143
+ interior medium (gaps). `spec["connectivity"] = {"types": [1, 2], "medium": true}`.
144
+ - **Basement membrane** (E3a): a basal anchor energy keeping epithelial cells in a thin
145
+ band hugging a fixed membrane surface. `spec["membrane"] = {"anchors": [...], "k": ...,
146
+ "band": ..., "types": [...]}`.
147
+
148
+ ## Layout
149
+
150
+ ```
151
+ crates/ Rust workspace: cpm-core (engine) + cpm-py (pyo3 bindings β†’ viva_cpm.cpm_core)
152
+ cpm/ Python framework: schema, processes, subcellular, composites, metrics, ftu
153
+ viva_cpm_studies/ research package: composites, model-building mechanisms + calibrate, visualizations
154
+ workspace/ the research workspace: studies/, investigations/, references/, reports/
155
+ demos/ runnable demos (each validates + exports a viewer model)
156
+ viewer/ browser 2D/3D viewer for the exported models
157
+ docs/ specs & implementation plans
158
+ tests/ Rust (cargo test) + Python (pytest) suites
159
+ ```
160
+
161
+ ## License
162
+
163
+ MIT
164
+
@@ -0,0 +1,123 @@
1
+ # viva-cpm
2
+
3
+ <!-- BEGIN dashboard -->
4
+ > ## πŸ“Š [**Live dashboard β†’**](https://vivarium-collective.github.io/viva-cpm/dashboard/)
5
+ > Browse every investigation & study interactively, or read the [published investigation reports](https://vivarium-collective.github.io/viva-cpm/). Auto-published from `main` on every merge.
6
+ <!-- END dashboard -->
7
+
8
+ A [process-bigraph](https://github.com/vivarium-collective/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.
9
+
10
+ ## β–Ά Live viewer
11
+
12
+ **[Explore the demos interactively in your browser β†’](https://vivarium-collective.github.io/viva-cpm/dashboard/)**
13
+ 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.
14
+
15
+ ## Install
16
+
17
+ The importable engine is `cpm` (a compiled Rust extension) and the research package is `viva_cpm_studies`. Install from the repo:
18
+
19
+ ```bash
20
+ # with uv (recommended)
21
+ uv pip install "viva-cpm @ git+https://github.com/vivarium-collective/viva-cpm.git"
22
+
23
+ # extras: [sbml] SBML/ODE subcellular models · [ftu] Human Reference Atlas FTU→CPM · [all] everything
24
+ uv pip install "viva-cpm[all] @ git+https://github.com/vivarium-collective/viva-cpm.git"
25
+ ```
26
+
27
+ From source (editable, requires a Rust toolchain + [maturin](https://www.maturin.rs)):
28
+
29
+ ```bash
30
+ python -m venv .venv && source .venv/bin/activate
31
+ pip install maturin
32
+ maturin develop -m crates/cpm-py/Cargo.toml # builds viva_cpm.cpm_core
33
+ pytest # Python suite; `cargo test` for the Rust core
34
+ ```
35
+
36
+ ## Use the engine from another project
37
+
38
+ ```python
39
+ from viva_cpm import load_world, cpm_core
40
+
41
+ spec = {
42
+ "potts": {"dims": [50, 50, 1], "boundary": "periodic",
43
+ "neighbor_order": 2, "temperature": 12.0, "seed": 0},
44
+ "cells": [
45
+ {"type": 1, "target_volume": 25, "lambda_volume": 1.0,
46
+ "target_surface": 0, "lambda_surface": 0, "seed_block": [5, 5, 0, 13, 13, 1]},
47
+ ],
48
+ "contact": [{"a": 0, "b": 1, "j": 12.0}],
49
+ }
50
+ world = load_world(spec)
51
+ world.step(100) # run 100 Monte-Carlo sweeps
52
+ print(world.cell_volumes())
53
+ ```
54
+
55
+ The engine itself is `viva_cpm.cpm_core` (a compiled Rust extension). `load_world` builds a
56
+ world from a plain dict spec (cells or a seeded label array, contact energies, diffusion
57
+ fields, connectivity, basement membrane). Chemotaxis can operate on the raw field or, via
58
+ `set_chemotaxis_occupancy`, in receptor-**occupancy** space β€” the substrate for fold-change
59
+ detection (see the recruitment investigation below).
60
+
61
+ ## Process-bigraph composites
62
+
63
+ Cells are wired as process-bigraph processes via import-path addresses, so any
64
+ process-bigraph `Composite` can embed them:
65
+
66
+ - `local:!viva_cpm.processes.cpm_process.CPMProcess` β€” the CPM step as a process
67
+ - `local:!viva_cpm.subcellular.sbml.SBMLSubcell` β€” a per-cell SBML/ODE model (needs `[sbml]`)
68
+ - `local:!viva_cpm.subcellular.boolean.BooleanSubcell` β€” a per-cell Boolean fate network
69
+ - `local:!viva_cpm.subcellular.adaptive_receptor.AdaptiveReceptorSubcell` β€” a per-cell receptor with slow adaptation
70
+
71
+ See `cpm/composites/crypt.py` for a full crypt-differentiation composite (CPM + SBML
72
+ stemness ODE + Boolean fate switch), run with the process-bigraph `Composite` engine.
73
+
74
+ ## Research workspace: investigations & studies
75
+
76
+ `workspace/` is a process-bigraph research workspace: composites in `viva_cpm_studies/`,
77
+ studies under `workspace/studies/`, grouped into **investigations**. Each study carries a
78
+ model, readouts, simulation runs, and acceptance-criteria **behavior tests** that grade a
79
+ run into a signed pass/fail verdict. Two investigations ship today (browse them live on the
80
+ [dashboard](https://vivarium-collective.github.io/viva-cpm/dashboard/)):
81
+
82
+ - **glazier-graner-1993** β€” an 11-study reproduction of the classic Glazier–Graner
83
+ differential-adhesion results (annealing, global equilibration, checkerboard, cell
84
+ sorting, engulfment, position reversal, partial sorting, dispersal, vacancy nucleation).
85
+ - **chemotactic-recruitment** β€” a secreted cue recruits responder cells, realized at three
86
+ levels: a phenomenological chemotaxis-Ξ» (baseline + inhibited + adversarial controls), a
87
+ Kd-calibrated receptor-occupancy model (receptor-baseline + blocked), and an **adaptive**
88
+ fold-change-detection refinement built by an agentic model-building loop. That loop β€”
89
+ author a contract of tests β†’ audit β†’ feasibility spike β†’ lock β†’ build/run/evaluate β†’
90
+ navigate β€” climbs an emergent mechanism ladder (`static β†’ hill_occupancy β†’ adaptive`) in
91
+ which occupancy-space chemotaxis makes the fixed-`kd` rung collapse at high background and
92
+ adaptation rescues it; the run is captured as a `model_build_trajectory`. The
93
+ calibration tooling (`viva_cpm_studies/model_building/calibrate.py`) is a sensitivity
94
+ screen + common-random-numbers + refine, not a hand grid.
95
+
96
+ The loop, contract, audit, and grading machinery live in
97
+ [viva-superpowers](https://github.com/vivarium-collective/viva-superpowers); this repo is one
98
+ of its research workspaces.
99
+
100
+ ## Structural constraints
101
+
102
+ - **Connectivity** (E1): forbids copy attempts that would fragment a cell or pinch off
103
+ interior medium (gaps). `spec["connectivity"] = {"types": [1, 2], "medium": true}`.
104
+ - **Basement membrane** (E3a): a basal anchor energy keeping epithelial cells in a thin
105
+ band hugging a fixed membrane surface. `spec["membrane"] = {"anchors": [...], "k": ...,
106
+ "band": ..., "types": [...]}`.
107
+
108
+ ## Layout
109
+
110
+ ```
111
+ crates/ Rust workspace: cpm-core (engine) + cpm-py (pyo3 bindings β†’ viva_cpm.cpm_core)
112
+ cpm/ Python framework: schema, processes, subcellular, composites, metrics, ftu
113
+ viva_cpm_studies/ research package: composites, model-building mechanisms + calibrate, visualizations
114
+ workspace/ the research workspace: studies/, investigations/, references/, reports/
115
+ demos/ runnable demos (each validates + exports a viewer model)
116
+ viewer/ browser 2D/3D viewer for the exported models
117
+ docs/ specs & implementation plans
118
+ tests/ Rust (cargo test) + Python (pytest) suites
119
+ ```
120
+
121
+ ## License
122
+
123
+ MIT
@@ -0,0 +1,13 @@
1
+ [package]
2
+ name = "cpm-core"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+
7
+ [lib]
8
+ name = "cpm_core"
9
+
10
+ [dependencies]
11
+ rand = { workspace = true, features = ["small_rng"] }
12
+ smallvec = "1"
13
+ rayon = "1"