From d1f2727126b64fe8eb983ec9b70b6480bbcdd87a Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Wed, 12 Jul 2023 10:33:22 +0800 Subject: [PATCH] simple: refactor RPC client set_dataset --- artiq/applets/simple.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/artiq/applets/simple.py b/artiq/applets/simple.py index 7aab32b05..c04abeb87 100644 --- a/artiq/applets/simple.py +++ b/artiq/applets/simple.py @@ -49,8 +49,15 @@ class AppletControlRPC: self.background_tasks.add(task) task.add_done_callback(self.background_tasks.discard) - def set_dataset(self, key, value, persist=None): - self._background(self.dataset_ctl.set, key, value, persist) + def set_dataset(self, key, value, unit=None, scale=None, precision=None, persist=None): + metadata = {} + if unit is not None: + metadata["unit"] = unit + if scale is not None: + metadata["scale"] = scale + if precision is not None: + metadata["precision"] = precision + self._background(self.dataset_ctl.set, key, value, metadata=metadata, persist=persist) def mutate_dataset(self, key, index, value): mod = {"action": "setitem", "path": [key, 1], "key": index, "value": value}