forked from M-Labs/artiq
files: read dataset metadata from HDF5
This commit is contained in:
parent
5292a8de82
commit
50a6dac178
|
@ -194,7 +194,9 @@ class FilesDock(QtWidgets.QDockWidget):
|
||||||
if "archive" in f:
|
if "archive" in f:
|
||||||
def visitor(k, v):
|
def visitor(k, v):
|
||||||
if isinstance(v, h5py.Dataset):
|
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)
|
f["archive"].visititems(visitor)
|
||||||
|
|
||||||
|
@ -204,7 +206,9 @@ class FilesDock(QtWidgets.QDockWidget):
|
||||||
if k in rd:
|
if k in rd:
|
||||||
logger.warning("dataset '%s' is both in archive "
|
logger.warning("dataset '%s' is both in archive "
|
||||||
"and outputs", k)
|
"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)
|
f["datasets"].visititems(visitor)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue