Bring omezarr/smartspim ports into parity with NDR-matlab main - #30
Merged
Merged
Conversation
NDR-matlab now owns a Blosc container codec at +ndr/+format/+blosc, backed by numcodecs.Blosc in a private subprocess venv (sonpipe pattern; ndr.util.blosc.setup manages the venv, MATLAB's pyenv is never touched). There is no Python mirror and none is planned: Python callers should use numcodecs.Blosc directly, and any MATLAB wrapper on top would just be a rename over the same subprocess call. The new bridge yaml records the four MATLAB functions (encode, decode, isBlosc, header) with status: matlab_only so the mirror inventory stays honest. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N67xH9BejMzZp4GNAq8m7w
…r-ndi-viewer-djp5vk
Follow-up to VH-Lab/NDR-matlab#139 (merged there): the probe/reduce helpers and the omezarr/smartspim reader classes were already ported; this commit adds the pytest coverage that was missing on the Python side and bumps the four bridge entries that had drifted. Tests mirror the MATLAB unit tests function-for-function: - tests/test_omezarr_probe.py mirrors TestOMEZarrProbe.m: ok / n_pyramids / pyramid_names / axes_order / level0_* on the shared programmatic fixture, plus the not-ok paths (missing dir, empty dir). - tests/test_omezarr_reduce.py mirrors TestOMEZarrReduce.m: mean/max, dtype (max preserves, mean promotes to float64), per-axis factor vector, trailing partial block kept, arity + reduction validation, factor-1 pass-through. - tests/test_omezarr_reader.py mirrors TestOMEZarrReader.m: pinned / unpinned / unknown / sidecar resolveepoch, all metadata methods, single-frame / multi-frame / Level>1 pixel reads against ground truth, and mean-vs-max routing proof at level 2. - tests/test_smartspim_reader.py mirrors TestSmartSPIMReader.m: pinned / unpinned-channel / unpinned-tile / sidecar resolveepoch, all metadata methods, single-frame / multi-frame / cross-channel reads against the synthetic fixture, out-of-range error. Programmatic fixtures mirror ndr.test.format.{omezarr,smartspim} .makeExampleFixture.m: dual-pyramid Zarr v2 store with a shared level-0 array (uncompressed C-order chunks are enough since the read path is zarr.open); a synthetic SmartSPIM tree with real TIFF slices whose pixels encode (channelIndex, z) so cross-channel routing has a byte-for-byte proof. Bridge yaml updates (all drift picked up by test_matlab_bridge_completeness.py): - +ndr/+format/+blosc/encode.m 9a87c0a -> aa89463 - +ndr/+format/+blosc/decode.m 9a87c0a -> aa89463 - +ndr/+format/+omezarr/readArray.m a847431 -> 8bea2d2 - +ndr/+format/+omezarr/private/ decompressBlosc.m a847431 -> 5a44303 Every one is MATLAB-side blosc plumbing (batch API, persistent server, MEX preference, hand-rolled codec dispatch replaced with one-line delegation). Python has always used numcodecs.Blosc through zarr directly, so all four are hash-bump-only per the decision_log notes. +ndr/+util/+blosc/* MEX bootstrapping stays deliberately unported (numcodecs.Blosc on the Python side; see the matlab_only entries in src/ndr/format/blosc/ndr_matlab_python_bridge.yaml). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdLHfApBhntCz64BatnwY5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to VH-Lab/NDR-matlab#139 (merged there). The Python-side ports of
ndr.format.omezarr.{probe,reduce}andndr.reader.{omezarr,smartspim}were already onmain; this PR adds the pytest coverage that was missing on the Python side and bumps the four bridge entries that had drifted after the recent MATLAB blosc work.Summary
tests/test_omezarr_probe.pymirrorsTestOMEZarrProbe.m(ok / n_pyramids / pyramid_names / axes_order / level0_* plus the not-ok paths).tests/test_omezarr_reduce.pymirrorsTestOMEZarrReduce.m(mean/max, dtype behaviour, per-axis factor, trailing partial block, arity + reduction validation).tests/test_omezarr_reader.pymirrorsTestOMEZarrReader.m(pinned / unpinned / unknown / sidecar resolveepoch, all metadata methods, single- and multi-frame pixel reads against ground truth,Level>1 reads, and the mean-vs-max routing proof at level 2).tests/test_smartspim_reader.pymirrorsTestSmartSPIMReader.m(pinned / unpinned-channel / unpinned-tile / sidecar resolveepoch, metadata, cross-channel reads against a synthetic TIFF fixture whose pixels encode(channelIndex, z)).tests/_omezarr_fixture.pyandtests/_smartspim_fixture.pymirrorndr.test.format.{omezarr,smartspim}.makeExampleFixture(dual-pyramid Zarr v2 store with a shared level-0 array; SmartSPIM tree with real TIFF slices). Zarr chunks are uncompressed here becausezarr.openreads them through the same path as any other codec — no zstd binary ornumcodecs.Bloscneeded to exercise the read side.test_matlab_bridge_completeness.py. Each entry now records the current MATLAB commit and adecision_lognote explaining why the MATLAB change is a no-op on the Python side:+ndr/+format/+blosc/encode.m9a87c0a→aa89463+ndr/+format/+blosc/decode.m9a87c0a→aa89463+ndr/+format/+omezarr/readArray.ma847431→8bea2d2+ndr/+format/+omezarr/private/decompressBlosc.ma847431→5a44303Every one is MATLAB-side blosc plumbing (batch API + persistent server, blosc-matlab MEX preference, hand-rolled codec dispatch replaced with a one-line delegation to
ndr.format.blosc.decode). Python has always usednumcodecs.Bloscthroughzarrdirectly, so all four are hash-bump-only.Intentionally not ported
+ndr/+util/+blosc/*MEX bootstrapping (blosc-matlab pinning, ensureMex, persistent Python server, venv setup) stays MATLAB-only — see thematlab_onlyentries insrc/ndr/format/blosc/ndr_matlab_python_bridge.yaml. The Python side reads and writes Blosc containers throughnumcodecs.Bloscdirectly, so there is nothing to port.Test plan
NDR_MATLAB_PATH=../ndr-matlab pytest tests/ --ignore=tests/symmetry— 613 passed, 3 skipped.NDR_BRIDGE_CHECK_STRICT=1 NDR_MATLAB_PATH=../ndr-matlab pytest tests/test_matlab_bridge_completeness.py tests/test_matlab_bridge_conventions.py— 191 passed, drift check green.test_omezarr_reader.pyandtest_smartspim_reader.py) verify pixel-level correctness against ground truth, including the pyramid-routing invariant that mean and max reads return different pixels at the same coordinates.🤖 Generated with Claude Code
https://claude.ai/code/session_01UdLHfApBhntCz64BatnwY5
Generated by Claude Code