From 67e042852af583a060af640997da263d7d5e25a3 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 18 Jun 2014 13:43:09 +0200 Subject: [PATCH] Add simple simulation example --- examples/simple_simulation.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 examples/simple_simulation.py diff --git a/examples/simple_simulation.py b/examples/simple_simulation.py new file mode 100644 index 000000000..2b7b607b9 --- /dev/null +++ b/examples/simple_simulation.py @@ -0,0 +1,29 @@ +from artiq.language.units import * +from artiq.language.experiment import * + +class SimpleSimulation(Experiment): + channels = "core a b c d" + + @kernel + def run(self): + with parallel: + with sequential: + self.a.pulse(100*MHz, 20*us) + self.b.pulse(200*MHz, 20*us) + with sequential: + self.c.pulse(300*MHz, 10*us) + self.d.pulse(400*MHz, 20*us) + +if __name__ == "__main__": + from artiq.sim import devices as sd + from artiq.sim import time + + exp = SimpleSimulation( + core=sd.Core(), + a=sd.WaveOutput("a"), + b=sd.WaveOutput("b"), + c=sd.WaveOutput("c"), + d=sd.WaveOutput("d"), + ) + exp.run() + print(time.manager.format_timeline())