-
Notifications
You must be signed in to change notification settings - Fork 5
/
example.py
70 lines (59 loc) · 2.05 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from artiq.experiment import *
# This is a volatile test script to exercise and evaluate some functionality of
# Phaser through ARTIQ.
class Phaser(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("phaser0")
@rpc(flags={"async"})
def p(self, *p):
print([hex(_ & 0xFFFFFFFF) for _ in p])
def run(self):
self.do()
@kernel
def do(self):
# self.core.reset()
self.core.break_realtime()
for i in range(1):
self.inner()
@kernel
def inner(self):
f = self.phaser0
f.init(debug=True)
for ch in range(2):
f.channel[ch].set_att(0 * dB)
# f.channel[ch].set_duc_frequency_mu(0)
f.channel[ch].set_duc_frequency(190.598551 * MHz)
f.channel[ch].set_duc_phase(0.25)
f.channel[ch].set_duc_cfg(select=0, clr=0)
delay(0.1 * ms)
for osc in range(5):
ftw = (osc + 1) * 1.875391 * MHz
asf = (osc + 1) * 0.066
# if osc != 4:
# asf = 0.
# else:
# asf = .9
# ftw = 9.5*MHz
# f.channel[ch].oscillator[osc].set_frequency_mu(0)
f.channel[ch].oscillator[osc].set_frequency(ftw)
delay(0.1 * ms)
f.channel[ch].oscillator[osc].set_amplitude_phase(
asf, phase=0.25, clr=0
)
delay(0.1 * ms)
f.duc_stb()
for ch in range(2):
for addr in range(8):
r = f.channel[ch].trf_read(addr)
delay(0.1 * ms)
self.p(r)
self.core.break_realtime()
alarm = f.dac_read(0x05)
self.p(alarm)
self.core.break_realtime()
# This will set the TRFs and the DAC to sleep.
# Saves power and temperature rise but oviously disables RF as
# well.
# f.set_cfg(dac_sleep=1, trf0_ps=1, trf1_ps=1)
self.core.wait_until_mu(now_mu())