diff options
Diffstat (limited to 'qolab/hardware/scpi.py')
-rw-r--r-- | qolab/hardware/scpi.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qolab/hardware/scpi.py b/qolab/hardware/scpi.py index 279ef24..71ab556 100644 --- a/qolab/hardware/scpi.py +++ b/qolab/hardware/scpi.py @@ -2,6 +2,22 @@ provide basic class to operate SCPI capable instruments """ +import re + +def response2numStr(strIn, firstSeparator=None, unit=None): + # Often an instrument reply is in the form 'TDIV 2.00E-08S' (for example Siglent Scope) + # i.e. "<prefix><firstSeparator><numberString><unit> + # prefix='TDIV', firstSeparator=' ', numberString='2.00E-08', unit='S' + # this function parses the reply + spltStr = re.split(firstSeparator, strIn) + prefix = spltStr[0] + rstr = spltStr[1] + spltStr = re.split(unit, rstr) + numberString = spltStr[0] + unit = spltStr[1] + return (prefix, numberString, unit) + + class SCPIinstr: """ Basic class which support SCPI commands """ """ |