A Python package for support of the "Virtual Instrument Software Architecture" (VISA), in order to control measurement devices and test equipment via GPIB, RS232, Ethernet or USB.
The programming of measurement instruments can be real pain. There are many different protocols, sent over many different interfaces and bus systems (GPIB, RS232, USB). For every programming language you want to use, you have to find libraries that support both your device and its bus system.
In order to ease this unfortunate situation, the Virtual Instrument Software Architecture (VISA) specification was defined in the middle of the 90'. Today VISA is implemented on all significant operating systems. A couple of vendors offer VISA libraries, partly with free download. These libraries work together with arbitrary peripheral devices, although they may be limited to certain interface devices, such as the vendor’s GPIB card.
The VISA specification has explicit bindings to Visual Basic, C, and G (LabVIEW’s graphical language). Python can be used to call functions from a VISA shared library (.dll, .so, .dylib) allowing to directly leverage the standard implementations. In addition, Python can be used to directly access most bus systems used by instruments which is why one can envision to implement the VISA standard directly in Python (see the PyVISA-Py project for more details). PyVISA is both a Python wrapper for VISA shared libraries but can also serve as a front-end for other VISA implementation such as PyVISA-Py.
Python has a couple of features that make it very interesting for measurement controlling:
- Python is an easy-to-learn scripting language with short development cycles.
- It represents a high abstraction level [2], which perfectly blends with the abstraction level of measurement programs.
- It has a very rich set of native libraries, including numerical and plotting modules for data analysis and visualisation.
- A large set of books (in many languages) and on-line publications is available.
- Python (tested with 2.7 and 3.4+)
- VISA (tested with NI-VISA 17.5, Win7, from www.ni.com/visa)
Python 2 EOL is now near (January 1st 2020), and given the limited time maintainers have, the next release of PyVISA (1.10) to be released around July 2019 will be the last version of PyVISA supporting Python 2.
Using pip:
$ pip install pyvisa
or easy_install:
$ easy_install pyvisa
or download and unzip the source distribution file and:
$ python setup.py install
The documentation can be read online at https://pyvisa.readthedocs.org