From ce7d347281fd14770963e536662682fd382cbec1 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 14 Jun 2022 16:10:21 -0400 Subject: 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 --- qolab/hardware/scope/sds1104x.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'qolab/hardware') 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 -- cgit v1.2.3