Skip to content

Add compact tile-row storage for xRay detector spectra - #75

Merged
tpn merged 5 commits into
mainfrom
codex/compression-xray-20260929
Sep 30, 2026
Merged

tpn merged 5 commits into
mainfrom
codex/compression-xray-20260929

Conversation

@tpn

@tpn tpn commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

xRay currently writes each fitted spectrum once for every pixel column in its tile. Add --artifact-layout tile-rows and the matching Python artifact_layout option to store each spectrum once, with a shared reader that expands requested pixel slices.

Dense NPY remains the compatibility default for direct NumPy consumers; dense and tile-rows are explicit runtime choices on single-node and distributed runs. Comparison, visualization, resume and shard merging support both layouts. Changing the layout invalidates shard resume reuse.

A checked crop of existing detector artifacts stores 16 times fewer spectral values and reconstructs byte-for-byte. Validation: 200 focused GPU, CPU, CLI and visualization tests passed, including nonzero ROIs, partial tiles, uneven shards, selector propagation and resume behavior. All source hooks and mypy passed.

@copy-pr-bot

copy-pr-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack β†’

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Repository: NVIDIA/cuPhoton/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 83c02a49-2f23-4a27-9fbe-1ad6529dd9d9

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 63d01a5 and 909ecc8.

πŸ“’ Files selected for processing (7)
  • src/cuphoton/xray/commands.py
  • src/cuphoton/xray/detector_artifacts.py
  • src/cuphoton/xray/detector_distributed.py
  • src/cuphoton/xray/phonon_viz.py
  • src/cuphoton/xray/workflow_viz.py
  • tests/xray/test_detector_artifacts.py
  • tests/xray/test_detector_distributed.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


πŸ“ Walkthrough

Walkthrough

Detector artifacts now support compact tile-rows spectral storage alongside the default dense layout. A shared loader provides bounded array reads. Local and distributed workflows pass the selected layout through production, resume, validation, visualization, and shard merging.

Changes

Detector artifact layouts

Layer / File(s) Summary
Tile-row storage and readers
src/cuphoton/xray/detector_storage.py, src/cuphoton/xray/phonon_viz.py, src/cuphoton/xray/workflow_viz.py, tests/xray/test_detector_storage.py, docs/xray/README.md
Adds tile-row layout metadata and a logical array reader with bounded integer and slice indexing. Visualization and storage tests use the shared loader.
Artifact production and layout selection
src/cuphoton/xray/commands.py, src/cuphoton/xray/detector_artifacts.py, tests/xray/test_detector_artifacts.py, tests/xray/test_detector_storage.py, tests/core/test_cli_contract.py, docs/xray/README.md, CHANGELOG.md
Adds a dense or tile-rows option to artifact commands and the builder. Production, manifests, resume identities, comparison, and publication handle both layouts.
Distributed plans and shard merging
src/cuphoton/xray/detector_distributed.py, src/cuphoton/xray/detector_artifacts.py, tests/xray/test_detector_distributed.py, docs/xray/DISTRIBUTED-DETECTOR-ARTIFACTS.md
Distributed plans validate and pass non-default layouts to workers. Shard validation and merging preserve the layout and check shard compatibility and metadata.

Priority: βž– Normal

Merge Risk: βšͺ Minimal Β· up to 909ec

No actionable merge-blocking risk was identified in the reviewed layout changes. Normal checks remain appropriate before merging.

πŸš₯ Pre-merge checks | βœ… 2
βœ… Passed checks (2 passed)
Check name Status Explanation
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@tpn
tpn force-pushed the codex/compression-xray-20260929 branch from 04da46b to 63d01a5 Compare September 30, 2026 02:54
@tpn
tpn marked this pull request as ready for review September 30, 2026 03:21
@tpn
tpn requested a review from melo-gonzo as a code owner September 30, 2026 03:22
@tpn tpn added the ai-review Request a focused CodeRabbit review label Sep 30, 2026
@tpn

tpn commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@melo-gonzo melo-gonzo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. All 117 selected storage, artifact and distributed tests passed on RTX 6000 Ada, including byte-exact dense/compact parity for a nonzero crop and partial tiles. Suitable as an optional 0.1.3 inclusion; dense output remains the default.

tpn added 5 commits September 30, 2026 12:57
Store each fitted spectrum once per x tile with an opt-in layout.
Read logical pixel slices without expanding the whole detector cube,
and preserve compact storage through shard merges.

Keep dense output as the default and support both layouts in
comparison, visualization, and resume checks.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Signed-off-by: Trent Nelson <trentn@nvidia.com>
Document explicit CLI and Python storage choices and retain dense output
for compatibility with existing NumPy consumers. Cover worker command
propagation and resume invalidation when the layout changes.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Show explicit layout choices in producer CLI and Python examples.
Explain logical filenames, bounded ROI reads, and the storage versus
full-expansion tradeoff for compact spectra.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
Require explicit slicing before NumPy converts compact spectra and
reject boolean indexing. Validate writer edges and shard ROI geometry
before publishing, and identify missing compact metadata clearly.

Keep non-spectral publication errors tied to their actual filenames.
Document the compact format and unchanged dense default in release
notes.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
@tpn
tpn force-pushed the codex/compression-xray-20260929 branch from 63d01a5 to 909ecc8 Compare September 30, 2026 19:57
@tpn
tpn merged commit ec45019 into main Sep 30, 2026
61 checks passed
@tpn
tpn deleted the codex/compression-xray-20260929 branch November 9, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a focused CodeRabbit review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants