-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert dtype=object arrays if possible #518
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
496bbe6
Convert dtype=object arrays if possible
niklassiemer ca73ecc
Update pyiron_base/generic/hdfio.py
niklassiemer 65a482c
Add script that rewrites all HDF5 files in a project
pmrv 1a96671
Update warning to reference update script
pmrv c205038
Correct version number
pmrv d9b45b9
Fix version number
pmrv 14508dc
Use tqdm to show progress; do not abort on error of a single job
pmrv 7aeff22
Check if bug is present before rewriting & read file size before rewrite
pmrv 81874ad
Catch error when file does not exist; track skipped jobs
pmrv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
""" | ||
pyiron_base<=0.3.9 has a bug that writes all arrays with dtype=object even | ||
pmrv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
numeric ones. As a fix pyiron_base=0.3.10 introduces a conversion when reading | ||
pmrv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
such arrays, but does not automatically save them. This conversion script | ||
simply goes over all jobs and rewrites their HDF5 files, since it's read with | ||
the correct dtype, this then writes this correct dtype. | ||
""" | ||
|
||
import sys | ||
|
||
from pyiron_base import Project | ||
|
||
pr = Project(sys.argv[1]) | ||
for j in pr.iter_jobs(convert_to_object=False, recursive=True): | ||
j.project_hdf5.rewrite_hdf5(j.name) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone has a better function to do this, I would be happy. Especially, since the docstring states
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't be too worried. I think they mean that you might get a conversion from int64 down to int32. AFAIK we don't have any users who care about using long int/floats (or short ones for more memory efficiency), so any sloppiness here should be perfectly safe.