Skip to content

Commit

Permalink
fch5: save dtype as encoded string
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristosT committed Nov 13, 2024
1 parent 01e6bbe commit 301a673
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion hexrd/imageseries/load/framecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..imageseriesiter import ImageSeriesIterator
from .metadata import yamlmeta
from hexrd.utils.hdf5 import unwrap_h5_to_dict
from hexrd.utils.compatibility import h5py_read_string

import multiprocessing
from concurrent.futures import ThreadPoolExecutor
Expand Down Expand Up @@ -81,7 +82,7 @@ def _load_cache_fch5(self):

self._shape = file["shape"][()]
self._nframes = file["nframes"][()]
self._dtype = np.dtype(file["dtype"][()])
self._dtype = np.dtype(h5py_read_string(file["dtype"]))
self._meta = {}
unwrap_h5_to_dict(file["metadata"], self._meta)

Expand Down
2 changes: 1 addition & 1 deletion hexrd/imageseries/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def _write_frames_fch5(self):
h5f.attrs['HEXRD_FRAMECACHE_VERSION'] = 1
h5f["shape"] = shape
h5f["nframes"] = nframes
h5f["dtype"] = str(self._ims.dtype).encode()
h5f["dtype"] = str(np.dtype(self._ims.dtype)).encode("utf-8")
metadata = h5f.create_group("metadata")
unwrap_dict_to_h5(metadata, self._meta.copy())

Expand Down

0 comments on commit 301a673

Please sign in to comment.