Hfile pycbc version information check #4768
Closed
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.
Add a
pycbc_version
attribute when opening a HFile to write, and check that it exists/matches when opening for reading.Standard information about the request
This is a new feature
This change (can) affect all codes which use h5py input/output, if wanted
This changes warnings seen when running the code, no scientific content or results plotting will be affected
This change follows style guidelines (See e.g. PEP8), has been proposed using the contribution guidelines
I can add unit tests if desired
This change will warn when different versions of PyCBC are being used
Motivation
When the code changes, there are (sometimes unwitting) differences in how the files from the code are output/input. This just adds a warning to the user to be wary of that.
Contents
When a HFile object is opened, the file read/write permission will be used to determine whether or not to check / update the
pycbc_version
attribute.Testing performed
Tested each case (same / different versions, and unversioned files), and the correct warnings are given each time.
Tested that the permissions are carried through to the underlying h5py.File, and appropriate errors are raised.