aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2022-06-14 21:58:37 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2022-06-14 22:07:59 -0400
commitda607317738f99dd7a9f317679a7856c68ec1bc8 (patch)
tree82f7c3b75cab847794da6fb23b378c0538795c6b
parent4f8f9282c83254f3f81329cbe100f58970276e99 (diff)
downloadqolab-da607317738f99dd7a9f317679a7856c68ec1bc8.tar.gz
qolab-da607317738f99dd7a9f317679a7856c68ec1bc8.zip
better lingering string heuristic
-rw-r--r--qolab/hardware/scope/sds1104x.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py
index a812f5f..5c5dfe4 100644
--- a/qolab/hardware/scope/sds1104x.py
+++ b/qolab/hardware/scope/sds1104x.py
@@ -8,6 +8,7 @@ from qolab.hardware.scpi import response2numStr
from qolab.data.trace import Trace, TraceXY
import numpy as np
import scipy.signal
+from pyvisa.constants import InterfaceType
class SDS1104X(ScopeSCPI):
""" Siglent SDS1104x scope """
@@ -115,11 +116,12 @@ class SDS1104X(ScopeSCPI):
# 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))
- # 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=}')
+ if self.resource.interface_type == InterfaceType.usb:
+ # Somehow on windows (at least with USB interface)
+ # there is a lingering empty string which we need to flush out
+ r=self.read()
+ if r != '':
+ print(f'WARNING: 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