The python package rohdeschwarz provides a VNA instrument driver for python 2.7/3.
The following Python versions are known to work on Windows. Newer versions should work as well.
The pyvisa and numpy python packages are required by rohdeschwarz. As of Python 2.7.13 and 3.5.3, a pre-compiled (binary) version of numpy is available and should automatically install via pip. If for some reason numpy installation fails, you may be using a version of python that does not have a pre-compiled binary wheel on PyPI. You can check for versions supported out-of-the-box here:
There is a direct tcp socket option if you prefer to connect to the instrument without installing VISA on the host machine. However, the pyvisa package is still required at the moment, even if it is not used.
As you would expect, you can install rohdeschwarz from the command line with pip:
pip install --pre rohdeschwarz
The current version as of this writing is 0.9.1dev1 (beta); the --pre flag indicates that you are okay with a version of rohdeschwarz that is "pre-release".
The easiest way to get started is with a tcp (ethernet) connection and the vna command, available from the command line.
vna --address <ip_address>
If you are using VISA and/or GPIB, this is available from the command line as well
vna --visa gpib --address <gpib_address>
Within a script, the following code snippet will attempt to connect to an instrument via VISA and GPIB at the address provided.
from rohdeschwarz.instruments.vna import Vna
vna = Vna()
vna.open('GPIB', '17')
vna.open_log('path/to/scpi/log.txt')
# ...
vna.close_log()
vna.close()
Alternatively, to connect via a direct TCP socket (no VISA installation required):
from rohdeschwarz.instruments.vna import Vna
vna = Vna()
vna.open_tcp('<ip_address>')
vna.open_log('path/to/scpi/log.txt')
# ...
vna.close_log()
vna.close()
rohdeschwarz can also control other types of instruments besides a VNA. For generic instrument control, similar steps can be followed, replacing the VNA references with references to GenericInstrument or instr instead.
# TCP socket connection
instr --address <ip_address>
>>> # At python prompt:
>>> instr.query('*IDN?')
from rohdeschwarz.instruments.genericinstrument import GenericInstrument
instr = GenericInstrument()
instr.open_tcp('<ip_address>')
instr.open_log('path/to/scpi/log.txt')
# Read/write
instr.write('*IDN?')
instr.read()
# Query
instr.query('*IDN?')
instr.close_log()
instr.close()
rohdeschwarz is open-source. All the source code can be found here:
https://github.com/Terrabits/rohdeschwarz
Unfortunately there is no documentation at the moment. However, examples can be found in the repo on Github.