Skip to content

Commit

Permalink
Scope fixing
Browse files Browse the repository at this point in the history
step 1 of fixing the errors, trying to get the record function to return two values to unpack
  • Loading branch information
smbdoggy83 committed Oct 27, 2022
1 parent 9d3ebd7 commit 0e74a3f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
5 changes: 4 additions & 1 deletion Python Waveforms Test/WF_SDK/scope.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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

"""-----------------------------------------------------------------------"""

Expand Down
20 changes: 10 additions & 10 deletions Python Waveforms Test/WF_SDK/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""-----------------------------------------------------------------------"""

Expand Down
5 changes: 4 additions & 1 deletion Python Waveforms Test/osc_waveform_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +30,7 @@
import dwfconstants as constants
###########################################################################################
"""

from WF_SDK import device, scope, wavegen # import instruments

Expand All @@ -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
Expand Down

0 comments on commit 0e74a3f

Please sign in to comment.