-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
#TODO: remove this function upon 1.0.0 release | ||
@staticmethod | ||
def _convert_dtype_obj_array(obj: np.ndarray): | ||
result = np.array(obj.tolist()) |
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
Notes
-----
The array may be recreated via ``a = np.array(a.tolist())``, although this
may sometimes lose precision.
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.
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.
lgtm
#TODO: remove this function upon 1.0.0 release | ||
@staticmethod | ||
def _convert_dtype_obj_array(obj: np.ndarray): | ||
result = np.array(obj.tolist()) |
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.
pyiron_base/generic/hdfio.py
Outdated
f"Returned array was converted from dtype='O' to dtype={result.dtype} " | ||
f"via `np.array(result.tolist())`.\n" | ||
f"Please run rewrite_hdf5() to update this data! " | ||
f"To update all your data run update tool.") |
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.
On the PR that introduces the tool we need to remember to come back and reference it here.
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.
^^ @pmrv
Am currently working on identifying affected projects and testing the update bot. I can verify that normal lammps jobs submitted with 0.3.8 are affected, e.g. when you do
instead of this with this branch
|
Then with the update script I just pushed I get the 'correct' thing again
|
I'd like to test it on a larger project, but I'm running into the other bug at #517 with this branch, so it will have to wait until tomorrow. |
Now I am slightly confused. You are talking about different hdf files produced with 0.3.8 and this branch, which should behave like the current master in this respect? If yes, then I am fine :) |
Co-authored-by: Niklas Siemer <[email protected]>
Yes, everything after #503 should write as in the second example, everything before (and 0.3.8) as in the first example. |
Although I canceled the windows-latest 3.9 test, the output shows the complete test suite with a ok. Thus, I take this as passing test! Codacy complaint is irrelevant. Therefore, @pmrv merge once you could test it. |
We really should hurry a bit and merge this and #519 and release 0.4.0 tomorrow. We need the writing of dtype=object arrays to be fixed and the h5io issue solved also on our conda release! |
Co-authored-by: Niklas Siemer <[email protected]>
@pmrv Do you want to add something to the robot already or leave it as it is and make it faster in the next release? |
No description provided.