Repository navigation
Expand file tree
/
Copy pathtestDigiLock.py
More file actions
66 lines (45 loc) · 1.53 KB
/
Copy pathtestDigiLock.py
File metadata and controls
66 lines (45 loc) · 1.53 KB
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
######################################################################################################
# @author Mehrdad Zarei <mzarei@umk.pl>
# @date 2022.01.24
# @version 0
#
# @brief API for DigiLock to control DUI (DigiLock User Interface) remotly
#
######################################################################################################
import DigiLock
import sys
import time
import matplotlib.pyplot as plt
digi = DigiLock.digiClient()
digi_ip = str(sys.argv[1])
digi_port = int(sys.argv[2])
digi.connect(ip = digi_ip, port = digi_port)
# peak to peak level which you can measure from amplitude on DigiLock
digi.set_peakTpeak(ptp = float(sys.argv[3]))
err_con = digi.setting()
err_con, err = digi.checking()
if err == 0:
err_con, err = digi.checking()
if err_con == 1 and err == 1:
err_con, err = digi.lock()
if err == 0:
err_con, err = digi.lock()
up_t = 1
t1 = time.time()
while err_con == 1:
# refresh digilock connection every 100 s to avoid freezing
if (time.time() - t1) > 99:
digi.__del__()
time.sleep(1)
digi_con = digi.connect(ip = digi_ip, port = digi_port)
t1 = time.time() # restart timing
time.sleep(up_t)
err_con, err, up_t = digi.check_lock()
# x, y = digi.get_graph()
# plt.plot(x, y, label='data')
# plt.title('Life time of Sr atoms in the Lattice', fontdict=self.font)
# plt.legend()
# plt.xlabel('SC110 out [V]', fontdict=digi.font)
# plt.ylabel('Main in [V]', fontdict=digi.font)
# plt.show()
digi.__del__()