diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-06-18 00:02:25 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-06-18 00:04:47 -0400 |
commit | c4afe448d31025f51148a74ae8a91be57338b826 (patch) | |
tree | 341a91d9048365a49f5f459ca1987f0918ae841e /qolab/hardware | |
parent | b509c246a9d8a93b2f70b6f205ac3bf14d03d4fa (diff) | |
download | qolab-c4afe448d31025f51148a74ae8a91be57338b826.tar.gz qolab-c4afe448d31025f51148a74ae8a91be57338b826.zip |
fix no firstSeparator case, we return prefix=None now and process the rest
Diffstat (limited to 'qolab/hardware')
-rw-r--r-- | qolab/hardware/scpi.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/qolab/hardware/scpi.py b/qolab/hardware/scpi.py index 8564177..a9641cf 100644 --- a/qolab/hardware/scpi.py +++ b/qolab/hardware/scpi.py @@ -15,11 +15,12 @@ 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] + prefix = None + rstr = strIn + if firstSeparator is not None and firstSeparator != '': + spltStr = re.split(firstSeparator, strIn) + prefix = spltStr[0] + rstr = spltStr[1] if unit is not None and unit != '': spltStr = re.split(unit, rstr) if len(spltStr) == 1: |