From 4ecf916e6790a30c207e05bb5d3fdf74b7d823e8 Mon Sep 17 00:00:00 2001 From: Jarom Christensen Date: Wed, 8 Apr 2026 16:43:53 +0000 Subject: [PATCH 1/3] Throw buffer error if no data --- oscope_scpi/keysight.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oscope_scpi/keysight.py b/oscope_scpi/keysight.py index 05d5bb2..1c3d94a 100644 --- a/oscope_scpi/keysight.py +++ b/oscope_scpi/keysight.py @@ -789,7 +789,10 @@ def waveformData(self, channel=None, points=None): # Check channel value if (self.channel not in self.chanAllValidList): raise ValueError('INVALID Channel Value for WAVEFORM: {} SKIPPING!'.format(self.channel)) - + # Check for data + complete = int(self._instQuery('WAV:COMP?')) # get percent complete + if complete == 0: + raise BufferError('No waveform data') if (self._version > self._versionLegacy): (x, y, header, meta) = self._waveformDataNew(self.channel, points) From 6666f44df8cf0ad317f7b6cc62bfc362f927b6f4 Mon Sep 17 00:00:00 2001 From: Jarom Christensen Date: Wed, 8 Apr 2026 16:50:41 +0000 Subject: [PATCH 2/3] Fix channel specifier for waveformData --- oscope_scpi/keysight.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/oscope_scpi/keysight.py b/oscope_scpi/keysight.py index 1c3d94a..1994a82 100644 --- a/oscope_scpi/keysight.py +++ b/oscope_scpi/keysight.py @@ -303,8 +303,6 @@ def _waveformDataNew(self, channel, points=None): # Create array for meta data meta = [] - # Set the waveform source. - self._instWrite("WAVeform:SOURce {}".format(self.channelStr(channel))) wav_source = self._instQuery("WAVeform:SOURce?") # Get the waveform view. @@ -603,8 +601,6 @@ def _waveformDataLegacy(self, channel, points=None): # Create array for meta data meta = [] - # Set the waveform source. - self._instWrite("WAVeform:SOURce {}".format(self.channelStr(channel))) wav_source = self._instQuery("WAVeform:SOURce?") # Get the waveform view. @@ -770,7 +766,7 @@ def _waveformDataLegacy(self, channel, points=None): def waveformData(self, channel=None, points=None): """ Download waveform data of a selected channel - channel - channel, as string, to be measured - set to None to use the default channel + channel - channel to be measured - set to None to use the default channel points - number of points to capture - if None, captures all available points for newer devices, the captured points are centered around the center of the display @@ -786,18 +782,23 @@ def waveformData(self, channel=None, points=None): if type(self.channel) is list or type(channel) is list: raise ValueError('Channel cannot be a list for WAVEFORM!') + chan_str = self.channelStr(self.channel) # Check channel value - if (self.channel not in self.chanAllValidList): - raise ValueError('INVALID Channel Value for WAVEFORM: {} SKIPPING!'.format(self.channel)) + if (chan_str not in self.chanAllValidList): + raise ValueError('INVALID Channel Value for WAVEFORM: {} SKIPPING!'.format(chan_str)) + + # Set the waveform source. + self._instWrite("WAVeform:SOURce {}".format(chan_str)) + # Check for data complete = int(self._instQuery('WAV:COMP?')) # get percent complete if complete == 0: raise BufferError('No waveform data') if (self._version > self._versionLegacy): - (x, y, header, meta) = self._waveformDataNew(self.channel, points) + (x, y, header, meta) = self._waveformDataNew(chan_str, points) else: - (x, y, header, meta) = self._waveformDataLegacy(self.channel, points) + (x, y, header, meta) = self._waveformDataLegacy(chan_str, points) return (x, y, header, meta) From 81316050b022af04febbc52947a9ec5464eda47b Mon Sep 17 00:00:00 2001 From: Jarom Christensen Date: Wed, 8 Apr 2026 17:22:54 +0000 Subject: [PATCH 3/3] Use long commands --- oscope_scpi/keysight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oscope_scpi/keysight.py b/oscope_scpi/keysight.py index 1994a82..6e06659 100644 --- a/oscope_scpi/keysight.py +++ b/oscope_scpi/keysight.py @@ -791,7 +791,7 @@ def waveformData(self, channel=None, points=None): self._instWrite("WAVeform:SOURce {}".format(chan_str)) # Check for data - complete = int(self._instQuery('WAV:COMP?')) # get percent complete + complete = int(self._instQuery('WAVeform:COMPlete?')) # get percent complete if complete == 0: raise BufferError('No waveform data')