Skip to content
Snippets Groups Projects
Commit 1c124037 authored by Mattia Mancini's avatar Mattia Mancini
Browse files

SW-43: add support for attributes

parent d6645da6
No related branches found
No related tags found
1 merge request!44Merge back holography to master
...@@ -361,6 +361,12 @@ class HolographyDataset(): ...@@ -361,6 +361,12 @@ class HolographyDataset():
""" """
starting_leaf = h5file[uri] starting_leaf = h5file[uri]
result = dict() result = dict()
# Read the attributes in the hdf5 dataset
result['ATTRIBUTES'] = dict()
for attribute_key, attribute_value in starting_leaf.attrs:
result['ATTRIBUTES'][attribute_key] = attribute_value
for key, value in starting_leaf.items(): for key, value in starting_leaf.items():
if isinstance(value, h5py.Group) is True: if isinstance(value, h5py.Group) is True:
...@@ -391,6 +397,11 @@ class HolographyDataset(): ...@@ -391,6 +397,11 @@ class HolographyDataset():
else: else:
starting_leaf = h5file[uri] starting_leaf = h5file[uri]
# Store the attributes in the hdf5 dataset
attributes = data_to_store.pop('ATTRIBUTES', dict())
for attribute_key, attribute_value in attributes.items():
starting_leaf.attrs[attribute_key] = attribute_value
for key, value in data_to_store.items(): for key, value in data_to_store.items():
if isinstance(value, dict) is True: if isinstance(value, dict) is True:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment