forked from M-Labs/artiq
1
0
Fork 0

environment: add get_dataset_metadata

This commit is contained in:
Simon Renblad 2023-06-19 12:40:45 +08:00 committed by Sébastien Bourdeauducq
parent 748707e157
commit 337273acb6
1 changed files with 18 additions and 0 deletions

View File

@ -420,6 +420,24 @@ class HasEnvironment:
else:
return default
def get_dataset_metadata(self, key, default=NoDefault):
"""Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units,
scale and precision.
This function is used to get additional information for displaying the dataset.
See ``set_dataset`` for documentation of metadata items.
"""
try:
return self.__dataset_mgr.get_metadata(key)
except KeyError:
if default is NoDefault:
raise
else:
return default
def setattr_dataset(self, key, default=NoDefault, archive=True):
"""Sets the contents of a dataset as attribute. The names of the
dataset and of the attribute are the same."""