WaveformData Fixes - #11
Open
jarom77 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes two errors in oscope_scpi/keysight.py:waveformData.
No Waveform Data
If there is no waveform data (scope hasn't been triggered yet, etc),
WAVeform:PREamble?returns 22 values rather than 24. This causes the next line to throw an unhelpful error. While the error from the oscope is helpful, a ValueError exception is a mischaracterization of the error, so catching it doesn't make sense. I rewrote it to throw aBufferErrorinstead (line 793-796) so it can be more intuitively caught and handled.oscilloscope.py:waveformcould also be rewritten to just return None or 0 on this error, but I felt preserving the exception provides better control to the user.Channel Argument
waveformDatasays it takes channel as a string or None. When None is passed, we useself.channel, which isn't necessarily a string. Now it can take either a string or an integer because conversion happens within the function.I also moved setting the waveform source to
waveformDataand out of the called functions_waveformDataNewand_waveformDataLegacy. It needs to be inwaveformDatain order to query the waveform completeness (line 794). We could leave setting this in the called functions, but it would be redundant.