#!/usr/bin/python3 from PyHT6022.LibUsbScope import Oscilloscope import time import sys sample_rate_index = 1 voltage_range = 1 cal_freq = int(sys.argv[1]) # skip first samples due to unstable xfer scope = Oscilloscope() scope.setup() scope.open_handle() scope.set_sample_rate(sample_rate_index) scope.set_ch1_voltage_range(voltage_range) print(scope.set_calibration_frequency(cal_freq))
sample_rate_index = 1 voltage_range = 0x01 cal_freq = 10 # skip first samples due to unstable xfer skip = 2 * 0x400 data_points = skip + 20 * 0x400 scope = Oscilloscope() scope.setup() scope.open_handle() scope.set_sample_rate(sample_rate_index) scope.set_ch1_voltage_range(voltage_range) scope.set_ch1_ac_dc( scope.DC ) scope.set_calibration_frequency( cal_freq ) time.sleep( 1 ) ch1_data, _ = scope.read_data(data_points)#,raw=True)#timeout=1) voltage_data = scope.scale_read_data(ch1_data[skip:], voltage_range) timing_data, _ = scope.convert_sampling_rate_to_measurement_times(data_points-skip, sample_rate_index) scope.close_handle() if len(timing_data) != len(voltage_data): w = sys.stderr.write w('data lengths differ!\n') w(str([(s,len(eval(s+'_data')))for s in 'timing voltage'.split()])) w('\n') exit(1)