From 50a6dac178716ee7850ba4745a7b32e28a3ca02d Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 10 Jul 2023 10:52:47 +0800 Subject: [PATCH] files: read dataset metadata from HDF5 --- artiq/browser/files.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/artiq/browser/files.py b/artiq/browser/files.py index a714cb696..d155ca5dc 100644 --- a/artiq/browser/files.py +++ b/artiq/browser/files.py @@ -194,7 +194,9 @@ class FilesDock(QtWidgets.QDockWidget): if "archive" in f: def visitor(k, v): if isinstance(v, h5py.Dataset): - rd[k] = (True, v[()]) + # v.attrs is a non-serializable h5py.AttributeManager, need to convert to dict + # See https://docs.h5py.org/en/stable/high/attr.html#h5py.AttributeManager + rd[k] = (True, v[()], dict(v.attrs)) f["archive"].visititems(visitor) @@ -204,7 +206,9 @@ class FilesDock(QtWidgets.QDockWidget): if k in rd: logger.warning("dataset '%s' is both in archive " "and outputs", k) - rd[k] = (True, v[()]) + # v.attrs is a non-serializable h5py.AttributeManager, need to convert to dict + # See https://docs.h5py.org/en/stable/high/attr.html#h5py.AttributeManager + rd[k] = (True, v[()], dict(v.attrs)) f["datasets"].visititems(visitor)