forked from M-Labs/artiq
environment: attr_* -> setattr_*
This commit is contained in:
parent
090a7e5871
commit
50a5a3baf0
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)):
|
||||
|
|
|
@ -3,9 +3,9 @@ from artiq import *
|
|||
|
||||
class SubComponent1(HasEnvironment):
|
||||
def build(self):
|
||||
self.attr_argument("sc1_scan", Scannable(default=NoScan(325)),
|
||||
self.setattr_argument("sc1_scan", Scannable(default=NoScan(325)),
|
||||
"Flux capacitor")
|
||||
self.attr_argument("sc1_enum", EnumerationValue(["1", "2", "3"]),
|
||||
self.setattr_argument("sc1_enum", EnumerationValue(["1", "2", "3"]),
|
||||
"Flux capacitor")
|
||||
|
||||
def do(self):
|
||||
|
@ -17,11 +17,11 @@ class SubComponent1(HasEnvironment):
|
|||
|
||||
class SubComponent2(HasEnvironment):
|
||||
def build(self):
|
||||
self.attr_argument("sc2_boolean", BooleanValue(False),
|
||||
self.setattr_argument("sc2_boolean", BooleanValue(False),
|
||||
"Transporter")
|
||||
self.attr_argument("sc2_scan", Scannable(default=NoScan(325)),
|
||||
self.setattr_argument("sc2_scan", Scannable(default=NoScan(325)),
|
||||
"Transporter")
|
||||
self.attr_argument("sc2_enum", EnumerationValue(["3", "4", "5"]),
|
||||
self.setattr_argument("sc2_enum", EnumerationValue(["3", "4", "5"]),
|
||||
"Transporter")
|
||||
|
||||
def do(self):
|
||||
|
@ -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,
|
||||
self.setattr_argument("free_value", FreeValue(None))
|
||||
self.setattr_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,
|
||||
self.setattr_argument("string", StringValue("Hello World"))
|
||||
self.setattr_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("boolean", BooleanValue(True), "Group")
|
||||
self.setattr_argument("enum", EnumerationValue(
|
||||
["foo", "bar", "quux"], "foo"), "Group")
|
||||
|
||||
self.sc1 = SubComponent1(parent=self)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [],
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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",
|
||||
self.setattr_argument("mode", EnumerationValue(["Single experiment",
|
||||
"With pause",
|
||||
"With scheduler"]))
|
||||
self.attr_argument("payload", EnumerationValue(["NOP",
|
||||
self.setattr_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("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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue