aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-30 16:07:08 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-30 16:07:08 -0500
commitfe356868787a7539c8bcf2d8a39b437cd4fd9a74 (patch)
tree39d1add0a413dbabd662b18d5896d06280fe5c34
parenta8fd747a21a3535a44f0885cd11adf543365ad35 (diff)
downloadqolab-fe356868787a7539c8bcf2d8a39b437cd4fd9a74.tar.gz
qolab-fe356868787a7539c8bcf2d8a39b437cd4fd9a74.zip
response2numStr work with not assign unit now
-rw-r--r--qolab/hardware/scpi.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/qolab/hardware/scpi.py b/qolab/hardware/scpi.py
index a9c6061..b4111b3 100644
--- a/qolab/hardware/scpi.py
+++ b/qolab/hardware/scpi.py
@@ -9,12 +9,17 @@ def response2numStr(strIn, firstSeparator=None, unit=None):
# i.e. "<prefix><firstSeparator><numberString><unit>
# prefix='TDIV', firstSeparator=' ', numberString='2.00E-08', unit='S'
# this function parses the reply
+ if firstSeparator is None or firstSeparator == '':
+ return (strIn, None, None)
spltStr = re.split(firstSeparator, strIn)
prefix = spltStr[0]
rstr = spltStr[1]
- spltStr = re.split(unit, rstr)
- numberString = spltStr[0]
- unit = spltStr[1]
+ if unit is not None and unit != '':
+ spltStr = re.split(unit, rstr)
+ numberString = spltStr[0]
+ unit = spltStr[1]
+ else:
+ numberString = rstr
return (prefix, numberString, unit)