From 50a5a3baf0b3e4524b2f5b7d47ce62b4bf4212f1 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 4 Oct 2015 00:18:21 +0800 Subject: [PATCH] environment: attr_* -> setattr_* --- artiq/frontend/artiq_run.py | 4 +- artiq/language/environment.py | 6 +-- artiq/test/coredevice.py | 48 +++++++++---------- artiq/test/coredevice_vs_host.py | 26 +++++----- artiq/test/scheduler.py | 2 +- doc/manual/getting_started_core.rst | 18 +++---- doc/manual/getting_started_mgmt.rst | 2 +- examples/master/repository/arguments_demo.py | 38 +++++++-------- examples/master/repository/dds_test.py | 18 +++---- .../repository/flopping_f_simulation.py | 8 ++-- examples/master/repository/handover.py | 4 +- examples/master/repository/mandelbrot.py | 2 +- .../master/repository/photon_histogram.py | 24 +++++----- examples/master/repository/speed_benchmark.py | 34 ++++++------- examples/master/repository/tdr.py | 6 +-- examples/master/repository/transport.py | 18 +++---- examples/sim/al_spectroscopy.py | 20 ++++---- examples/sim/simple_simulation.py | 4 +- 18 files changed, 141 insertions(+), 141 deletions(-) diff --git a/artiq/frontend/artiq_run.py b/artiq/frontend/artiq_run.py index 91636f762..794abbf4e 100755 --- a/artiq/frontend/artiq_run.py +++ b/artiq/frontend/artiq_run.py @@ -22,8 +22,8 @@ logger = logging.getLogger(__name__) class ELFRunner(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_argument("file") + self.setattr_device("core") + self.setattr_argument("file") def run(self): with open(self.file, "rb") as f: diff --git a/artiq/language/environment.py b/artiq/language/environment.py index e49246caf..99332e9a3 100644 --- a/artiq/language/environment.py +++ b/artiq/language/environment.py @@ -177,7 +177,7 @@ class HasEnvironment: raise return processor.process(argval) - def attr_argument(self, key, processor=None, group=None): + def setattr_argument(self, key, processor=None, group=None): """Sets an argument as attribute. The names of the argument and of the attribute are the same.""" setattr(self, key, self.get_argument(key, processor, group)) @@ -190,7 +190,7 @@ class HasEnvironment: raise ValueError("Device manager not present") return self.__dmgr.get(key) - def attr_device(self, key): + def setattr_device(self, key): """Sets a device driver as attribute. The names of the device driver and of the attribute are the same.""" setattr(self, key, self.get_device(key)) @@ -211,7 +211,7 @@ class HasEnvironment: else: raise - def attr_parameter(self, key, default=NoDefault): + def setattr_parameter(self, key, default=NoDefault): """Sets a parameter as attribute. The names of the argument and of the parameter are the same.""" setattr(self, key, self.get_parameter(key, default)) diff --git a/artiq/test/coredevice.py b/artiq/test/coredevice.py index 97347667e..33fad9098 100644 --- a/artiq/test/coredevice.py +++ b/artiq/test/coredevice.py @@ -11,8 +11,8 @@ from artiq.coredevice import runtime_exceptions class RTT(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl_inout") + self.setattr_device("core") + self.setattr_device("ttl_inout") def set_rtt(self, rtt): self.set_result("rtt", rtt) @@ -34,9 +34,9 @@ class RTT(EnvExperiment): class Loopback(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("loop_in") - self.attr_device("loop_out") + self.setattr_device("core") + self.setattr_device("loop_in") + self.setattr_device("loop_out") def set_rtt(self, rtt): self.set_result("rtt", rtt) @@ -56,9 +56,9 @@ class Loopback(EnvExperiment): class ClockGeneratorLoopback(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("loop_clock_in") - self.attr_device("loop_clock_out") + self.setattr_device("core") + self.setattr_device("loop_clock_in") + self.setattr_device("loop_clock_out") def set_count(self, count): self.set_result("count", count) @@ -78,8 +78,8 @@ class ClockGeneratorLoopback(EnvExperiment): class PulseRate(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl_out") + self.setattr_device("core") + self.setattr_device("ttl_out") def set_pulse_rate(self, pulse_rate): self.set_result("pulse_rate", pulse_rate) @@ -102,7 +102,7 @@ class PulseRate(EnvExperiment): class Watchdog(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") @kernel def run(self): @@ -113,9 +113,9 @@ class Watchdog(EnvExperiment): class LoopbackCount(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl_inout") - self.attr_argument("npulses") + self.setattr_device("core") + self.setattr_device("ttl_inout") + self.setattr_argument("npulses") def set_count(self, count): self.set_result("count", count) @@ -135,8 +135,8 @@ class LoopbackCount(EnvExperiment): class Underflow(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl_out") + self.setattr_device("core") + self.setattr_device("ttl_out") @kernel def run(self): @@ -147,8 +147,8 @@ class Underflow(EnvExperiment): class SequenceError(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl_out") + self.setattr_device("core") + self.setattr_device("ttl_out") @kernel def run(self): @@ -160,8 +160,8 @@ class SequenceError(EnvExperiment): class CollisionError(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl_out_serdes") + self.setattr_device("core") + self.setattr_device("ttl_out_serdes") @kernel def run(self): @@ -173,7 +173,7 @@ class CollisionError(EnvExperiment): class TimeKeepsRunning(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") def set_time_at_start(self, time_at_start): self.set_result("time_at_start", time_at_start) @@ -185,7 +185,7 @@ class TimeKeepsRunning(EnvExperiment): class Handover(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") @kernel def get_now(self): @@ -265,8 +265,8 @@ class CoredeviceTest(ExperimentCase): class RPCTiming(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_argument("repeats", FreeValue(100)) + self.setattr_device("core") + self.setattr_argument("repeats", FreeValue(100)) def nop(self, x): pass diff --git a/artiq/test/coredevice_vs_host.py b/artiq/test/coredevice_vs_host.py index 31ef27da4..2a412233f 100644 --- a/artiq/test/coredevice_vs_host.py +++ b/artiq/test/coredevice_vs_host.py @@ -16,9 +16,9 @@ def _run_on_host(k_class, **arguments): class _Primes(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_argument("output_list") - self.attr_argument("maximum") + self.setattr_device("core") + self.setattr_argument("output_list") + self.setattr_argument("maximum") @kernel def run(self): @@ -36,7 +36,7 @@ class _Primes(EnvExperiment): class _Misc(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") self.input = 84 self.al = [1, 2, 3, 4, 5] @@ -54,9 +54,9 @@ class _Misc(EnvExperiment): class _PulseLogger(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_argument("output_list") - self.attr_argument("name") + self.setattr_device("core") + self.setattr_argument("output_list") + self.setattr_argument("name") def _append(self, t, l, f): if not hasattr(self, "first_timestamp"): @@ -81,8 +81,8 @@ class _PulseLogger(EnvExperiment): class _Pulses(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_argument("output_list") + self.setattr_device("core") + self.setattr_argument("output_list") for name in "a", "b", "c", "d": pl = _PulseLogger(*self.dbs(), @@ -108,8 +108,8 @@ class _MyException(Exception): class _Exceptions(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_argument("trace") + self.setattr_device("core") + self.setattr_argument("trace") @kernel def run(self): @@ -152,8 +152,8 @@ class _Exceptions(EnvExperiment): class _RPCExceptions(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_argument("catch", FreeValue(False)) + self.setattr_device("core") + self.setattr_argument("catch", FreeValue(False)) self.success = False diff --git a/artiq/test/scheduler.py b/artiq/test/scheduler.py index 33e712fb5..3e5298056 100644 --- a/artiq/test/scheduler.py +++ b/artiq/test/scheduler.py @@ -18,7 +18,7 @@ class EmptyExperiment(EnvExperiment): class BackgroundExperiment(EnvExperiment): def build(self): - self.attr_device("scheduler") + self.setattr_device("scheduler") def run(self): while True: diff --git a/doc/manual/getting_started_core.rst b/doc/manual/getting_started_core.rst index 49f850cfe..b7a9c6f5e 100644 --- a/doc/manual/getting_started_core.rst +++ b/doc/manual/getting_started_core.rst @@ -13,14 +13,14 @@ As a very first step, we will turn on a LED on the core device. Create a file `` class LED(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("led") + self.setattr_device("core") + self.setattr_device("led") @kernel def run(self): self.led.on() -The central part of our code is our ``LED`` class, that derives from :class:`artiq.language.environment.EnvExperiment`. Among other features, ``EnvExperiment`` calls our ``build`` method and provides the ``attr_device`` method that interfaces to the device database to create the appropriate device drivers and make those drivers accessible as ``self.core`` and ``self.led``. The ``@kernel`` decorator tells the system that the ``run`` method must be executed on the core device (instead of the host). The decorator uses ``self.core`` internally, which is why we request the core device using ``attr_device`` like any other. +The central part of our code is our ``LED`` class, that derives from :class:`artiq.language.environment.EnvExperiment`. Among other features, ``EnvExperiment`` calls our ``build`` method and provides the ``setattr_device`` method that interfaces to the device database to create the appropriate device drivers and make those drivers accessible as ``self.core`` and ``self.led``. The ``@kernel`` decorator tells the system that the ``run`` method must be executed on the core device (instead of the host). The decorator uses ``self.core`` internally, which is why we request the core device using ``setattr_device`` like any other. Copy the files ``ddb.pyon`` and ``pdb.pyon`` (containing the device and parameter databases) from the ``examples/master`` folder of ARTIQ into the same directory as ``led.py`` (alternatively, you can use the ``-d`` and ``-p`` options of ``artiq_run``). You can open the database files using a text editor - their contents are in a human-readable format. You will probably want to set the IP address of the core device in ``ddb.pyon`` so that the computer can connect to it (it is the ``host`` parameter of the ``comm`` entry). See :ref:`ddb` for more information. The example device database is designed for the NIST QC1 hardware on the KC705; see :ref:`board-ports` for RTIO channel assignments if you need to adapt the device database to a different hardware platform. @@ -48,8 +48,8 @@ Modify the code as follows: :: class LED(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("led") + self.setattr_device("core") + self.setattr_device("led") @kernel def run(self): @@ -98,8 +98,8 @@ Create a new file ``rtio.py`` containing the following: :: class Tutorial(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl0") + self.setattr_device("core") + self.setattr_device("ttl0") @kernel def run(self): @@ -122,8 +122,8 @@ Try reducing the period of the generated waveform until the CPU cannot keep up w class Tutorial(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("ttl0") + self.setattr_device("core") + self.setattr_device("ttl0") @kernel def run(self): diff --git a/doc/manual/getting_started_mgmt.rst b/doc/manual/getting_started_mgmt.rst index 5f0175999..40c8a2054 100644 --- a/doc/manual/getting_started_mgmt.rst +++ b/doc/manual/getting_started_mgmt.rst @@ -53,7 +53,7 @@ Experiments may have arguments whose values can be set in the GUI and used in th def build(self): - self.attr_argument("count", NumberValue(ndecimals=0)) + self.setattr_argument("count", NumberValue(ndecimals=0)) def run(self): for i in range(int(self.count)): diff --git a/examples/master/repository/arguments_demo.py b/examples/master/repository/arguments_demo.py index 08ef43ba2..dad66d8a2 100644 --- a/examples/master/repository/arguments_demo.py +++ b/examples/master/repository/arguments_demo.py @@ -3,10 +3,10 @@ from artiq import * class SubComponent1(HasEnvironment): def build(self): - self.attr_argument("sc1_scan", Scannable(default=NoScan(325)), - "Flux capacitor") - self.attr_argument("sc1_enum", EnumerationValue(["1", "2", "3"]), - "Flux capacitor") + self.setattr_argument("sc1_scan", Scannable(default=NoScan(325)), + "Flux capacitor") + self.setattr_argument("sc1_enum", EnumerationValue(["1", "2", "3"]), + "Flux capacitor") def do(self): print("SC1:") @@ -17,12 +17,12 @@ class SubComponent1(HasEnvironment): class SubComponent2(HasEnvironment): def build(self): - self.attr_argument("sc2_boolean", BooleanValue(False), - "Transporter") - self.attr_argument("sc2_scan", Scannable(default=NoScan(325)), - "Transporter") - self.attr_argument("sc2_enum", EnumerationValue(["3", "4", "5"]), - "Transporter") + self.setattr_argument("sc2_boolean", BooleanValue(False), + "Transporter") + self.setattr_argument("sc2_scan", Scannable(default=NoScan(325)), + "Transporter") + self.setattr_argument("sc2_enum", EnumerationValue(["3", "4", "5"]), + "Transporter") def do(self): print("SC2:") @@ -34,15 +34,15 @@ class SubComponent2(HasEnvironment): class ArgumentsDemo(EnvExperiment): def build(self): - self.attr_argument("free_value", FreeValue(None)) - self.attr_argument("number", NumberValue(42, unit="s", step=0.1, - ndecimals=4)) - self.attr_argument("string", StringValue("Hello World")) - self.attr_argument("scan", Scannable(global_max=400, - default=NoScan(325), - ndecimals=6)) - self.attr_argument("boolean", BooleanValue(True), "Group") - self.attr_argument("enum", EnumerationValue( + self.setattr_argument("free_value", FreeValue(None)) + self.setattr_argument("number", NumberValue(42, unit="s", step=0.1, + ndecimals=4)) + self.setattr_argument("string", StringValue("Hello World")) + self.setattr_argument("scan", Scannable(global_max=400, + default=NoScan(325), + ndecimals=6)) + self.setattr_argument("boolean", BooleanValue(True), "Group") + self.setattr_argument("enum", EnumerationValue( ["foo", "bar", "quux"], "foo"), "Group") self.sc1 = SubComponent1(parent=self) diff --git a/examples/master/repository/dds_test.py b/examples/master/repository/dds_test.py index ff4458abc..cc2d4e6db 100644 --- a/examples/master/repository/dds_test.py +++ b/examples/master/repository/dds_test.py @@ -5,15 +5,15 @@ class DDSTest(EnvExperiment): """DDS test""" def build(self): - self.attr_device("core") - self.attr_device("dds_bus") - self.attr_device("dds0") - self.attr_device("dds1") - self.attr_device("dds2") - self.attr_device("ttl0") - self.attr_device("ttl1") - self.attr_device("ttl2") - self.attr_device("led") + self.setattr_device("core") + self.setattr_device("dds_bus") + self.setattr_device("dds0") + self.setattr_device("dds1") + self.setattr_device("dds2") + self.setattr_device("ttl0") + self.setattr_device("ttl1") + self.setattr_device("ttl2") + self.setattr_device("led") @kernel def run(self): diff --git a/examples/master/repository/flopping_f_simulation.py b/examples/master/repository/flopping_f_simulation.py index f0b4f4461..90cb2468d 100644 --- a/examples/master/repository/flopping_f_simulation.py +++ b/examples/master/repository/flopping_f_simulation.py @@ -27,14 +27,14 @@ class FloppingF(EnvExperiment): """Flopping F simulation""" def build(self): - self.attr_argument("frequency_scan", Scannable( + self.setattr_argument("frequency_scan", Scannable( default=LinearScan(1000, 2000, 100))) - self.attr_argument("F0", NumberValue(1500, min=1000, max=2000)) - self.attr_argument("noise_amplitude", NumberValue(0.1, min=0, max=100, + self.setattr_argument("F0", NumberValue(1500, min=1000, max=2000)) + self.setattr_argument("noise_amplitude", NumberValue(0.1, min=0, max=100, step=0.01)) - self.attr_device("scheduler") + self.setattr_device("scheduler") def run(self): frequency = self.set_result("flopping_f_frequency", [], diff --git a/examples/master/repository/handover.py b/examples/master/repository/handover.py index 5870d27ba..ef3512bf8 100644 --- a/examples/master/repository/handover.py +++ b/examples/master/repository/handover.py @@ -3,8 +3,8 @@ from artiq import * class Handover(EnvExperiment): def build(self): - self.attr_device("core") - self.attr_device("led") + self.setattr_device("core") + self.setattr_device("led") @kernel def blink_once(self): diff --git a/examples/master/repository/mandelbrot.py b/examples/master/repository/mandelbrot.py index a14e58900..b03fa81d8 100644 --- a/examples/master/repository/mandelbrot.py +++ b/examples/master/repository/mandelbrot.py @@ -7,7 +7,7 @@ class Mandelbrot(EnvExperiment): """Mandelbrot set demo""" def build(self): - self.attr_device("core") + self.setattr_device("core") def col(self, i): sys.stdout.write(" .,-:;i+hHM$*#@ "[i]) diff --git a/examples/master/repository/photon_histogram.py b/examples/master/repository/photon_histogram.py index bad44e1b7..99f66c388 100644 --- a/examples/master/repository/photon_histogram.py +++ b/examples/master/repository/photon_histogram.py @@ -5,20 +5,20 @@ class PhotonHistogram(EnvExperiment): """Photon histogram""" def build(self): - self.attr_device("core") - self.attr_device("dds_bus") - self.attr_device("bd_dds") - self.attr_device("bd_sw") - self.attr_device("bdd_dds") - self.attr_device("bdd_sw") - self.attr_device("pmt") + self.setattr_device("core") + self.setattr_device("dds_bus") + self.setattr_device("bd_dds") + self.setattr_device("bd_sw") + self.setattr_device("bdd_dds") + self.setattr_device("bdd_sw") + self.setattr_device("pmt") - self.attr_argument("nbins", FreeValue(100)) - self.attr_argument("repeats", FreeValue(100)) + self.setattr_argument("nbins", FreeValue(100)) + self.setattr_argument("repeats", FreeValue(100)) - self.attr_parameter("cool_f", 230*MHz) - self.attr_parameter("detect_f", 220*MHz) - self.attr_parameter("detect_t", 100*us) + self.setattr_parameter("cool_f", 230*MHz) + self.setattr_parameter("detect_f", 220*MHz) + self.setattr_parameter("detect_t", 100*us) @kernel def program_cooling(self): diff --git a/examples/master/repository/speed_benchmark.py b/examples/master/repository/speed_benchmark.py index 1105d7f4c..8d8921bcb 100644 --- a/examples/master/repository/speed_benchmark.py +++ b/examples/master/repository/speed_benchmark.py @@ -13,7 +13,7 @@ class _PayloadNOP(EnvExperiment): class _PayloadCoreNOP(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") @kernel def run(self): @@ -22,7 +22,7 @@ class _PayloadCoreNOP(EnvExperiment): class _PayloadCoreSend100Ints(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") def devnull(self, d): pass @@ -35,7 +35,7 @@ class _PayloadCoreSend100Ints(EnvExperiment): class _PayloadCoreSend1MB(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") def devnull(self, d): pass @@ -48,7 +48,7 @@ class _PayloadCoreSend1MB(EnvExperiment): class _PayloadCorePrimes(EnvExperiment): def build(self): - self.attr_device("core") + self.setattr_device("core") def devnull(self, d): pass @@ -70,17 +70,17 @@ class _PayloadCorePrimes(EnvExperiment): class SpeedBenchmark(EnvExperiment): """Speed benchmark""" def build(self): - self.attr_argument("mode", EnumerationValue(["Single experiment", - "With pause", - "With scheduler"])) - self.attr_argument("payload", EnumerationValue(["NOP", - "CoreNOP", - "CoreSend100Ints", - "CoreSend1MB", - "CorePrimes"])) - self.attr_argument("nruns", NumberValue(10, min=1, max=1000, ndecimals=0)) - self.attr_device("core") - self.attr_device("scheduler") + self.setattr_argument("mode", EnumerationValue(["Single experiment", + "With pause", + "With scheduler"])) + self.setattr_argument("payload", EnumerationValue(["NOP", + "CoreNOP", + "CoreSend100Ints", + "CoreSend1MB", + "CorePrimes"])) + self.setattr_argument("nruns", NumberValue(10, min=1, max=1000, ndecimals=0)) + self.setattr_device("core") + self.setattr_device("scheduler") def run_with_scheduler(self): nruns = int(self.nruns) @@ -128,8 +128,8 @@ class SpeedBenchmark(EnvExperiment): class _Report(EnvExperiment): def build(self): - self.attr_argument("start_time") - self.attr_argument("nruns") + self.setattr_argument("start_time") + self.setattr_argument("nruns") def run(self): end_time = time.monotonic() diff --git a/examples/master/repository/tdr.py b/examples/master/repository/tdr.py index 9058a06fd..a6ac2b127 100644 --- a/examples/master/repository/tdr.py +++ b/examples/master/repository/tdr.py @@ -31,9 +31,9 @@ class TDR(EnvExperiment): This is also equivalent to a loopback tester or a delay measurement. """ def build(self): - self.attr_device("core") - self.attr_device("pmt0") - self.attr_device("ttl2") + self.setattr_device("core") + self.setattr_device("pmt0") + self.setattr_device("ttl2") def run(self): n = 1000 # repetitions diff --git a/examples/master/repository/transport.py b/examples/master/repository/transport.py index 9d5af3d6c..57100d244 100644 --- a/examples/master/repository/transport.py +++ b/examples/master/repository/transport.py @@ -16,16 +16,16 @@ class Transport(EnvExperiment): """Transport""" def build(self): - self.attr_device("core") - self.attr_device("bd") - self.attr_device("bdd") - self.attr_device("pmt") - self.attr_device("electrodes") + self.setattr_device("core") + self.setattr_device("bd") + self.setattr_device("bdd") + self.setattr_device("pmt") + self.setattr_device("electrodes") - self.attr_argument("wait_at_stop", FreeValue(100*us)) - self.attr_argument("speed", FreeValue(1.5)) - self.attr_argument("repeats", FreeValue(100)) - self.attr_argument("nbins", FreeValue(100)) + self.setattr_argument("wait_at_stop", FreeValue(100*us)) + self.setattr_argument("speed", FreeValue(1.5)) + self.setattr_argument("repeats", FreeValue(100)) + self.setattr_argument("nbins", FreeValue(100)) def calc_waveforms(self, stop): t = transport_data["t"][:stop]*self.speed diff --git a/examples/sim/al_spectroscopy.py b/examples/sim/al_spectroscopy.py index 7f52fc32c..df038aa63 100644 --- a/examples/sim/al_spectroscopy.py +++ b/examples/sim/al_spectroscopy.py @@ -5,16 +5,16 @@ class AluminumSpectroscopy(EnvExperiment): """Aluminum spectroscopy (simulation)""" def build(self): - self.attr_device("core") - self.attr_device("mains_sync") - self.attr_device("laser_cooling") - self.attr_device("spectroscopy") - self.attr_device("spectroscopy_b") - self.attr_device("state_detection") - self.attr_device("pmt") - self.attr_parameter("spectroscopy_freq", 432*MHz) - self.attr_argument("photon_limit_low", FreeValue(10)) - self.attr_argument("photon_limit_high", FreeValue(15)) + self.setattr_device("core") + self.setattr_device("mains_sync") + self.setattr_device("laser_cooling") + self.setattr_device("spectroscopy") + self.setattr_device("spectroscopy_b") + self.setattr_device("state_detection") + self.setattr_device("pmt") + self.setattr_parameter("spectroscopy_freq", 432*MHz) + self.setattr_argument("photon_limit_low", FreeValue(10)) + self.setattr_argument("photon_limit_high", FreeValue(15)) @kernel def run(self): diff --git a/examples/sim/simple_simulation.py b/examples/sim/simple_simulation.py index 602fcbd54..59c4875e4 100644 --- a/examples/sim/simple_simulation.py +++ b/examples/sim/simple_simulation.py @@ -5,9 +5,9 @@ class SimpleSimulation(EnvExperiment): """Simple simulation""" def build(self): - self.attr_device("core") + self.setattr_device("core") for wo in "abcd": - self.attr_device(wo) + self.setattr_device(wo) @kernel def run(self):