From 94e076e976dda816d8f396daf01f44a55da9c2cd Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Tue, 18 Jul 2023 10:28:27 +0800 Subject: [PATCH] scan: rename ndecimals to precison --- artiq/language/scan.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/artiq/language/scan.py b/artiq/language/scan.py index 0454ef362..0f05d3756 100644 --- a/artiq/language/scan.py +++ b/artiq/language/scan.py @@ -191,11 +191,14 @@ class Scannable: :param unit: A string representing the unit of the scanned variable. :param scale: A numerical scaling factor by which the displayed values are multiplied when referenced in the experiment. - :param ndecimals: The number of decimals a UI should use. + :param precision: The maximum number of decimals a UI should use. """ - def __init__(self, default=NoDefault, unit="", scale=None, + def __init__(self, default=NoDefault, unit="", *, scale=None, global_step=None, global_min=None, global_max=None, - ndecimals=2): + precision=2, ndecimals=None): + if ndecimals is not None: + print("DeprecationWarning: 'ndecimals' is deprecated. Please use 'precision' instead.") + precision = ndecimals if scale is None: if unit == "": scale = 1.0 @@ -216,7 +219,7 @@ class Scannable: self.global_step = global_step self.global_min = global_min self.global_max = global_max - self.ndecimals = ndecimals + self.precision = precision def default(self): if not hasattr(self, "default_values"): @@ -240,7 +243,7 @@ class Scannable: d["global_step"] = self.global_step d["global_min"] = self.global_min d["global_max"] = self.global_max - d["ndecimals"] = self.ndecimals + d["precision"] = self.precision return d