From 0e74a3f3f186a8c92904f3a63c560f9dc60991a1 Mon Sep 17 00:00:00 2001 From: smbdoggy83 Date: Thu, 27 Oct 2022 15:13:08 -0400 Subject: [PATCH] Scope fixing step 1 of fixing the errors, trying to get the record function to return two values to unpack --- Python Waveforms Test/WF_SDK/scope.py | 5 ++++- Python Waveforms Test/WF_SDK/tools.py | 20 ++++++++++---------- Python Waveforms Test/osc_waveform_test.py | 5 ++++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Python Waveforms Test/WF_SDK/scope.py b/Python Waveforms Test/WF_SDK/scope.py index f0cf1fc..fe6e679 100644 --- a/Python Waveforms Test/WF_SDK/scope.py +++ b/Python Waveforms Test/WF_SDK/scope.py @@ -1,6 +1,7 @@ """ OSCILLOSCOPE CONTROL FUNCTIONS: open, measure, trigger, record, close """ import ctypes # import the C compatible data types +import numpy from sys import platform, path # this is needed to check the OS type and get the PATH from os import sep # OS specific file path separators @@ -198,7 +199,9 @@ def record(device_data, channel): # convert into list buffer = [float(element) for element in buffer] - return buffer + step = 1/data.sampling_frequency + times = [*range(0, data.buffer_size)] * step #TODO: FIXME change range to float array + return buffer, times """-----------------------------------------------------------------------""" diff --git a/Python Waveforms Test/WF_SDK/tools.py b/Python Waveforms Test/WF_SDK/tools.py index cf6d705..172f73e 100644 --- a/Python Waveforms Test/WF_SDK/tools.py +++ b/Python Waveforms Test/WF_SDK/tools.py @@ -26,16 +26,16 @@ """-----------------------------------------------------------------------""" -class window: - """ FFT windows """ - rectangular = constants.DwfWindowRectangular - triangular = constants.DwfWindowTriangular - hamming = constants.DwfWindowHamming - hann = constants.DwfWindowHann - cosine = constants.DwfWindowCosine - blackman_harris = constants.DwfWindowBlackmanHarris - flat_top = constants.DwfWindowFlatTop - kaiser = constants.DwfWindowKaiser +#class window: +# """ FFT windows """ +# rectangular = constants.DwfWindowRectangular +## triangular = constants.DwfWindowTriangular +### hamming = constants.DwfWindowHamming + # hann = constants.DwfWindowHann + # cosine = constants.DwfWindowCosine + ## blackman_harris = constants.DwfWindowBlackmanHarris + # flat_top = constants.DwfWindowFlatTop + # kaiser = constants.DwfWindowKaiser """-----------------------------------------------------------------------""" diff --git a/Python Waveforms Test/osc_waveform_test.py b/Python Waveforms Test/osc_waveform_test.py index 724bc54..ffa776b 100644 --- a/Python Waveforms Test/osc_waveform_test.py +++ b/Python Waveforms Test/osc_waveform_test.py @@ -5,6 +5,7 @@ @author: Seth """ +""" import ctypes # import the C compatible data types from sys import platform, path # this is needed to check the OS type and get the PATH from os import sep # OS specific file path separators @@ -29,6 +30,7 @@ import dwfconstants as constants ########################################################################################### +""" from WF_SDK import device, scope, wavegen # import instruments @@ -48,7 +50,8 @@ wavegen.generate(device_data, channel=1, function=wavegen.function.sine, offset=0, frequency=10e03, amplitude=2) # record data with the scopeon channel 1 -buffer, time = scope.record(device_data, channel=1) +#buffer, time = scope.record(device_data, channel=1) +out = scope.record(device_data, channel=1) # plot time = [moment * 1e03 for moment in time] # convert time to ms