-
Notifications
You must be signed in to change notification settings - Fork 219
Description
This isn't exactly an issue that we can solve in hyperspy without some kind of hacky workarounds but something that I wanted to bring up here.
I ran into this issue while working on creating a diffraction vectors class where both the zarr and hdf5 saving methods fail when trying to save a 2 dimensional array. There was movement to solve this issue in zarr: zarr-developers/numcodecs#200 but this largely seems to have stalled.
Example of the Failing Code
import numpy as np
import hyperspy.api as hs
x = np.empty(shape=(3), dtype=object)
for i in np.ndindex(x.shape):
x[i] = np.random.random((4, 2))
s = hs.signals.BaseSignal(x).T
s.save("test.zspy")
s.save("test.hspy")
For a solution to this I might try to see what it takes to bring the zarr
PR across the finish line if no one is working on it. I think that this is kind of an edge case, but supporting it in zarr might be significantly easier than trying to get it to work with hdf5. From my understanding there, the work around is to cast the data into a new datatype which seems complicated to get to work in our case.