forked from M-Labs/artiq
1
0
Fork 0

example: expand interactive

This commit is contained in:
Simon Renblad 2024-03-25 15:30:29 +08:00 committed by Sébastien Bourdeauducq
parent 329e7189cc
commit 5a8bc17e4d
1 changed files with 18 additions and 4 deletions

View File

@ -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)