forked from M-Labs/artiq
scan: enforce max >= min
This commit is contained in:
parent
277e26434f
commit
a6f3055cd3
|
@ -38,7 +38,6 @@ class _NoScan(LayoutWidget):
|
||||||
self.value.valueChanged.connect(update)
|
self.value.valueChanged.connect(update)
|
||||||
|
|
||||||
|
|
||||||
# TODO: prevent max < min
|
|
||||||
class _Range(LayoutWidget):
|
class _Range(LayoutWidget):
|
||||||
def __init__(self, procdesc, state):
|
def __init__(self, procdesc, state):
|
||||||
LayoutWidget.__init__(self)
|
LayoutWidget.__init__(self)
|
||||||
|
|
|
@ -58,6 +58,8 @@ class LinearScan(ScanObject):
|
||||||
"""A scan object that yields a fixed number of increasing evenly
|
"""A scan object that yields a fixed number of increasing evenly
|
||||||
spaced values in a range."""
|
spaced values in a range."""
|
||||||
def __init__(self, min, max, npoints):
|
def __init__(self, min, max, npoints):
|
||||||
|
if min > max:
|
||||||
|
raise ValueError("Scan minimum must be less than maximum")
|
||||||
self.min = min
|
self.min = min
|
||||||
self.max = max
|
self.max = max
|
||||||
self.npoints = npoints
|
self.npoints = npoints
|
||||||
|
@ -85,6 +87,8 @@ class RandomScan(ScanObject):
|
||||||
"""A scan object that yields a fixed number of randomly ordered evenly
|
"""A scan object that yields a fixed number of randomly ordered evenly
|
||||||
spaced values in a range."""
|
spaced values in a range."""
|
||||||
def __init__(self, min, max, npoints, seed=0):
|
def __init__(self, min, max, npoints, seed=0):
|
||||||
|
if min > max:
|
||||||
|
raise ValueError("Scan minimum must be less than maximum")
|
||||||
self.min = min
|
self.min = min
|
||||||
self.max = max
|
self.max = max
|
||||||
self.npoints = npoints
|
self.npoints = npoints
|
||||||
|
|
Loading…
Reference in New Issue