Products > Test Equipment
Download speed from Rigol DS1054Z or similar oscilloscope to a PC
<< < (4/8) > >>
alm:
I don't have any Rigol scope to test on, so I used netcat to create a listening TCP socket: nc -l -p 1052. Then I installed python-ivi from your Github, removed all the Python-2 style print statements that would give errors in Python 3 (after from __future__ import print_function, print(...) with parentheses should work in any Python version released after 2008), installed pyvisa and pyvisa-py, and made a small change to ivi/interfaces/pyvisa.py lines 32-39 and replaced the word visa by pyvisa. Apparently the module changed names in the past six years. And then it seems to work fine for me:

--- Code: ---% python
>>> import ivi
>>> rig = ivi.rigol.rigolDS1054Z('TCPIP0::localhost::1052::SOCKET')
# This was necessary because I'm using a Linux terminal and not a real DS1054 scope
>>> rig._interface.instrument.read_termination = '\n'
>>> rig._interface.instrument.write_termination = '\n'
>>> rig.identity.instrument_model
'DS1102E'

--- End code ---

In netcat I'd see:

% nc -l -p 1052
*CLSRIGOL TECHNOLOGIES,DS1102E,DS1EB104702974,00.02.01.01.00
*IDN?
Red is what the driver sent, and green is what I typed to simulate the response of a scope.

*CLS is what the DS1054Z driver sends when you instantiate it, and RIGOL TECHNOLOGIES,... is what I typed as a pre-emptive response to the *IDN? query since I can't type fast enough to stay within the timeout. I'm pretty sure that the same Python code, probably without changing the termination, would work with a real scope.
RoGeorge:
Sorry for the invalid Python2 prints, not mine, I've removed them only locally, now removed them from my git fork, too.
The problem is that I get invalid resource string for something like:
>>> rig = ivi.rigol.rigolDS1054Z('TCPIP0::localhost::1052::SOCKET')

--- Code: ---...
python-ivi_RoGeorge_fork/python-ivi/ivi/ivi.py", line 1817, in _initialize
    raise IOException('Invalid resource string')
ivi.ivi.IOException: Invalid resource string
>>>
--- End code ---

If that resource string worked for you, then you must be having one of the proprietary VISA libraries installed, something like NI-VISA, Keysight VISA, R&S VISA, Tektronix VISA, and python-IVI or maybe pyvisa detects the closed source library and sends the resource string to it.

I don't have any of the proprietary VISA libraries, only the FOSS python modules:  python-ivi, python-vxi11, pyvisa and pyvisa-py.  IIRC pyvisa also has some options to configure its backend.

Also I've noticed your prompt is % (% prompt is usually for csh).  What OS did you used to test the line "ivi.rigol.rigolDS1054Z('TCPIP0::localhost::1052::SOCKET')"?

TL DR;
'TCPIP0::localhost::1052::SOCKET' doesn't work on my Kubuntu 22.04 LTS, I have no proprietary NI-VISA or alike installed.  Any hints what am I missing, or mis-configured, or what should I install to make my python-IVI work with SOKET connection just like yours, please?
alm:
This was on Ubuntu 22.04.1 LTS without any proprietary VISA installed, just PyVISA and PyVISA-py. These are the only modules installed inside the virtual environment where I ran these commands:

--- Code: ---python = "^3.10" (resolved to Python 3.10.6)
PyVISA = "^1.12.0" (resolved to 1.12.0)
PyVISA-py = "^0.5.3" (resolved to 0.5.3)
numpy = "^1.23.4" (resolved to 1.23.4)
python-ivi = {git = "https://github.com/RoGeorge/python-ivi.git"}
and as indirect dependency of PyVISA typing-extensions 4.4.0

--- End code ---

PyVISA used the PyVISA-py backend without any configuration on my side. This is with using PyVISA directly:

--- Code: --->>> import pyvisa
>>> rm = pyvisa.ResourceManager()
>>> res = rm.open_resource('TCPIP0::localhost::1052::SOCKET')
>>> res.read_termination = '\n'
>>> res.write_termination = '\n'
>>> res.write('*IDN?')
7
>>> res.read()
'ME.' (this is just what I typed in netcat)

--- End code ---

If this doesn't work for you, then maybe try explicitly setting the PyVISA-py backend as described here. I did have to modify ivi/interface/pyvisa.py as I described above before python-ivi would detect pyvisa. Without that modification I also got the Invalid resource string error.
RoGeorge:
Thanks for pointing to the visa -> pyvisa name changes, wouldn't have noticed that too soon, if ever!
Now it can open a SOCKET connection from python-ivi.  :D
alm:
Yeah, I guess the module was called "visa" back in 2015 when that code was written. I've never run into it myself because all devices I've controlled so far have a GPIB interface that I access via VXI-11 using a LAN to GPIB bridge (HP/Agilent, Tektronix, etc). So I have no use for anything but VXI-11 for now.

Nice, does it work with the DS1054Z now?
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod