-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_bytes() fails with 20020 bytes; RG1054Z oscilloscope #354
Comments
|
Honestly I do not know (but I suspect the instrument). I suggest you try to do the same using NI MAX (or something equivalent) that should allow us to see if the issue is on the instrument side or on the PyVISA side. |
|
I looped for all lengths -- it starts failing at length 8244, and therafter at increments of 64; however after every 7 of these, it has a fail at an increment of 128: Here's a segment of the log: and filtered for 'Error': Code segment: for now, I'll just read in 8000 byte segments and join the arrays. I'll also search in Rigol forums for someone with the same setup who could replicate. |
|
Actually since I have at most a 60,000-byte read, it's faster to read in the whole 60k bytes and truncate the array. 60,000 doesn't appear to have a timeout problem. |
My Rigol RG1054Z & pyvisa fail on certain (random ?) lengths of read_bytes() commands. It also fails on query_binary_values(). This example code shows 1 sample of the problem -- there are other magic values besides 20020 that fail (greater than 20020). It appears to be a memory issue because sometimes depending on the codes used before this one, the failing magic number is different.
Changing chunk_size also affects it -- again a different magic value. This code runs in a few s. It is interesting that the 20019 value (just before the failing 20020 one) appears to have a longer than normal read time. However 20020 fails in about 2 s. Increasing timeout() doesn't fix the issue. I don't know if it is all caused by the scope or pyvisa.
Further investigation shows that the error occurs most frequently on multiples of 64 beyond this 20020 value (e.g. 20084, 20148,...). Even where there is no fail, there is certainly a noticeable delay at that step.
I have the same issue on 1.91, 1.90, 1.8
_3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
visa 1.9.1
DS1054Z: RIGOL TECHNOLOGIES,DS1104Z,DS1ZA201003553,00.04.04.03.05
20010> b'#9000020010' <20010 chars
20011> b'#9000020011' <20011 chars
20012> b'#9000020012' <20012 chars
20013> b'#9000020013' <20013 chars
20014> b'#9000020014' <20014 chars
20015> b'#9000020015' <20015 chars
20016> b'#9000020016' <20016 chars
20017> b'#9000020017' <20017 chars
20018> b'#9000020018' <20018 chars
20019> b'#9000020019' <20019 chars
20020> b'#9000020020' <Traceback (most recent call last):
File "bug.py", line 20, in
CURVE1 = np.frombuffer(DS1054Z.read_bytes(NPOINTS), dtype='b')
File "C:\Projects\Miniconda3\lib\site-packages\pyvisa\resources\messagebased.py", line 342, in read_bytes
chunk, status = self.visalib.read(self.session, size)
File "C:\Projects\Miniconda3\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1584, in read
ret = library.viRead(session, buffer, count, byref(return_count))
File "C:\Projects\Miniconda3\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 188, in return_handler
raise errors.VisaIOError(ret_value)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed._
The text was updated successfully, but these errors were encountered: