aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/hardware')
-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)