mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 11:48:27 +08:00
added repetitions for no scan, repetitions set to one when disable other scans selected. Closes #532
This commit is contained in:
parent
b73d7e402c
commit
d4af4414e7
@ -136,6 +136,18 @@ class _NoScan(LayoutWidget):
|
|||||||
state["value"] = value*scale
|
state["value"] = value*scale
|
||||||
self.value.valueChanged.connect(update)
|
self.value.valueChanged.connect(update)
|
||||||
|
|
||||||
|
self.repetitions = QtWidgets.QSpinBox()
|
||||||
|
self.repetitions.setMinimum(1)
|
||||||
|
self.repetitions.setMaximum((1 << 31) - 1)
|
||||||
|
disable_scroll_wheel(self.repetitions)
|
||||||
|
self.addWidget(QtWidgets.QLabel("Repetitions:"), 1, 0)
|
||||||
|
self.addWidget(self.repetitions, 1, 1)
|
||||||
|
|
||||||
|
self.repetitions.setValue(state["repetitions"])
|
||||||
|
|
||||||
|
def update_repetitions(value):
|
||||||
|
state["repetitions"] = value
|
||||||
|
self.repetitions.valueChanged.connect(update_repetitions)
|
||||||
|
|
||||||
class _RangeScan(LayoutWidget):
|
class _RangeScan(LayoutWidget):
|
||||||
def __init__(self, procdesc, state):
|
def __init__(self, procdesc, state):
|
||||||
@ -272,6 +284,7 @@ class ScanEntry(LayoutWidget):
|
|||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
self.radiobuttons["NoScan"].setChecked(True)
|
self.radiobuttons["NoScan"].setChecked(True)
|
||||||
|
self.widgets["NoScan"].repetitions.setValue(1)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def state_to_value(state):
|
def state_to_value(state):
|
||||||
@ -285,7 +298,7 @@ class ScanEntry(LayoutWidget):
|
|||||||
scale = procdesc["scale"]
|
scale = procdesc["scale"]
|
||||||
state = {
|
state = {
|
||||||
"selected": "NoScan",
|
"selected": "NoScan",
|
||||||
"NoScan": {"value": 0.0},
|
"NoScan": {"value": 0.0, "repetitions": 1},
|
||||||
"LinearScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
|
"LinearScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
|
||||||
"RandomScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
|
"RandomScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
|
||||||
"ExplicitScan": {"sequence": []}
|
"ExplicitScan": {"sequence": []}
|
||||||
@ -299,6 +312,7 @@ class ScanEntry(LayoutWidget):
|
|||||||
ty = default["ty"]
|
ty = default["ty"]
|
||||||
if ty == "NoScan":
|
if ty == "NoScan":
|
||||||
state[ty]["value"] = default["value"]
|
state[ty]["value"] = default["value"]
|
||||||
|
state[ty]["repetitions"] = default["repetitions"]
|
||||||
elif ty == "LinearScan" or ty == "RandomScan":
|
elif ty == "LinearScan" or ty == "RandomScan":
|
||||||
state[ty]["start"] = default["start"]
|
state[ty]["start"] = default["start"]
|
||||||
state[ty]["stop"] = default["stop"]
|
state[ty]["stop"] = default["stop"]
|
||||||
|
@ -36,12 +36,15 @@ class ScanObject:
|
|||||||
|
|
||||||
|
|
||||||
class NoScan(ScanObject):
|
class NoScan(ScanObject):
|
||||||
"""A scan object that yields a single value."""
|
"""A scan object that yields a single value for a specified number
|
||||||
def __init__(self, value):
|
of repetitions."""
|
||||||
|
def __init__(self, value, repetitions):
|
||||||
self.value = value
|
self.value = value
|
||||||
|
self.repetitions = repetitions
|
||||||
|
|
||||||
@portable
|
@portable
|
||||||
def _gen(self):
|
def _gen(self):
|
||||||
|
for i in range(self.repetitions):
|
||||||
yield self.value
|
yield self.value
|
||||||
|
|
||||||
@portable
|
@portable
|
||||||
@ -49,10 +52,11 @@ class NoScan(ScanObject):
|
|||||||
return self._gen()
|
return self._gen()
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return 1
|
return self.repetitions
|
||||||
|
|
||||||
def describe(self):
|
def describe(self):
|
||||||
return {"ty": "NoScan", "value": self.value}
|
return {"ty": "NoScan", "value": self.value,
|
||||||
|
"repetitions": self.repetitions}
|
||||||
|
|
||||||
|
|
||||||
class LinearScan(ScanObject):
|
class LinearScan(ScanObject):
|
||||||
|
Loading…
Reference in New Issue
Block a user