Repository navigation
Accept an open h5py.File in ConnectionTable - #142
Merged
Merged
Conversation
ConnectionTable(h5file) takes either the path of an HDF5 file, as before, or an open h5py.File, which it reads and leaves open. BLACS can then check a submitted shot's connection table and read the rest of what it needs from the shot file with one open, instead of two, each of which costs a zlock round trip. A ConnectionTable made from an open file of a shot has the same filepath, table and master pseudoclock as one made from its path, and the two compare equal; the file is still open afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LrFdivpj4fx9MNAuXvB7Y9
This was referenced Oct 24, 2026
chrisjbillington
pushed a commit
that referenced
this pull request
Oct 25, 2026
ConnectionTable treated its argument as a path if it was a str, bytes or os.PathLike, and as an open file otherwise. get_shot_globals makes the opposite test: an h5py.File is used as it is, and anything else is opened as a path. ConnectionTable now makes the same test as get_shot_globals, reads the file in one `with` block over either the open file or a newly opened one, and uses the stored file path in its log and error messages. The os import is no longer used and is removed. Verified on a compiled example shot: ConnectionTables made from the path as a string, from the path as a pathlib.Path and from an open h5py.File have equal raw tables, equal connections, the same file path and master pseudoclock, and compare_to reports no differences between them. The open file is still open afterwards, including when it has no connection table and the constructor raises, and the log messages name the file. Follows up #142. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RikqmNDkEBd3S1NrmVw9LU Claude-Session: https://claude.ai/code/session_01BM9Q7PRz2tohMTMZZkMsKe
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.
ConnectionTable()now accepts an openh5py.Fileas well as a path. When BLACS receives a shot, it opens the shot file once to read the connection table and again to read the rest of what it needs. Each open costs a zlock round trip. With this change, BLACS can do both with one open (a blacs pull request that uses this follows).A
ConnectionTablemade from the open file of a shot has the same file path, table and master pseudoclock as one made from the path, and the two compare equal. The file is still open afterwards. An end-to-end test that installs the suite, compiles the example experiment, loads the shot in lyse and runviewer, and starts BLACS, runmanager, runviewer and lyse passed on Ubuntu and Windows for Python 3.11 to 3.14 with PySide6, PyQt6 and PyQt5 (run 40129941950).馃 Generated with Claude Code
https://claude.ai/code/session_01LrFdivpj4fx9MNAuXvB7Y9