diff options
-rw-r--r-- | qolab/data/trace.py | 2 | ||||
-rw-r--r-- | qolab/hardware/scope/sds1104x.py | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 4a2e623..adde8a8 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -39,7 +39,7 @@ class TraceSetSameX: def plot(self): import matplotlib.pyplot as plt for k, tr in self.traces.items(): - tr.plot() + plt.plot(self.x.values, tr.values, label=tr.descr) plt.xlabel(self.x.label) plt.legend() diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py index c7de350..c1ff7b7 100644 --- a/qolab/hardware/scope/sds1104x.py +++ b/qolab/hardware/scope/sds1104x.py @@ -141,18 +141,23 @@ class SDS1104X(ScopeSCPI): if Npnts is None and sparsing is None: # using channel 1 as reference Npnts = self.getAvailableNumberOfPoints(1) - t = np.arange(Npnts) / sampleRate * sparsing; - t = t - timePerDiv * self.horizDivOnScreen/2 - trigDelay + tval = np.arange(Npnts) / sampleRate * sparsing; + tval = tval - timePerDiv * self.horizDivOnScreen/2 - trigDelay + t = Trace('time') + t.values = tval + t.unit = 'S' + t.label = 'time' + t.attributes['timePerDiv'] = timePerDiv + t.attributes['trigDelay'] = trigDelay + t.attributes['SampleRate'] = sampleRate + t.attributes['sparsing'] = sparsing return(t) 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 = TraceXY( f'Ch{chNum}' ) - tr.x.label = 'Time' - tr.x.unit = 'S' - tr.x.values = t - tr.y.descr = f'Ch{chNum}' + tr.x = t tr.y = wfVoltage return( tr ) |