diff --git a/src/exdf/write/datafile.py b/src/exdf/write/datafile.py index 32fc13d06f65a77445d1b37400dcd52933ece5fd..82c2cabc7cc8c226d30583a72592df61072765f5 100644 --- a/src/exdf/write/datafile.py +++ b/src/exdf/write/datafile.py @@ -470,7 +470,7 @@ class ControlSource(Source): return self.file.require_group(f'INDEX/{self._exdf_source}') def create_key(self, key, values=None, timestamps=None, run_entry=None, - attrs=None): + attrs=None, attrs_value=None, attrs_timestamp=None): """Create datasets for a key varying each train. Args: @@ -506,13 +506,21 @@ class ControlSource(Source): if attrs is not None: grp.attrs.update(attrs) + if attrs_value is not None: + grp['value'].attrs.update(attrs_value) + + if attrs_timestamp is not None: + grp['timestamp'].attrs.update(attrs_timestamp) + if run_entry is not False: if run_entry is None and values is not None: run_entry = (values[0], timestamps[0]) - self.create_run_key(key, *run_entry, attrs) + self.create_run_key(key, *run_entry, attrs, attrs_value, + attrs_timestamp) - def create_run_key(self, key, value, timestamp=None, attrs=None): + def create_run_key(self, key, value, timestamp=None, attrs=None, + attrs_value=None, attrs_timestamp=None): """Create datasets for a key constant over a run. Args: @@ -560,6 +568,12 @@ class ControlSource(Source): if attrs is not None: grp.attrs.update(attrs) + if attrs_value is not None: + grp['value'].attrs.update(attrs_value) + + if attrs_timestamp is not None: + grp['timestamp'].attrs.update(attrs_timestamp) + return grp def create_index(self, num_trains, per_train=None):