mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
examples: add pdq2_simple example
This commit is contained in:
parent
467268a06e
commit
b363cb1d66
@ -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()
|
Loading…
Reference in New Issue
Block a user