Skip to content

Commit a799acc

Browse files
committed
Fix HDF5 dataset attribute serialization
1 parent 89d886f commit a799acc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ for future and past milestones.
9696
(https://github.com/PlotPyStack/PlotPy/issues/9), and was fixed in PlotPy v2.0.3
9797
with an additional compilation flag indicating to use C++11 standard
9898
* Part 2: Missing menus on MacOS was due to a PyQt/MacOS bug regarding dynamic menus
99+
* HDF5 file format: when importing an HDF5 dataset as a signal or an image, the
100+
dataset attributes were systematically copied to signal/image metadata: we now
101+
only copy the attributes which match standard data types (integers, floats, strings)
102+
to avoid errors when serializing/deserializing the signal/image object
99103

100104
## DataLab Version 0.9.2 ##
101105

cdl/core/io/h5/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def __process_metadata(self, obj):
9999
for key, value in self.dset.attrs.items():
100100
if isinstance(value, bytes):
101101
value = to_string(value)
102-
obj.metadata[key] = value
102+
if isinstance(value, (np.ndarray, str, float, int, bool)):
103+
obj.metadata[key] = value
103104
obj.metadata.update(self.metadata)
104105

105106
@property

0 commit comments

Comments
 (0)