Skip to content

v0.10.1: name the two plane memory figures apart; say why links out of the experiment are refused - #624

Merged
guijacquemet merged 1 commit into
integration/v0.10.1from
fix/symlink-and-plane-memory
Dec 4, 2026
Merged

guijacquemet merged 1 commit into
integration/v0.10.1from
fix/symlink-and-plane-memory

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Two preprocessing points from the owner's run of the formin OME-Zarr mosaic on 4 December 2026 (30720 x 36864, 3 channels, uint16, chunks 1 x 1024 x 1024, 5.1 GB), through preprocessing and then fiberfeatures' windowed route. This PR targets integration/v0.10.1, not main. If that branch moves before review, this PR may need a rebase.

Summary

  • planes.py, plane_channels.py, notebook_run_plan.py: the two memory figures now have different names. run warned "would need up to 38.0 GiB"; xyc_plane_memory said 14.8 GiB. Both numbers are right but measure different things:
    • The run's figure (PlaneLayout.memory_estimate) is one channel read whole and measured: 2.1 GiB of chunks + 2.1 GiB for the plane + 33.8 GiB of histogram working arrays + about 40 MiB of image QC sums. The histogram part is normalization's upper estimate: 4 int64 arrays per pixel, 32 bytes per pixel for an integer plane. The run doesn't actually need this much, because it reads in blocks of about 1 GiB.
    • xyc_plane_memory (the limit RunInputs.read_plane enforces) is the pixels of all three channels in one (C, Y, X) array, with no histogram: 4 planes + 3 copies of the chunks + 2 MiB.
    • No number changes. What changes is the wording:
      • planes_read_in_blocks now says: "too large to measure whole ...: one channel and its histogram would need up to ...", and adds that reading all channels without a histogram needs another amount.
      • The notebook's run plan says the same.
      • read_plane's PlaneMemoryError now says "the pixels only: no histogram is computed".
    • Docstrings on both point to each other.
  • links.py: link_outside_folder now explains itself. The rule itself is unchanged: the "contain" rule is the owner's decision of 2 November 2026 ([Sad Catapella B4][Discovery] Symbolic links can silently import images outside the experiment root #81, plan §12 question 64). Only the message changed:
    • it says the images or masks behind the links are not found, and why: a run reads, fingerprints and records only what is inside the selected folder;
    • the fix says to move the data in (not copy it; on the same drive a move is instant), or to put the experiment's folders on the drive that holds the data. Before, it said "Copy or move the files".
  • Tests:
    • tests/zarr_tree.Unwritten writes a store's metadata only, no chunks, so the mosaic-sized fixture takes about 24 KB on disk.
    • tests/test_plane_memory_names.py checks both figures term by term (38.0 GiB and 14.8 GiB), the warning text and the refusal text.
    • tests/test_links.py has new tests for a file symlink, a directory (OME-Zarr store) symlink and a mask symlink.
    • One existing notebook assertion was updated for the new wording.
  • Docs: CHANGELOG Unreleased (v0.10.1), user_guide.md (the links section and the two message rows), contract.md (the Links row and read_plane's memory note), and plan.md §12 question 95.

Decisions

  • The link rule stays as it is. It is a deliberate owner decision about safety and identity, so this PR only rewrites the message.
  • Proposed, not decided (plan §12 Q95): an explicit opt-in such as run --follow-links / describe --follow-links plus a notebook tick. It would be recorded in the manifest, so that identity and fingerprints use the link targets, and RunInputs.open would refuse links that point somewhere other than recorded. Nothing is built until the owner decides.
  • Two quantities, not one shared estimate. The contract already says read_plane's limit leaves out the histogram arrays (audit I2), so merging the two figures would be wrong.

Notes for review

  • The 33.8 GiB histogram term comes from morphobricks_normalization.estimate_histogram_memory. For 8- and 16-bit planes it allows 32 bytes per pixel, which is probably generous for the per-value counting path. That code lives in the normalization brick, so it is not changed here; possible follow-up.
  • planes.py is at its line cap (1299). The warning text was kept to the same number of lines, so it is terse.
  • Not verified: the notebook text in a real JupyterLab, and the run on the owner's actual mosaic. The fixture reproduces the mosaic's exact header numbers, giving 38.0 GiB and 14.8 GiB.

Tests

python tools/check.py: ruff check and ruff format pass; 9230 passed, 35 skipped (the skips are skimage not installed, the release-only notebook pin, and platform skips); code rules pass. GitHub Actions is blocked, so this was run locally on Python 3.13 with zarr 3.4.2.


Generated by Claude Code

The owner's run of the formin OME-Zarr mosaic (30720 x 36864 x 3, uint16,
chunks 1 x 1024 x 1024; 4 December 2026) found two points:

- run warned "would need up to 38.0 GiB" while xyc_plane_memory gave
  14.8 GiB for the same plane. Both are right: the run's figure is one
  channel read and measured (33.8 GiB of it the histogram's working
  arrays), read_plane's the pixels of all three channels with no
  histogram. planes_read_in_blocks, the notebook's run plan and
  read_plane's PlaneMemoryError now say which is which. Tested on a
  lazily written store of the mosaic's size (zarr_tree.Unwritten).
- link_outside_folder stays (owner decision of 2 November 2026, #81,
  plan Q64); its message now says the images behind the links are not
  found and why, and the fix says to move the data in. An opt-in that
  follows links is plan Q95, proposed, not decided.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp996hygHEfLZ4jtxi1A
@guijacquemet
guijacquemet marked this pull request as ready for review December 4, 2026 09:36
@guijacquemet
guijacquemet merged commit 6973070 into integration/v0.10.1 Dec 4, 2026
3 checks passed
@guijacquemet
guijacquemet deleted the fix/symlink-and-plane-memory branch December 4, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants