forked from M-Labs/artiq
experiment: simplify definition of kernel_attr
This commit is contained in:
parent
8cc9c9eed6
commit
3cd462f4d5
@ -11,8 +11,8 @@ class DDS:
|
|||||||
|
|
||||||
self._previous_frequency = 0*MHz
|
self._previous_frequency = 0*MHz
|
||||||
|
|
||||||
kernel_attr_ro = {"reg_channel", "rtio_channel", "latency", "phase_mode"}
|
kernel_attr_ro = "reg_channel rtio_channel latency phase_mode"
|
||||||
kernel_attr = {"_previous_frequency"}
|
kernel_attr = "_previous_frequency"
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def pulse(self, frequency, duration):
|
def pulse(self, frequency, duration):
|
||||||
|
@ -5,9 +5,7 @@ class Experiment:
|
|||||||
parameters = ""
|
parameters = ""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
channels = self.channels.split()
|
argnames = self.channels.split() + self.parameters.split()
|
||||||
parameters = self.parameters.split()
|
|
||||||
argnames = channels + parameters
|
|
||||||
undef_args = list(argnames)
|
undef_args = list(argnames)
|
||||||
|
|
||||||
if len(argnames) < len(args):
|
if len(argnames) < len(args):
|
||||||
@ -23,7 +21,7 @@ class Experiment:
|
|||||||
raise TypeError("__init__() missing {} argument(s): ".format(len(undef_args),
|
raise TypeError("__init__() missing {} argument(s): ".format(len(undef_args),
|
||||||
", ".join(["'"+s+"'" for s in undef_args])))
|
", ".join(["'"+s+"'" for s in undef_args])))
|
||||||
|
|
||||||
self.kernel_attr_ro = set(parameters)
|
self.kernel_attr_ro = self.parameters
|
||||||
|
|
||||||
def kernel(arg):
|
def kernel(arg):
|
||||||
if isinstance(arg, str):
|
if isinstance(arg, str):
|
||||||
|
Loading…
Reference in New Issue
Block a user