aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-03 14:53:00 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-03 14:53:00 -0500
commit8cff383e7eeb015400386c54e8397acfa4a42fbe (patch)
tree36017e29680b1ffaa5cce330618b4bdfdc3691b8
parent8c67614da984778fa10249d9bbf91719a750f1f4 (diff)
downloadqolab-8cff383e7eeb015400386c54e8397acfa4a42fbe.tar.gz
qolab-8cff383e7eeb015400386c54e8397acfa4a42fbe.zip
added attributes for time trace
-rw-r--r--qolab/data/trace.py2
-rw-r--r--qolab/hardware/scope/sds1104x.py17
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 )