# Anastomosis — code and reproduction This package contains the runnable code for the original portrait artwork and the expanded landscape. The simulation and rendering scripts are unchanged from their corresponding artwork archives. Large saved states, rendered layers, images and movies are supplied in the separate full source archives. ## Files | File | Purpose | | --- | --- | | `original/fungus.py` | Original fungal growth simulation | | `original/render_fungus.py` | Original material renderer | | `original/make_growth_record.py` | Six-stage development sheet and original movie | | `original/audit.py` | Original geometry, control and repeatability checks | | `expanded/fungus.py` | Expanded landscape simulation | | `expanded/render_landscape.py` | Landscape renderer | | `expanded/make_growth_record.py` | Landscape growth movie | | `expanded/validate.py` | Expanded selected-state checks | | `*/requirements.txt` | Exact Python dependency versions | | `*/render_parameters.json` | Selected image settings | | `*/runs/**/parameters.json` | Simulation settings | | `*/validation.json` | Recorded numerical results | ## Requirements The supplied code was run with Python 3.12 and: ```text numpy==2.3.5 scipy==1.17.0 Pillow==12.3.0 ``` FFmpeg with the `libx264` encoder must be available on your PATH to make movies. FFmpeg is not needed for the simulation, still image or development sheet. From this package's root, install the Python dependencies: ```bash python -m pip install -r original/requirements.txt ``` Both versions use the same dependency versions. An optional virtual environment can be created first with `python3 -m venv .venv`; activate it with `source .venv/bin/activate` on macOS/Linux or `.venv\Scripts\Activate.ps1` in Windows PowerShell. ## Quick route: render the supplied selected states Download and extract the matching full archive, then run commands from its inner source folder. Each full archive already includes `selected_state.npz` and its matching renderer. **Original: `Anastomosis_Source.zip`** ```bash python -m pip install -r requirements.txt python render_fungus.py selected_state.npz --out render --size 3000 --seed 831 --layers ``` Output: `render/Anastomosis.png` at 3,000 × 3,375 pixels, plus material layers. **Landscape: `Anastomosis_Expanded_Source.zip`** ```bash python -m pip install -r requirements.txt python render_landscape.py selected_state.npz --out master --size 10240 --seed 831 --layers ``` Output: `master/Anastomosis_Landscape.png` at 10,240 × 6,400 pixels, plus masks and the substrate. This is the image delivered as `Anastomosis_Expanded.png`. Use `--size 2560` for a smaller preview; native-resolution line widths vary slightly with output size. ## Rebuild the original from the code alone Run these from the `original` folder of this code package: ```bash python fungus.py --out runs/final --steps 240 --snapshot 40 --seed 217 --branch-rate 0.105 python render_fungus.py runs/final/state_0240.npz --out render --size 3000 --seed 831 --layers python make_growth_record.py --run runs/final --image render/Anastomosis.png --ground render/01_Substrate.png --out media ``` The final command creates the six-stage development sheet and the 19-second growth movie. Add `--skip-movie` to create only the sheet without FFmpeg. Add `--skip-sheet` to create only the movie. The original historical run continued to step 320; the artwork uses step 240. Stopping at 240 is sufficient to regenerate the selected state and media. ## Rebuild the landscape from the code alone Run these from the `expanded` folder: ```bash python fungus.py --out runs --steps 240 --snapshot 40 --seed 217 --branch-rate 0.105 python render_landscape.py runs/state_0240.npz --out master --size 10240 --seed 831 --layers python make_growth_record.py --state runs/state_0240.npz --image master/Anastomosis_Landscape.png --ground master/01_Substrate.png --out Anastomosis_Expanded_Growth.mp4 ``` The last command creates the 24-second landscape movie. Its artwork area is 1,920 × 1,200 pixels, with a 48-pixel caption strip beneath it. Both movies replay actual edge creation times with the selected final colour treatment held fixed. They are recorded growth replays, not live simulations. ## Selected parameters | Parameter | Original | Expanded landscape | | --- | --- | --- | | Domain in uncalibrated model units | 320 × 360 | 1,600 × 1,000 | | Nutrient grid | 400 × 450 | 2,000 × 1,250 | | Starting colonies | 6 | 72 | | Simulation seed | 217 | 217 | | Environment seed | 41 | 41 | | Base branch rate | 0.105 | 0.105 | | Selected timestep | 240 | 240 | | Rendering seed | 831 | 831 | | Uptake / transport / fusion | All enabled | All enabled | | Selected compartments | 91,136 | 1,558,898 | | Selected fusion events | 1,100 | 18,498 | The scalar branch rate is further adjusted by local nutrients, crowding and tip cooldown. It is not a constant per-tip event probability. ## Change the work - Change growth variation with `fungus.py --seed`. - Change branching tendency with `--branch-rate`. - Disable individual processes with `--no-uptake`, `--no-transport` or `--no-fusion`. - Edit colony positions and the nutrient/cavity/orientation fields in `fungus.py`. - Change material variation with the renderer's `--seed` and resolution with `--size`. - Edit pigment colours, optical widths and texture in the corresponding renderer. ## Numerical checks The full original archive contains the saved controls required by `audit.py`. Run it from that archive's source folder. The landscape archive can be checked with `python validate.py`, using its supplied `selected_state.npz` and `runs/history.json`. The recorded results are also included here as `validation.json` in each version folder. The image layers and masks are separately editable. Exact compositing is done by the renderer; stacking the layers in a normal image-editor blend mode does not reproduce all absorption, masking and grain operations.