Repository navigation
Tomo export: skip unfinished runs automatically; export recorded projections by hand - #112
Open
Anthony Sligar (sligara7) wants to merge 2 commits into
Open
Anthony Sligar (sligara7) wants to merge 2 commits into
Anthony Sligar (sligara7) wants to merge 2 commits into
Conversation
…ed projections by hand An aborted tomo flyscan records fewer events than the PandA captured before it was disarmed, so Tiled refuses to serve the capture (422 'Can not reshape (2335,) array data to (570, 4)', HEX scan 14, 2026-10-26) and the auto-export failed. The auto-exporter now skips runs that did not end in success and records them as skipped. export_tomo_flyscan_to_h5, run by hand on such a run, reads each PandA capture from its file up to the recorded events and averages over the recorded projections. Assisted-by: copilot:claude-opus-5-5
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes have regression coverage, preserve completed-run behavior, and explicitly warn about the remaining detector-link limitation.
No open issues 🎉
What changed in this PR
Prevents automatic export failures on unsuccessful runs and supports manual export of recorded tomography projections when PandA files contain extra captures.
Changes:
- Skips automatic exports for non-successful runs and records
skippedin the CSV. - Reads only recorded PandA captures for incomplete tomography runs, preserving Tiled reads for completed runs and warning about untrimmed detector links.
- Adds regression tests for the aborted-scan incident, short capture files, and completed-run behavior.
| File | Description |
|---|---|
| tests/test_export_unfinished_run.py | Tests skipped exports, capture limits, and incomplete/completed tomography exports. |
| src/hextools/exporters/utils.py | Adds bounded HDF5 capture reads with short-file validation. |
| src/hextools/exporters/tomography.py | Exports recorded projections for incomplete runs. |
| src/hextools/exporters/auto_exporter.py | Skips unsuccessful runs and records explicit export outcomes. |
Review effort: Balanced
Assisted-by: copilot:claude-opus-5-5
This branch has not been deployed
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.
Fixes the auto-export failure on HEX scan 14 (2026-10-26):
422: Can not reshape (2335,) array data to (570, 4)readingprimary/rotation_angle.Cause: the scan (3601 projections × 4 images) was aborted after 570 projections. The run recorded 570 × 4 PandA captures, but the PandA kept capturing until it was disarmed and its file holds 2335. Tiled reshapes the whole dataset to the recorded shape, so it refuses to serve it, and the averaging step from #100 failed.
Change
auto_export_runskips runs whoseexit_statusis notsuccess(logged, and recorded asskippedin the CSV).export_tomo_flyscan_to_h5, run by hand on a run that recorded fewer events thannum_points, reads each PandA capture from its HDF5 file up to the recorded events (read_recorded_captures) and averages over the recorded projections. Finished runs are still read through Tiled as before.Not handled (Jakub Wlodek (@jwlodek), your call): after an abort the detector's
.nxslink can still point at frames past the last recorded projection; the exporter logs a warning.Verified: new
tests/test_export_unfinished_run.pyuses the incident's numbers (570 recorded, 2335 in the file). Before the change the auto-exporter called the exporter on aborted/stopped/failed runs and the aborted export failed; now all pass, and the finished-run paths are unchanged. Full suite: 423 passed (the 2 tomo flyscan tests that fail on main in my env, which lacksbps.fly_stub, were deselected). Mock tests only; not run on the beamline.