aboutsummaryrefslogtreecommitdiff
path: root/qolab/hardware/scope
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-03 14:20:04 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-03 14:20:04 -0500
commit8c67614da984778fa10249d9bbf91719a750f1f4 (patch)
tree5530fc93e5b1fd863eb8ed5981fa81c67b67fe60 /qolab/hardware/scope
parent2cd2d1ba131cf885e0534cec7f0504836f5b3d4b (diff)
downloadpyExpControl-8c67614da984778fa10249d9bbf91719a750f1f4.tar.gz
pyExpControl-8c67614da984778fa10249d9bbf91719a750f1f4.zip
added attributes for trace
Diffstat (limited to 'qolab/hardware/scope')
-rw-r--r--qolab/hardware/scope/sds1104x.py22
1 files changed, 14 insertions, 8 deletions
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 )