forked from Qu-EST/lidar_python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delay_sweep_test.py
39 lines (30 loc) · 850 Bytes
/
delay_sweep_test.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
from Gpib import *
import time
import counter as c
INT_TIME = 10
DEVICE_NAME = 0
PRIMARY_ADDR = 5
LOOPTILL = 150
INIT_DLY = 65
END_DLY = 70
FILENAME = 'dll_swp_5ps.csv'
datalist=[]
delay_fd = Gpib(name =DEVICE_NAME, pad =PRIMARY_ADDR)
delay_fd.write("DLY {}".format(INIT_DLY))
time.sleep(3)
start = time.clock()
delay_fd.write("DLY {}".format(END_DLY))
for i in range (0,LOOPTILL):
count_fd, control_fd = c.open_counter(INT_TIME)
count =c.count(control_fd, count_fd, INT_TIME)
datalist.append([count, time.clock()-start + 0.001*(i + 1)])
c.close(control_fd, count_fd)
#print('{},{}'.format(count,time.clock()-start))
print (time.clock() - start)
save = open(FILENAME, 'w+')
save.write('count, time\n')
for data in datalist:
out = '{}, {}\n'.format(data[0],data[1])
print out
save.write(out)
save.close()