本文整理汇总了Python中PyHT6022.LibUsbScope.Oscilloscope.poll方法的典型用法代码示例。如果您正苦于以下问题:Python Oscilloscope.poll方法的具体用法?Python Oscilloscope.poll怎么用?Python Oscilloscope.poll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyHT6022.LibUsbScope.Oscilloscope
的用法示例。
在下文中一共展示了Oscilloscope.poll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deque
# 需要导入模块: from PyHT6022.LibUsbScope import Oscilloscope [as 别名]
# 或者: from PyHT6022.LibUsbScope.Oscilloscope import poll [as 别名]
data = deque(maxlen=2*1024*1024)
data_extend = data.extend
def extend_callback(ch1_data, _):
global data_extend
data_extend(ch1_data)
start_time = time.time()
print("Clearing FIFO and starting data transfer...")
i = 0
scope.start_capture()
shutdown_event = scope.read_async(extend_callback, data_points, outstanding_transfers=10, raw=True)
while time.time() - start_time < 1:
scope.poll()
scope.stop_capture()
print("Stopping new transfers.")
shutdown_event.set()
print("Snooze 1")
time.sleep(1)
print("Closing handle")
scope.close_handle()
print("Handle closed.")
print("Points in buffer:", len(data))
scaled_data = scope.scale_read_data(data, voltage_range)
with open('/tmp/continuous_read.out','wt') as ouf:
ouf.write(str(scaled_data[:65536])[1:-1].replace(', ',chr(10)))
plt.figure(0)
plt.plot(scaled_data)
plt.figure(1)