The state of the PyVISA ecosystem (and more)

Yesterday we released several packages of the Python Instrumentation Ecosystem. You can upgrade to PyVISA 1.8, PyVISA-py 0.2 and PyVISA-sim 0.3  by:

pip install -U pyvisa pyvisa-py pyvisa-sim

For those of you who are new to instrumentation in Python, PyVISA is a Python frontend for the VISA specification that enables controlling all kinds of measurement equipment through GPIB, RS232, USB and Ethernet among others interfaces. If you are familiar with VISA instruments in LabVIEW, Matlab, C or .NET you already know how it works and you can make use of PyVISA as a nice Pythonic API to write your programs. If you have never done any instrumentation, Python and PyVISA is great combination to start.


As I mentioned before PyVISA is a frontend for the VISA specification, but what does this means in terms of software? PyVISA can connect to multiple backends, which are the ones doing part of the hard work. We currently have 3:

ni: is a wrapper to the NI-VISA library, which is the de facto standard implementation of VISA. It is feature complete but requires that you install the proprietary library provided by National Instruments. This is the default backend and is bundled with PyVISA. (Notice that we provide the wrapper, you need to install NI-VISA yourself as explained in the PyVISA docs)

py: is an implementation of the VISA specification using popular python packages to talk over the different interfaces: PySerial, PyUSB, linux-gpib and socket (which is inside the Python standard library). It is almost feature complete for Message Based Instruments (ASRL, USB, TCPIP, GPIB). It is available through the PyVISA-py.



sim: allows you create simulated instruments using simple text files. It is great for testing and off-line developing of complex instrumentation applications. It is available through the PyVISA-sim.


As always, these releases would not have been possible without our awesome community that provides code, bug reports, testing and support.

Finally I would like to mention that PyVISA is great but is kind of middle level. For complex applications you want better abstractions that allow you to forget about how the voltage is asked to a particular Voltmeter. For that purpose, I created Lantz a few years ago. It provides a very nice way to write drivers that encapsulate instrument specific information to then use them in scripts and GUI apps. It is not a replacement for PyVISA. Lantz builds on top of it to do the low level communication.

It turned out that I was not the only one thinking and coding in these direction. And I have always felt that dividing the community among many projects is a waste of time and energy. Particular in this type of projects in which the community is not as large the numerical programming and there is already an established standard.

That is is why triggered by his contribution to PintMatthieuDartiailh and I have decided to work together. He did some awesome instrumentation related coding in eapii and HQCMeas. Other people joined these initial conversations and a python instrumentation initiative that we have called LabPy was bornWe have created an organization in GitHub to host Lantz and other projects with a common goal: making instrumentation better in Python.

Matthieu has been championing the refactoring of Lantz, putting the best of the different toolkits together in a cohesive package. I have no doubt that Lantz 0.4 will be even better than 0.3

Join us at https://github.com/LabPy

Popular posts from this blog

Communicating with instruments using PyVISA but without NI-VISA

Running Python code in a LaTeX document