当前位置: 首页>>代码示例>>Python>>正文


Python Oscilloscope.convert_sampling_rate_to_measurement_times方法代码示例

本文整理汇总了Python中PyHT6022.LibUsbScope.Oscilloscope.convert_sampling_rate_to_measurement_times方法的典型用法代码示例。如果您正苦于以下问题:Python Oscilloscope.convert_sampling_rate_to_measurement_times方法的具体用法?Python Oscilloscope.convert_sampling_rate_to_measurement_times怎么用?Python Oscilloscope.convert_sampling_rate_to_measurement_times使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyHT6022.LibUsbScope.Oscilloscope的用法示例。


在下文中一共展示了Oscilloscope.convert_sampling_rate_to_measurement_times方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: enumerate

# 需要导入模块: from PyHT6022.LibUsbScope import Oscilloscope [as 别名]
# 或者: from PyHT6022.LibUsbScope.Oscilloscope import convert_sampling_rate_to_measurement_times [as 别名]
    new_data = data[:window]
    for i, point in enumerate(data[window:-window]):
        new_data.append(sum(data[i-window:i+window+1])/(2*window+1))
    new_data.extend(data[-window:])
    return new_data

sample_rate_index = 0x04
voltage_range = 0x01
data_points = 0x2000

scope = Oscilloscope()
scope.setup()
scope.open_handle()
scope.set_sample_rate(sample_rate_index)
scope.set_ch1_voltage_range(voltage_range)
ch1_data, _ = scope.read_data(data_points)
voltage_data = scope.scale_read_data(ch1_data, voltage_range)
timing_data, _ = scope.convert_sampling_rate_to_measurement_times(data_points, sample_rate_index)
scope.close_handle()
pylab.title('Scope Visualization Example')
pylab.plot(timing_data, voltage_data, color='#009900', label='Raw Trace')
pylab.plot(timing_data, apply_data_smoothing(voltage_data, window=3), color='#0033CC', label='Smoothed Trace')
pylab.xlabel('Time (s)')
pylab.ylabel('Voltage (V)')
pylab.grid()
pylab.legend(loc='best')
pylab.xticks(rotation=30)
pylab.tight_layout()
pylab.show()

开发者ID:baruch,项目名称:Hantek6022API,代码行数:31,代码来源:example_linux_scopevis.py

示例2: Oscilloscope

# 需要导入模块: from PyHT6022.LibUsbScope import Oscilloscope [as 别名]
# 或者: from PyHT6022.LibUsbScope.Oscilloscope import convert_sampling_rate_to_measurement_times [as 别名]
        rates.append(rate)
    print "Average: {} MB/s".format(sum(rates)/(len(rates)*1e6))
    return rates

voltage_range = 0x01

time_fxn = time.time

scope = Oscilloscope()
scope.setup()
scope.open_handle()

scope.set_ch1_voltage_range(voltage_range)
for sample_rate_index in [0x30, 0x10, 0x08, 0x04, 0x01, 0x32, 0x14, 0x0A]:
    scope.set_sample_rate(sample_rate_index)
    _, label = scope.convert_sampling_rate_to_measurement_times(1, sample_rate_index)
    print "Sample rate: {}".format(label)
    print "-"*40
    for data_points in [0x800, 0x1000, 0x8000, 0x10000, 0x80000, 0x100000, 0x200000]:
        reader_fxn = scope.build_data_reader(raw=True)
        times = []
        times_append = times.append
        times_append(time_fxn())
        for _ in xrange(iterations):
            ch1_data, _ = reader_fxn(data_points)
            times_append(time_fxn())
        print "Raw Mode, Data Points: 0x{:x}".format(data_points)
        print_report(times, data_points)

        reader_fxn = scope.build_data_reader()
        times = []
开发者ID:baruch,项目名称:Hantek6022API,代码行数:33,代码来源:example_linux_perf_test.py


注:本文中的PyHT6022.LibUsbScope.Oscilloscope.convert_sampling_rate_to_measurement_times方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。