Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b73d7e402c0c
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 736927b6da73
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Sep 13, 2016

  1. added repetitions for no scan, repetitions set to one when disable ot…

    …her scans selected. Closes #532
    raghu authored and sbourdeauducq committed Sep 13, 2016
    Copy the full SHA
    d4af441 View commit details
  2. Copy the full SHA
    736927b View commit details
Showing with 24 additions and 6 deletions.
  1. +15 −1 artiq/gui/entries.py
  2. +9 −5 artiq/language/scan.py
16 changes: 15 additions & 1 deletion artiq/gui/entries.py
Original file line number Diff line number Diff line change
@@ -136,6 +136,18 @@ def update(value):
state["value"] = value*scale
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):
def __init__(self, procdesc, state):
@@ -272,6 +284,7 @@ def __init__(self, argument):

def disable(self):
self.radiobuttons["NoScan"].setChecked(True)
self.widgets["NoScan"].repetitions.setValue(1)

@staticmethod
def state_to_value(state):
@@ -285,7 +298,7 @@ def default_state(procdesc):
scale = procdesc["scale"]
state = {
"selected": "NoScan",
"NoScan": {"value": 0.0},
"NoScan": {"value": 0.0, "repetitions": 1},
"LinearScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
"RandomScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
"ExplicitScan": {"sequence": []}
@@ -299,6 +312,7 @@ def default_state(procdesc):
ty = default["ty"]
if ty == "NoScan":
state[ty]["value"] = default["value"]
state[ty]["repetitions"] = default["repetitions"]
elif ty == "LinearScan" or ty == "RandomScan":
state[ty]["start"] = default["start"]
state[ty]["stop"] = default["stop"]
14 changes: 9 additions & 5 deletions artiq/language/scan.py
Original file line number Diff line number Diff line change
@@ -36,23 +36,27 @@ class ScanObject:


class NoScan(ScanObject):
"""A scan object that yields a single value."""
def __init__(self, value):
"""A scan object that yields a single value for a specified number
of repetitions."""
def __init__(self, value, repetitions=1):
self.value = value
self.repetitions = repetitions

@portable
def _gen(self):
yield self.value
for i in range(self.repetitions):
yield self.value

@portable
def __iter__(self):
return self._gen()

def __len__(self):
return 1
return self.repetitions

def describe(self):
return {"ty": "NoScan", "value": self.value}
return {"ty": "NoScan", "value": self.value,
"repetitions": self.repetitions}


class LinearScan(ScanObject):