forked from tektronix/Programmatic-Control-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurvestream_speed_test.py
87 lines (54 loc) · 1.85 KB
/
curvestream_speed_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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import pyvisa as visa
import time
print("set up VISA connection")
rm = visa.ResourceManager()
scope_address = "TCPIP0::192.168.1.27::inst0::INSTR"
scope = rm.open_resource(scope_address)
scope.timeout = 20000
print(scope.query("*IDN?"))
print("reset scope")
scope.write("*RST")
scope.write("*CLS")
#turn off all the waveform displays
print("turn off waveform display")
scope.write("display:waveform 0")
print("set up scope")
scope.write("hor:mode manual")
scope.write("hor:mode:samplerate 6.25e9")
scope.write("trig:a:level:ch1 1")
scope.write("ch1:sca 1")
scope.write("data:encdg rib")
scope.write("data:width 1")
scope.write("data:source CH1")
#turn on all the channels
for k in range(2,9):
scope.write("disp:glob:ch{}:state 1".format(k))
scope.write("data:source CH1,CH2,CH3,CH4,CH5,CH6,CH7,CH8")
##for k in range(2,5):
## scope.write("disp:glob:ch{}:state 1".format(k))
##scope.write("data:source CH1,CH2,CH3,CH4")
#scope.write("disp:glob:ch2:state 1")
#scope.write("data:source CH1,CH2")
print("Begin test...")
record = [1000, 2000, 5000, 10000, 20000, 50000]#, 100000, 200000, 500000, 1000000]
source = scope.query("data:source?")
print("For a source of {}:".format(source))
size = []
for r in record:
data = []
scope.write("hor:reco {}".format(r))
scope.write("data:stop {}".format(r))
#let settings settle
time.sleep(1)
scope.write("curvestream?")
time_start = time.time()
while(time.time()-time_start < 10):
wave = scope.read_raw()
data.append( wave )
scope.write("*CLS")
runs = len(data)
size.append(len(data[0]))
print("{} record completed at {} acqs/s and {} record".format(r,runs/10, len(data[0])))
print("Size check: {} {} {}".format(size[0], size[1], size[2]))
scope.close()
rm.close()