2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-26 03:38:25 +08:00

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

View File

@ -420,6 +420,24 @@ class HasEnvironment:
else: else:
return default 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): def setattr_dataset(self, key, default=NoDefault, archive=True):
"""Sets the contents of a dataset as attribute. The names of the """Sets the contents of a dataset as attribute. The names of the
dataset and of the attribute are the same.""" dataset and of the attribute are the same."""