diff options
Diffstat (limited to 'qolab')
-rw-r--r-- | qolab/data/trace.py | 31 | ||||
-rw-r--r-- | qolab/hardware/scope/sds1104x.py | 2 |
2 files changed, 15 insertions, 18 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 488bcfd..5b75fc1 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -1,8 +1,7 @@ class Trace: - def __init__(self, descrStr): - self.descr = descrStr + def __init__(self, label): + self.label = label self.values = None - self.label = None self.unit = None self.attributes = {} @@ -13,33 +12,33 @@ class Trace: class TraceXY: - def __init__(self, descrStr): - self.descr = descrStr - self.x = Trace('x_values') - self.y = Trace('y_values') + def __init__(self, label): + self.label = label + self.x = None + self.y = None def plot(self): import matplotlib.pyplot as plt - plt.plot(self.x.values, self.y.values, label=self.descr) + plt.plot(self.x.values, self.y.values, label=self.label) plt.legend() plt.xlabel(self.x.label) class TraceSetSameX: - def __init__(self, descrStr): - self.descr = descrStr - self.x = Trace('x_values') + def __init__(self, label): + self.label = label + self.x = None self.traces={} def addTrace(self, tr): if len(self.traces) == 0: self.x = tr.x trY = tr.y - self.traces[tr.descr]=trY + self.traces[tr.label]=trY def plot(self): import matplotlib.pyplot as plt for k, tr in self.traces.items(): - plt.plot(self.x.values, tr.values, label=tr.descr) + plt.plot(self.x.values, tr.values, label=tr.label) plt.xlabel(self.x.label) plt.legend() @@ -49,9 +48,9 @@ class TraceSetSameX: def keys(self): return (self.traces.keys()) - def getTrace(self, name): - tr = TraceXY(name) + def getTrace(self, label): + tr = TraceXY(label) tr.x = self.x - tr.y = self.traces[name] + tr.y = self.traces[label] return (tr) diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py index c1ff7b7..57323e1 100644 --- a/qolab/hardware/scope/sds1104x.py +++ b/qolab/hardware/scope/sds1104x.py @@ -90,7 +90,6 @@ class SDS1104X(ScopeSCPI): # expected full reply: 'C1:WF DAT2,#9000000140.........' trRaw = Trace(f'Ch{chNum}') trRaw.values = wfRaw - trRaw.label = 'adc value' trRaw.unit = 'count' return(trRaw, availableNpnts, Npnts) @@ -146,7 +145,6 @@ class SDS1104X(ScopeSCPI): t = Trace('time') t.values = tval t.unit = 'S' - t.label = 'time' t.attributes['timePerDiv'] = timePerDiv t.attributes['trigDelay'] = trigDelay t.attributes['SampleRate'] = sampleRate |