forked from M-Labs/artiq
1
0
Fork 0

scan: rename ndecimals to precison

This commit is contained in:
Simon Renblad 2023-07-18 10:28:27 +08:00 committed by Sébastien Bourdeauducq
parent a0094aafbb
commit 94e076e976
1 changed files with 8 additions and 5 deletions

View File

@ -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