-
Notifications
You must be signed in to change notification settings - Fork 86
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
Error when using numpy.load #41
Comments
I think this might actually be a bug in numpy itself. Or the documentation is unclear, and I've screwed something up. Either way, I'll ask the numpy developers about this, but for now I'll give you a workaround (or two). WorkaroundYou can get around this problem by simply converting the np.save(filename, quaternion.as_float_array(qarray)) and quaternion.as_quat_array(np.load(filename)) This trick will always work, even if I do manage to fix the more obvious way of using Rescuing dataDon't use this method going forward, but if you've already saved a file from some big procedure that you can't or don't care to reproduce, you can salvage the file by editing it ( {'descr': '<q32', 'fortran_order': False, 'shape': (2,), } Change that to something like {'descr': '<f8', 'fortran_order': False, 'shape': (2, 4), } That is, change |
This problem is "solved" in the sense that import numpy as np
import quaternion
a = quaternion.as_quat_array(np.random.rand(5,3,4))
np.save("test.npy", a)
b = np.load("test.npy").view(dtype=np.quaternion)
np.array_equal(a, b) # returns `True` Note the |
I want to save some quaternion data to a file and load it again later. The saving part works fine:
However, when I try to load the file, I get an error:
Here is the full error message:
How can I load my saved data?
The text was updated successfully, but these errors were encountered: