aboutsummaryrefslogtreecommitdiff
path: root/scope.py
diff options
context:
space:
mode:
Diffstat (limited to 'scope.py')
-rw-r--r--scope.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/scope.py b/scope.py
index 7526fbc..50d09b7 100644
--- a/scope.py
+++ b/scope.py
@@ -19,12 +19,17 @@ class Scope(scpi.SCPIinstr):
class Trace:
x = None
+ xlabel = 'time'
+ xunit = 'S'
y = None
+ ylabel = 'Voltage'
+ yunit = 'V'
class SDS1104x(Scope):
""" Siglent SDS1104x scope """
vertDivOnScreen = 10
horizDivOnScreen = 14
+ numberOfChannels = 4
def __init__(self, resource):
super().__init__(resource)
self.resource.read_termination='\n'
@@ -68,7 +73,7 @@ class SDS1104x(Scope):
prefix, numberString, unit = self.response2numStr(rstr, firstSeparator=' ', unit='Sa/s')
return(int(float(numberString)))
- def calcSparcingAndNumPoints(self, availableNpnts=None, maxRequiredPoints=None):
+ def calcSparsingAndNumPoints(self, availableNpnts=None, maxRequiredPoints=None):
if availableNpnts == None:
# using channel 1 to get availableNpnts
availableNpnts = self.getAvailableNumberOfPoints(1)
@@ -84,7 +89,7 @@ class SDS1104x(Scope):
return(sparsing, Npnts, availableNpnts, maxRequiredPoints)
def getRawWaveform(self, chNum, availableNpnts=None, maxRequiredPoints=None):
- (sparsing, Npnts, availableNpnts, maxRequiredPoints) = self.calcSparcingAndNumPoints(availableNpnts, maxRequiredPoints)
+ (sparsing, Npnts, availableNpnts, maxRequiredPoints) = self.calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
if sparsing == 1 and Npnts == availableNpnts:
# we are getting all of it
cstr = f'WAVEFORM_SETUP NP,0,FP,0,SP,{sparsing}'
@@ -114,7 +119,7 @@ class SDS1104x(Scope):
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, sparsing)
+ return(wfRaw, availableNpnts, Npnts)
def getChanVoltsPerDiv(self, chNum):
qstr = f'C{chNum}:VDIV?'
@@ -146,13 +151,13 @@ class SDS1104x(Scope):
def getWaveform(self, chNum, availableNpnts=None, maxRequiredPoints=None):
- wfRaw, availableNpnts, Npnts, sparsing = self.getRawWaveform(chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
+ wfRaw, 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, sparsing)
+ return( wfRaw * VoltsPerDiv * self.vertDivOnScreen/250 -VoltageOffset, availableNpnts )
def getTimeTrace(self, availableNpnts=None, maxRequiredPoints=None):
- (sparsing, Npnts, availableNpnts, maxRequiredPoints) = self.calcSparcingAndNumPoints(availableNpnts, maxRequiredPoints)
+ (sparsing, Npnts, availableNpnts, maxRequiredPoints) = self.calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints)
sampleRate = self.getSampleRate()
timePerDiv = self.getTimePerDiv()
trigDelay = self.getTrigDelay()
@@ -164,11 +169,12 @@ class SDS1104x(Scope):
return(t)
def getTrace(self, chNum, availableNpnts=None, maxRequiredPoints=None):
- wfVoltage, availableNpnts, sparsing = self.getWaveform( chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
+ wfVoltage, availableNpnts = self.getWaveform( chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
t = self.getTimeTrace(availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints)
tr = Trace()
tr.x = t
tr.y = wfVoltage
+ tr.ylabel = f'Ch{chNum} Voltage'
return( tr )