From b363cb1d669d8ba2b1f4930a2a0c6d8c8e35201c Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Tue, 23 Feb 2016 17:58:00 +0100 Subject: [PATCH] examples: add pdq2_simple example --- .../coredevice_examples/pdq2_simple.py | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 examples/master/repository/coredevice_examples/pdq2_simple.py diff --git a/examples/master/repository/coredevice_examples/pdq2_simple.py b/examples/master/repository/coredevice_examples/pdq2_simple.py new file mode 100644 index 000000000..98bbae29d --- /dev/null +++ b/examples/master/repository/coredevice_examples/pdq2_simple.py @@ -0,0 +1,43 @@ +import numpy as np + +from artiq.experiment import * +from artiq.wavesynth.coefficients import build_segment + + +class PDQ2Simple(EnvExperiment): + """Set PDQ2 voltages.""" + def build(self): + self.setattr_device("core") + self.setattr_device("pmt") + self.setattr_device("electrodes") + + # 1 device, 3 board each, 3 dacs each + self.u = np.arange(4*3)[None, :, None]*.1 + + def setup(self, offset): + self.electrodes.disarm() + self.load = self.electrodes.create_frame() + segment = self.load.create_segment() + for line in build_segment([100], self.u + offset): + segment.add_line(**line) + self.detect = self.electrodes.create_frame() + segment = self.detect.create_segment() + for line in build_segment([100], -self.u + offset): + segment.add_line(**line) + self.electrodes.arm() + + @kernel + def one(self): + self.load.advance() + delay(1*ms) + self.detect.advance() + delay(1*ms) + self.pmt.gate_rising(100*us) + return self.pmt.count() + + def run(self): + offsets = np.linspace(0, 10, 3) + for o in offsets: + self.setup(o) + print(self.electrodes.get_program()) + self.one()