Skip to content

FIX: Generalize the file_per_datum derivation for multipart stack layout - #68

Closed
genematx wants to merge 1 commit into
bluesky:mainfrom
genematx:fix-tiff-regression
Closed

genematx wants to merge 1 commit into
bluesky:mainfrom
genematx:fix-tiff-regression

Conversation

@genematx

@genematx genematx commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

When the default join_method changed from 'concat' to 'stack' in #52, the MultipartRelatedConsolidator stopped deriving files_per_datum from chunk_shape and fell back to frame_per_point (default 1). Multi-frame image sequences (e.g. ophyd-async areaDetector TIFF with NumImages > 1) therefore registered a single file per datum, so the declared stacked shape (N, frames, H, W) could not be filled and reading raised a reshape error.

Compute files_per_datum = datum_shape[0] // chunk_shape[0] in the general case, with a single exception: under 'stack', when chunk_shape describes only the stacked/row axis (e.g. (1,) or (1, *datum_shape)) and no multiplier/frame_per_point indicates file-per-frame storage, the whole datum is a single file. This keeps (1) concat, (2) rank-aligned stack, and (3) the legacy file-per-frame multiplier cases correct.

TST: add a parametrized regression test covering the modern per-file chunk_shape and legacy multiplier cases, and fix a vacuous assertion in test_tiff_and_jpeg_chunks that never checked the stack file count.

When the default join_method changed from 'concat' to 'stack', the
MultipartRelatedConsolidator stopped deriving files_per_datum from
chunk_shape and fell back to frame_per_point (default 1). Multi-frame
image sequences (e.g. ophyd-async areaDetector TIFF with NumImages > 1)
therefore registered a single file per datum, so the declared stacked
shape (N, frames, H, W) could not be filled and reading raised a reshape
error.

Compute files_per_datum = datum_shape[0] // chunk_shape[0] in the general
case, with a single exception: under 'stack', when chunk_shape describes
only the stacked/row axis (e.g. (1,) or (1, *datum_shape)) and no
multiplier/frame_per_point indicates file-per-frame storage, the whole
datum is a single file. This keeps concat, rank-aligned stack, and the
legacy file-per-frame multiplier cases correct.

TST: add a parametrized regression test covering the modern per-file
chunk_shape and legacy multiplier cases, and fix a vacuous assertion in
test_tiff_and_jpeg_chunks that never checked the stack file count.
@genematx

genematx commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Closed in favor of #67.

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.

1 participant