From 5a8bc17e4d05cbbb1f8b74ff1960c8a1ace33d09 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 25 Mar 2024 15:30:29 +0800 Subject: [PATCH] example: expand interactive --- .../no_hardware/repository/interactive.py | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/artiq/examples/no_hardware/repository/interactive.py b/artiq/examples/no_hardware/repository/interactive.py index 5effb1583..657721505 100644 --- a/artiq/examples/no_hardware/repository/interactive.py +++ b/artiq/examples/no_hardware/repository/interactive.py @@ -7,14 +7,28 @@ class InteractiveDemo(EnvExperiment): def run(self): print("Waiting for user input...") - with self.interactive() as interactive: + with self.interactive(title="Interactive Demo") as interactive: + interactive.setattr_argument("pyon_value", + PYONValue(self.get_dataset("foo", default=42))) interactive.setattr_argument("number", NumberValue(42e-6, - unit="us", - precision=4)) + unit="us", + precision=4)) interactive.setattr_argument("integer", NumberValue(42, - step=1, precision=0)) + step=1, precision=0)) interactive.setattr_argument("string", StringValue("Hello World")) + interactive.setattr_argument("scan", Scannable(global_max=400, + default=NoScan(325), + precision=6)) + interactive.setattr_argument("boolean", BooleanValue(True), "Group") + interactive.setattr_argument("enum", + EnumerationValue(["foo", "bar", "quux"], "foo"), + "Group") print("Done! Values:") + print(interactive.pyon_value) + print(interactive.boolean) + print(interactive.enum) print(interactive.number, type(interactive.number)) print(interactive.integer, type(interactive.integer)) print(interactive.string) + for i in interactive.scan: + print(i)