-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_LecroyScope.py
94 lines (72 loc) · 2.09 KB
/
test_LecroyScope.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
88
89
90
91
92
93
94
# (c) 2020, ETH Zurich, Power Electronic Systems Laboratory, T. Guillod
import LecroyScope
if __name__ == "__main__":
"""
Test code for the LecroyScope class.
"""
# create the object
data = dict()
ip = "xxx.xx.xx.x"
obj = LecroyScope.LecroyScope(data)
# connect to the device
obj.open()
# configure the scope
channel = {"C1": dict(), "C2": dict()}
channel["C1"]["div"] = 1000.0
channel["C1"]["attenuation"] = 1000.0
channel["C1"]["offset"] = -2000.0
channel["C1"]["skew"] = 0.0
channel["C1"]["invert"] = False
channel["C1"]["bandwidth"] = "Full"
channel["C1"]["coupling"] = "DC1M"
channel["C1"]["filter"] = "None"
channel["C1"]["comment"] = "V HV OUT"
channel["C2"]["div"] = 20.0
channel["C2"]["attenuation"] = 50.0
channel["C2"]["offset"] = -20.0
channel["C2"]["skew"] = 0.0
channel["C2"]["invert"] = False
channel["C2"]["bandwidth"] = "Full"
channel["C2"]["coupling"] = "DC1M"
channel["C2"]["filter"] = "None"
channel["C2"]["comment"] = "I HV OUT"
time = dict()
time["div"] = 100e-9
time["offset"] = 200e-9
time["offset_origin"] = 0.0
time["sample"] = 1e6
trigger = dict()
trigger["channel"] = "C2"
trigger["edge"] = "Positive"
trigger["coupling"] = "DC"
trigger["window"] = 0.0
trigger["level"] = 10.0
config = {"channel": channel, "time": time, "trigger": trigger}
obj.set_config(config)
# force auto calibration
obj.cal()
# activate the buzzer
obj.buzz()
# trigger single shot mode
obj.single()
# trigger stop
obj.stop()
# trigger normal mode
obj.normal()
# force trigger event
obj.force()
# automatic trigger
obj.auto()
# automatic trigger mode
obj.auto()
# get the trigger status
trig_status = obj.get_status()
# take a screeshot (png)
data_tmp = obj.screenshot()
# download the waveform data from the scope (dict)
skip = 10
data_tmp = obj.waveform(skip)
# reset the device
obj.reset_config()
# disconnect from the device
obj.close()