From af973de2068774a95308f77c7a5ff51d88a04ff4 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Thu, 25 Jul 2024 23:36:01 -0400 Subject: make Siglent sds1104x trace aquizition compatible with new config passing scheme --- qolab/hardware/scope/sds1104x.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'qolab') diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py index 21439e5..abca62a 100644 --- a/qolab/hardware/scope/sds1104x.py +++ b/qolab/hardware/scope/sds1104x.py @@ -92,15 +92,22 @@ class SDS1104X(ScopeSCPI): to use ``decimate=True``. """ + rawChanCfg = {} if availableNpnts is None: # using channel 1 to get availableNpnts availableNpnts = self.getAvailableNumberOfPoints(1) + rawChanCfg["availableNpnts"] = availableNpnts + + if maxRequiredPoints is None: + maxRequiredPoints = self.maxRequiredPoints ( sparsing, Npnts, availableNpnts, maxRequiredPoints, ) = calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints) + rawChanCfg["Npnts"] = Npnts + rawChanCfg["sparsing"] = sparsing if decimate: Npnts = availableNpnts # get all of them and decimate later if (sparsing == 1 and Npnts == availableNpnts) or decimate: @@ -169,7 +176,8 @@ class SDS1104X(ScopeSCPI): wfRaw = np.array([]) trRaw.config["unit"] = "Count" trRaw.config["tags"]["Decimate"] = decimate - return (trRaw, availableNpnts, Npnts) + trRaw.config["tags"]["rawChanConfig"] = rawChanCfg + return (trRaw, rawChanCfg) def getChanVoltsPerDiv(self, chNum): qstr = f"C{chNum}:VDIV?" @@ -266,7 +274,7 @@ class SDS1104X(ScopeSCPI): In short decimate=True is slower but more precise. """ - trRaw, availableNpnts, Npnts = self.getRawWaveform( + trRaw, rawChanCfg = self.getRawWaveform( chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints, @@ -281,18 +289,12 @@ class SDS1104X(ScopeSCPI): tr.config["unit"] = "Volt" tr.config["tags"]["VoltageOffset"] = VoltageOffset tr.config["tags"]["VoltsPerDiv"] = VoltsPerDiv - return (tr, availableNpnts) + return (tr, rawChanCfg) - def getTimeTrace(self, availableNpnts=None, maxRequiredPoints=None): - if availableNpnts is None: - # using channel 1 to get availableNpnts - availableNpnts = self.getAvailableNumberOfPoints(1) - ( - sparsing, - Npnts, - availableNpnts, - maxRequiredPoints, - ) = calcSparsingAndNumPoints(availableNpnts, maxRequiredPoints) + def getTimeTrace(self, rawChanCfg): + availableNpnts = rawChanCfg["availableNpnts"] + sparsing = rawChanCfg["sparsing"] + Npnts = rawChanCfg["Npnts"] sampleRate = self.getSampleRate() timePerDiv = self.getTimePerDiv() trigDelay = self.getTrigDelay() @@ -328,15 +330,13 @@ class SDS1104X(ScopeSCPI): old_trg_mode = self.getTriggerMode() self.setTriggerMode("STOP") # to get synchronous channels - wfVoltage, availableNpnts = self.getWaveform( + wfVoltage, rawChanCfg = self.getWaveform( chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints, decimate=decimate, ) - t = self.getTimeTrace( - availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints - ) + t = self.getTimeTrace(rawChanCfg) tr = TraceXY(f"Ch{chNum}") tr.x = t tr.y = wfVoltage -- cgit v1.2.3