ParticleGroup.from_hdf5 - #156
Open
electronsandstuff wants to merge 24 commits into
Open
Conversation
electronsandstuff
marked this pull request as ready for review
August 25, 2026 07:16
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.
Per discussion with @ChristopherMayes, this PR adds a new method
.from_hdf5toParticleGroupwith atime_offsetargument. Additional cleanup is performed.pre-committo conda env.vscodeto.gitignore__init__argumenth5h5py.File,h5py.Group, "legacy" group with no speciesexceptions.pywith custom BeamPhysics exceptions for HDF5 file load errorsload_bunch_dataand__init__are broken into methods to handle each atomic part of loading the only species in the only iteration of a particle group.load_species_datagets the array dict from one species_only_species_grouploads the only species in the OpenPMD iteration passed to it (or passes through to handle "legacy" version w/o species)_only_iteration_groupgets the only iteration, raising on none or multiple. Handles files, groups, paths._only_iteration_only_species_grouphandles the file loading, existing behavior of passing through raw species group.load_bunch_datatoreaders.pyand keep import there for legacy supportload_time_offsetto load from an open species groupload_only_time_offsetloads from only species from only iteration with same input semantics as.from_hdf5t_offsettoParticleGroupt.writedocs/examples/write_examples.ipynbupdated to use read w/o time offsetdocs/examples/read_examples.ipynbdemostrates.from_hdf5and time offset methodsdocs/api/readers.mdNote: this PR also includes the changes noted in #152. It was intended as a stacked PR, but due to working out of a fork is set up to target main instead and will supersede it.