diff --git a/artiq/language/environment.py b/artiq/language/environment.py index bc5761feb..bc0229998 100644 --- a/artiq/language/environment.py +++ b/artiq/language/environment.py @@ -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."""