fix: close remaining detector-image handles through one loader - #3
Merged
Conversation
Route Workbench, shared-reference, and strict 2D readers through saxsabs.io.detector_images so FabIO handles are copied then closed on success and failure. Refuse pickled Workbench .npy mask/flat loads.
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.
Problem
Architecture, CHANGELOG, and the Workbench known-boundary notes still said FabIO handles were closed only in the strict 1D readers and the 2D resume verifier. The shared reference loader, strict 2D main read, integrate1d mask/EDF paths, and many Workbench
fabio.opensites each had their own (or no) close path. On Windows that leaks file handles.Cause
There was no shared copy-and-close helper at the I/O edge, so each caller opened FabIO directly and often dropped the handle after reading
.data.Fix
saxsabs.io.detector_imagesas the common copy-and-close loader (owned pixel copy, copied header, close on success and failure).bl19b2.read_detector_image, integrate1d mask/EDF, and the 2D resume verifier through it..npymask/flat loads now useallow_pickle=False.How verified
git diff --checkgit diff --cached --checkpython -m ruff check src testspython -m pytest -qpython -m saxsabs --version(twice)saxsabs 2.0.0python -m saxsabs estimate-k --meas examples/k_measured.csv --ref examples/k_reference.csv(twice)k_factor2.0 both runspython examples/minimal_2d/run_minimal_2d_pipeline.py(twice)0.001933697...both runsHead:
25d41961aa6bcf7735cbd0ca1a6cbddb5744a442