language/scan: mark scan objects

This commit is contained in:
Sebastien Bourdeauducq 2015-09-05 14:42:19 -06:00
parent b3831d3387
commit d621780206
1 changed files with 11 additions and 5 deletions

View File

@ -25,10 +25,16 @@ from artiq.language.core import *
from artiq.language.environment import NoDefault, DefaultMissing from artiq.language.environment import NoDefault, DefaultMissing
__all__ = ["NoScan", "LinearScan", "RandomScan", "ExplicitScan", "Scannable"] __all__ = ["ScanObject",
"NoScan", "LinearScan", "RandomScan", "ExplicitScan",
"Scannable"]
class NoScan: class ScanObject:
pass
class NoScan(ScanObject):
"""A scan object that yields a single value.""" """A scan object that yields a single value."""
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
@ -45,7 +51,7 @@ class NoScan:
return {"ty": "NoScan", "value": self.value} return {"ty": "NoScan", "value": self.value}
class LinearScan: 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):
@ -69,7 +75,7 @@ class LinearScan:
"min": self.min, "max": self.max, "npoints": self.npoints} "min": self.min, "max": self.max, "npoints": self.npoints}
class RandomScan: 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):
@ -85,7 +91,7 @@ class RandomScan:
"min": self.min, "max": self.max, "npoints": self.npoints} "min": self.min, "max": self.max, "npoints": self.npoints}
class ExplicitScan: class ExplicitScan(ScanObject):
"""A scan object that yields values from an explicitly defined sequence.""" """A scan object that yields values from an explicitly defined sequence."""
def __init__(self, sequence): def __init__(self, sequence):
self.sequence = sequence self.sequence = sequence