5
5
import argparse
6
6
import pkg_resources
7
7
8
- import qtm
8
+ import qtm_rt
9
9
10
10
11
11
logging .basicConfig (level = logging .INFO )
12
12
LOG = logging .getLogger ("example" )
13
13
14
14
15
- QTM_FILE = pkg_resources .resource_filename ("qtm " , "data/Demo.qtm" )
15
+ QTM_FILE = pkg_resources .resource_filename ("qtm_rt " , "data/Demo.qtm" )
16
16
17
17
18
18
class AsyncEnumerate :
@@ -48,7 +48,7 @@ async def choose_qtm_instance(interface):
48
48
""" List running QTM instances, asks for input and return chosen QTM """
49
49
instances = {}
50
50
print ("Available QTM instances:" )
51
- async for i , qtm_instance in AsyncEnumerate (qtm .Discover (interface ), start = 1 ):
51
+ async for i , qtm_instance in AsyncEnumerate (qtm_rt .Discover (interface ), start = 1 ):
52
52
instances [i ] = qtm_instance
53
53
print ("{} - {}" .format (i , qtm_instance .info ))
54
54
@@ -75,19 +75,19 @@ async def main(interface=None):
75
75
76
76
while True :
77
77
78
- connection = await qtm .connect (qtm_ip , 22223 , version = "1.18" )
78
+ connection = await qtm_rt .connect (qtm_ip , 22223 , version = "1.18" )
79
79
80
80
if connection is None :
81
81
return
82
82
83
83
await connection .get_state ()
84
84
await connection .byte_order ()
85
85
86
- async with qtm .TakeControl (connection , "password" ):
86
+ async with qtm_rt .TakeControl (connection , "password" ):
87
87
88
88
result = await connection .close ()
89
89
if result == b"Closing connection" :
90
- await connection .await_event (qtm .QRTEvent .EventConnectionClosed )
90
+ await connection .await_event (qtm_rt .QRTEvent .EventConnectionClosed )
91
91
92
92
await connection .load (QTM_FILE )
93
93
@@ -103,7 +103,7 @@ async def main(interface=None):
103
103
await connection .stream_frames (
104
104
components = ["incorrect" ], on_packet = queue .put_nowait
105
105
)
106
- except qtm .QRTCommandException as exception :
106
+ except qtm_rt .QRTCommandException as exception :
107
107
LOG .info ("exception %s" , exception )
108
108
109
109
await connection .stream_frames (
@@ -122,13 +122,13 @@ async def main(interface=None):
122
122
await connection .await_event ()
123
123
124
124
await connection .new ()
125
- await connection .await_event (qtm .QRTEvent .EventConnected )
125
+ await connection .await_event (qtm_rt .QRTEvent .EventConnected )
126
126
127
127
await connection .start ()
128
- await connection .await_event (qtm .QRTEvent .EventWaitingForTrigger )
128
+ await connection .await_event (qtm_rt .QRTEvent .EventWaitingForTrigger )
129
129
130
130
await connection .trig ()
131
- await connection .await_event (qtm .QRTEvent .EventCaptureStarted )
131
+ await connection .await_event (qtm_rt .QRTEvent .EventCaptureStarted )
132
132
133
133
await asyncio .sleep (0.5 )
134
134
@@ -139,7 +139,7 @@ async def main(interface=None):
139
139
await asyncio .sleep (0.5 )
140
140
141
141
await connection .stop ()
142
- await connection .await_event (qtm .QRTEvent .EventCaptureStopped )
142
+ await connection .await_event (qtm_rt .QRTEvent .EventCaptureStopped )
143
143
144
144
await connection .save (r"measurement.qtm" )
145
145
0 commit comments