forked from Smithsonian/adc_tests
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_cal.py
41 lines (33 loc) · 908 Bytes
/
test_cal.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
import logging, logging.handlers
import sys
import adc5g
import corr
import time
import pylab
import numpy as np
BOFFILE = 'adc5g_test_rev2.bof'
ROACH = '10.0.1.213'
SNAPNAME = 'scope_raw_0_snap'
def br(x):
return np.binary_repr(x, width=8)
r = corr.katcp_wrapper.FpgaClient(ROACH)
time.sleep(0.1)
r.progdev(BOFFILE)
adc5g.set_test_mode(r, 0, counter=False)
adc5g.sync_adc(r)
adc5g.calibrate_all_delays(r, 0, snaps=['snap'], verbosity=5)
#adc5g.calibrate_mmcm_phase(r, 0, ['snap'])
#adc5g.unset_test_mode(r, 0)
#a, b, c, d = adc5g.get_test_vector(r, ['snap'])
a, b, c, d = adc5g.get_test_vector(r, [SNAPNAME])
#x = adc5g.get_snapshot(r, 'scope_raw_0_snap')
#a = x[0::4]
#b = x[1::4]
#c = x[2::4]
#d = x[3::4]
for i in range(32):
print br(a[i]), br(b[i]), br(c[i]), br(d[i])
for cn, core in enumerate([a,b,c,d]):
pylab.plot(np.array(core) & 0xf, label='%d'%cn)
pylab.legend()
pylab.show()