diff --git a/artiq/language/experiment.py b/artiq/language/experiment.py index 5b7f0395a..af8dca05b 100644 --- a/artiq/language/experiment.py +++ b/artiq/language/experiment.py @@ -1,4 +1,5 @@ import itertools +from collections import namedtuple class Experiment: channels = "" @@ -23,16 +24,20 @@ class Experiment: self.kernel_attr_ro = self.parameters +KernelFunctionInfo = namedtuple("KernelFunctionInfo", "core_name k_function") + def kernel(arg): if isinstance(arg, str): def real_decorator(k_function): def run_on_core(exp, *k_args, **k_kwargs): - getattr(exp, arg).run(k_function, exp, *k_args, **k_kwargs) - return run_on_core + getattr(exp, arg).run(k_function, ((exp,) + k_args), k_kwargs) + run_on_core.k_function_info = KernelFunctionInfo(core_name=arg, k_function=k_function) + return run_on_core return real_decorator else: def run_on_core(exp, *k_args, **k_kwargs): - exp.core.run(arg, exp, *k_args, **k_kwargs) + exp.core.run(arg, ((exp,) + k_args), k_kwargs) + run_on_core.k_function_info = KernelFunctionInfo(core_name="core", k_function=arg) return run_on_core class _DummyTimeManager: diff --git a/artiq/sim/devices.py b/artiq/sim/devices.py index bc6621c05..65e814eb9 100644 --- a/artiq/sim/devices.py +++ b/artiq/sim/devices.py @@ -4,7 +4,7 @@ from artiq.language import units from artiq.sim import time class Core: - def run(self, k_function, *k_args, **k_kwargs): + def run(self, k_function, k_args, k_kwargs): return k_function(*k_args, **k_kwargs) class Input: