From 5b15dc47afad4d45fba7a0b23a3fdf7a8b27a74f Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Sun, 21 Jul 2024 00:26:54 -0400 Subject: added time variable to trace --- qolab/hardware/scope/rigolds1054z.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'qolab/hardware') diff --git a/qolab/hardware/scope/rigolds1054z.py b/qolab/hardware/scope/rigolds1054z.py index 6b0a918..e4ed65d 100644 --- a/qolab/hardware/scope/rigolds1054z.py +++ b/qolab/hardware/scope/rigolds1054z.py @@ -272,6 +272,26 @@ class RigolDS1054z(ScopeSCPI): trRaw.config["tags"]["Decimate"] = decimate return (trRaw, rawChanCfg) + def getTimeTrace(self, rawChanCfg): + # sampleRate = self.getSampleRate() + timePerDiv = self.getTimePerDiv() + # trigDelay = self.getTrigDelay() + availableNpnts = rawChanCfg['availableNpnts'] + sparsing = rawChanCfg['sparsing'] + Npnts = rawChanCfg['Npnts'] + ind = np.linspace(0, Npnts-1, Npnts) + tval = (ind - rawChanCfg['xreference'] ) * rawChanCfg['xincrement']*sparsing - rawChanCfg['xorigin'] + t = Trace("time") + t.values = tval.reshape(tval.size, 1) + t.config["unit"] = "S" + t.config["tags"]["TimePerDiv"] = timePerDiv + # t.config["tags"]["TrigDelay"] = trigDelay + # t.config["tags"]["SampleRate"] = sampleRate + t.config["tags"]["AvailableNPnts"] = availableNpnts + t.config["tags"]["Npnts"] = Npnts + t.config["tags"]["Sparsing"] = sparsing + return t + def getWaveform( self, chNum, availableNpnts=None, maxRequiredPoints=None, decimate=True ): @@ -302,14 +322,14 @@ class RigolDS1054z(ScopeSCPI): old_trg_status = self.getTriggerStatus() self.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 + rawChanCfg ) tr = TraceXY(f"Ch{chNum}") tr.x = t -- cgit v1.2.3