aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qolab/data/trace.py1
-rw-r--r--qolab/hardware/scope/sds1104x.py22
2 files changed, 15 insertions, 8 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py
index 871c8c2..4a2e623 100644
--- a/qolab/data/trace.py
+++ b/qolab/data/trace.py
@@ -4,6 +4,7 @@ class Trace:
self.values = None
self.label = None
self.unit = None
+ self.attributes = {}
def plot(self):
import matplotlib.pyplot as plt
diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py
index c310e51..c7de350 100644
--- a/qolab/hardware/scope/sds1104x.py
+++ b/qolab/hardware/scope/sds1104x.py
@@ -4,7 +4,7 @@ Created by Eugeniy E. Mikhailov 2021/11/29
from qolab.hardware.scope import ScopeSCPI
from qolab.hardware.scpi import response2numStr
-from qolab.data.trace import TraceXY
+from qolab.data.trace import Trace, TraceXY
import numpy as np
class SDS1104X(ScopeSCPI):
@@ -88,7 +88,11 @@ class SDS1104X(ScopeSCPI):
qstr = f'C{chNum}:WAVEFORM? DAT2'
wfRaw=self.query_binary_values(qstr, datatype='b', header_fmt='ieee', container=np.array, chunk_size=(Npnts+100))
# expected full reply: 'C1:WF DAT2,#9000000140.........'
- return(wfRaw, availableNpnts, Npnts)
+ trRaw = Trace(f'Ch{chNum}')
+ trRaw.values = wfRaw
+ trRaw.label = 'adc value'
+ trRaw.unit = 'count'
+ return(trRaw, availableNpnts, Npnts)
def getChanVoltsPerDiv(self, chNum):
qstr = f'C{chNum}:VDIV?'
@@ -120,10 +124,14 @@ class SDS1104X(ScopeSCPI):
def getWaveform(self, chNum, availableNpnts=None, maxRequiredPoints=None):
- wfRaw, availableNpnts, Npnts = self.getRawWaveform(chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
+ trRaw, availableNpnts, Npnts = self.getRawWaveform(chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
VoltageOffset = self.getChanOffset(chNum)
VoltsPerDiv = self.getChanVoltsPerDiv(chNum)
- return( wfRaw * VoltsPerDiv * self.vertDivOnScreen/250 -VoltageOffset, availableNpnts )
+ tr = trRaw
+ tr.values = trRaw.values * VoltsPerDiv * self.vertDivOnScreen/250 -VoltageOffset
+ tr.attributes['VoltageOffset'] = VoltageOffset
+ tr.attributes['VoltsPerDiv'] = VoltsPerDiv
+ return(tr, availableNpnts)
def getTimeTrace(self, availableNpnts=None, maxRequiredPoints=None):
(sparsing, Npnts, availableNpnts, maxRequiredPoints) = self.calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
@@ -143,11 +151,9 @@ class SDS1104X(ScopeSCPI):
tr = TraceXY( f'Ch{chNum}' )
tr.x.label = 'Time'
tr.x.unit = 'S'
- tr.y.descr = f'Ch{chNum}'
- tr.y.label = 'Voltage'
- tr.y.unit = 'V'
tr.x.values = t
- tr.y.values = wfVoltage
+ tr.y.descr = f'Ch{chNum}'
+ tr.y = wfVoltage
return( tr )