aboutsummaryrefslogtreecommitdiff
path: root/scope.py
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-11-30 20:21:30 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-11-30 20:21:30 -0500
commit893f423aa9534e63dc7a310bfd3789180e01412c (patch)
tree5bee6b606a8660f0e3d9d01b54c4924d316dc037 /scope.py
parentcaf79fdae9f55d1c3adf56f734929043b0dfb65a (diff)
downloadqolab-893f423aa9534e63dc7a310bfd3789180e01412c.tar.gz
qolab-893f423aa9534e63dc7a310bfd3789180e01412c.zip
better trace handling
Diffstat (limited to 'scope.py')
-rw-r--r--scope.py33
1 files changed, 25 insertions, 8 deletions
diff --git a/scope.py b/scope.py
index 50d09b7..9bd2fe1 100644
--- a/scope.py
+++ b/scope.py
@@ -17,13 +17,27 @@ class Scope(scpi.SCPIinstr):
def __init__(self, resource):
super().__init__(resource)
+ # Minimal set of methods to be implemented by a scope.
+ # Should work with minimal arguments list
+ # but might be faster if parameters provided: less IO requests
+
+ def getTrace(self, chNum, availableNpnts=None, maxRequiredPoints=None):
+ warnings.warn( 'this function is not implemented' )
+
class Trace:
- x = None
- xlabel = 'time'
- xunit = 'S'
- y = None
- ylabel = 'Voltage'
- yunit = 'V'
+ def __init__(self, descrStr):
+ self.descr = descrStr
+ self.x = None
+ self.xlabel = None
+ self.xunit = None
+ self.y = None
+ self.ylabel = None
+ self.yunit = None
+
+ def plot(self):
+ import matplotlib.pyplot as plt
+ plt.plot(self.x, self.y, label=self.descr)
+ plt.legend()
class SDS1104x(Scope):
""" Siglent SDS1104x scope """
@@ -171,10 +185,13 @@ class SDS1104x(Scope):
def getTrace(self, chNum, availableNpnts=None, maxRequiredPoints=None):
wfVoltage, availableNpnts = self.getWaveform( chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
t = self.getTimeTrace(availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
- tr = Trace()
+ tr = Trace( f'Ch{chNum}' )
+ tr.xlabel = 'Time'
+ tr.xunit = 'S'
+ tr.ylabel = 'Voltage'
+ tr.yunit = 'V'
tr.x = t
tr.y = wfVoltage
- tr.ylabel = f'Ch{chNum} Voltage'
return( tr )