Code, data tables and figures for the manuscript.
A generative model in which liver, kidney and pancreas grow from the same local rules: a tree whose tips hold supply, progenitors and room, and one nucleation law. Organs differ in which local resource stops their growth, and that decides which individual variation reaches their size. Paired human kidneys show how variation in a real organ divides between individuals and the sides within one.
PAPER.md lists each claim with its evidence, PAPER_NUMBERS.md holds every
model number, stamped with the version and commit that produced it, and
FIGURES.md gives the figures in manuscript order with their legends.
THEORY.md states the model formally; its section 13 records how the closed
model (src/organgrow/closed.py) was built and corrected.
Two pipelines, not one. make paper is the manuscript: closed model,
human tables, the paper's figures and PAPER_NUMBERS.md. make all builds
the earlier figures from the open engine (src/organgrow/engine.py); they are
kept for the record, are not the paper's, and should not be used to check it.
python3 -m venv .venv && source .venv/bin/activate
python3 -m pip install -r requirements.txt -r requirements-dev.txt
make test # under a minute: derivations, conservation, closed model
make check # static analysis; version and stamped numbers agree
When the model's version changes, run make paper before committing: the
regenerated PAPER_NUMBERS.md belongs in the same commit as the change, so
that no commit carries numbers from two versions and the check stays green.
make paper # the manuscript
The three heaviest steps, the elasticities, the robustness variants and the
injury experiment, run their replicates in parallel and use every core by
default. Set OGROW_JOBS to cap them, for instance OGROW_JOBS=4 make paper.
Each replicate is cached on disk, so an interrupted run resumes where it
stopped and only make clean forces the work again.
No install step is needed: make puts src on PYTHONPATH and picks up
python3 when python is not on the path. To force an interpreter, use
make all PY=/path/to/python. pip install -e . also works if you prefer it.
Python 3.10+, Linux or macOS. A full run takes a few hours on one core and
well under that on several; the vascular sweep in
scripts/11_vascular_disorder.py is the longest step that does not
parallelise.
make all runs the analyses, checks every number the figures state against
the pipeline, and writes figures/out/Fig1.pdf to Fig6.pdf.
The human cohorts are not redistributed; data/README.md gives the DOI and the
layout for each. Figures 1 to 5 need no external data; Figure 6 is skipped with
a message when the cohort is absent, and the build continues.
THEORY.md the model, formally
config/params.yaml every parameter and seed
src/organgrow/ engine, invariants, image handling, metric, style
scripts/ analyses, numbered in dependency order
figures/ one script per figure, drawn from results/ only
tests/ smoke tests (make test)
source_data/ the numbers behind every panel, one CSV per table
results/ generated intermediates
MANIFEST.md figure -> command -> seed -> input
KNOWN_LIMITATIONS.md what the work does not establish
source_data/ holds one CSV per table, named for the panels it supports, so a
reader can redraw any panel without running the engine. Regenerate with
python scripts/10_source_data.py.
scripts/09_audit.py compares every number a figure states against what the
pipeline produces and exits non-zero on any mismatch. It runs before the
figures in make all, so a caption cannot drift from the data without the
build breaking.
engine.py grows an organ in 3D from local rules: branching confined to a
signed-distance domain, unit nucleation limited by the closure mode, a second
tree that either pursues demand or runs bundled with the primary tree, and unit
growth limited by local supply.
metrics.py computes distances in invariant space. Note the caution in
THEORY.md §8: a self-normalised distance has mean square 2 (and so a mean of
at most sqrt(2)) for any exchangeable sample, and is a test, not a
measurement.
hoa_io.py, hoa_invariants.py, mask_invariants.py and qc.py load the
human cohorts, segment them, and gate the result; every rejected dataset is
recorded with its reason in results/hoa_rejected_<organ>.csv.