aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware/scope
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2022-06-14 16:10:21 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2022-06-14 16:17:56 -0400
commitce7d347281fd14770963e536662682fd382cbec1 (patch)
tree662e6c0aa39fe15f44e514471d428c0b1a84a54b /qolab/hardware/scope
parente107251a43b2a91d7dce7147d8b655eae7c23eb7 (diff)
downloadqolab-ce7d347281fd14770963e536662682fd382cbec1.tar.gz
qolab-ce7d347281fd14770963e536662682fd382cbec1.zip
decimate case is special: increase Npnts to allocate big enough buffer
otherwise everything is slow on Windows also added self.read() to flash read buffer after query. It seems to be needed on Windows
Diffstat (limited to 'qolab/hardware/scope')
-rw-r--r--qolab/hardware/scope/sds1104x.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py
index 6f12042..a812f5f 100644
--- a/qolab/hardware/scope/sds1104x.py
+++ b/qolab/hardware/scope/sds1104x.py
@@ -75,9 +75,14 @@ class SDS1104X(ScopeSCPI):
"""
(sparsing, Npnts, availableNpnts, maxRequiredPoints) = self.calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
+ if decimate:
+ Npnts = availableNpnts # get all of them and decimate later
if (sparsing == 1 and Npnts == availableNpnts) or decimate:
- # we are getting all of it
- cstr = f'WAVEFORM_SETUP NP,0,FP,0,SP,{sparsing}'
+ # We are getting all points of the trace
+ # Apparently sparsing has no effect with this command
+ # and effectively uses SP=1 for any sparsing
+ # but I want to make sure and force it
+ cstr = f'WAVEFORM_SETUP NP,0,FP,0,SP,1'
# technically when we know Npnts and sparsing
# we can use command from the follow up 'else' clause
else:
@@ -109,7 +114,12 @@ class SDS1104X(ScopeSCPI):
qstr = f'C{chNum}:WAVEFORM? DAT2'
# expected full reply: 'C1:WF DAT2,#9000000140.........'
try:
- wfRaw=self.query_binary_values(qstr, datatype='b', header_fmt='ieee', container=np.array, chunk_size=(Npnts+100))
+ wfRaw=self.query_binary_values(qstr, datatype='b', header_fmt='ieee', container=np.array, chunk_size=(Npnts+100))
+ # somehow on windows there is a lingering empty string
+ # which we need to flush out
+ r=self.read()
+ if r != '':
+ print(f'UPS. We expected an empty string but got {r=}')
trRaw.values = wfRaw.reshape(wfRaw.size,1)
if decimate and sparsing != 1:
numtaps = 3; # not sure it is the best case