From dfc6ecbf3d8fd7b6445a5a4d5c37047aa5eb8ac6 Mon Sep 17 00:00:00 2001 From: Leon Riesebos Date: Tue, 5 Apr 2022 23:47:49 -0400 Subject: [PATCH] browser: support datasets that use h5 group notation Signed-off-by: Leon Riesebos --- artiq/browser/files.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/artiq/browser/files.py b/artiq/browser/files.py index 54522e007..2d5fb0452 100644 --- a/artiq/browser/files.py +++ b/artiq/browser/files.py @@ -188,15 +188,24 @@ class FilesDock(QtWidgets.QDockWidget): except: logger.warning("unable to read metadata from %s", info.filePath(), exc_info=True) - rd = dict() + + rd = {} if "archive" in f: - rd = {k: (True, v[()]) for k, v in f["archive"].items()} + def visitor(k, v): + if isinstance(v, h5py.Dataset): + rd[k] = (True, v[()]) + + f["archive"].visititems(visitor) + if "datasets" in f: - for k, v in f["datasets"].items(): - if k in rd: - logger.warning("dataset '%s' is both in archive and " - "outputs", k) - rd[k] = (True, v[()]) + def visitor(k, v): + if isinstance(v, h5py.Dataset): + if k in rd: + logger.warning("dataset '%s' is both in archive " + "and outputs", k) + rd[k] = (True, v[()]) + + f["datasets"].visititems(visitor) self.datasets.init(rd)