Posts

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.

Code: https://github.com/hgrecco/pyvisa Docs: http://pyvisa.readthedocs.org/ Tracker: https://github.com/hgrecco/pyvisa/issues
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 one…

PyVISA-sim. Test your PyVISA applications without connected instruments

I have just released PyVISA-sim 0.1. PyVISA-sim is a backend for PyVISA. It allows you to simulate devices and therefore test your applications without having real instruments connected.
While there still a lot of features to add, this early release already allows you to: - play around with a simulated device. - write your own simulated device in YAML files.  - simulated devices can include commands and properties which are automatically generated from the YAML file. - Properties can have some basic validation rules.
Install it using:
    pip install -U pyvisa-sim

Code: https://github.com/hgrecco/pyvisa-sim Docs: http://pyvisa-sim.readthedocs.org/ Tracker: https://github.com/hgrecco/pyvisa-sim/issues

Lantz 0.3 is out: better PyVISA support, leaner drivers, great GUI building blocks

Lantz is a Python automation and instrumentation toolkit that allows you to control scientific instruments in a clean and efficient manner writing pure Python code.

After waiting for a long time, Lantz 0.3 is out. It took a while, but it was for a good reason: we were toying, playing and testing with new ideas to make Lantz better. I am going to go quickly over some of them.

MessageBasedDriver: a class to rule them all

MessageBasedDriver  replaces all previous Driver classes for message based instruments. It leverages the power of PyVISA to talk over many different interfaces. But remember that this does not mean that you require NI-VISA installed. You can still talk via the pyvisa-py backend which uses PySerial / PyUSB / Python Standard library. You can also use the pyvisa-sim backend to simulate devices!


Great GUI applications

Lantz provides two classes to help you build applications: Backend and Frontend. The first contains the logic of your application and the second the GUI. This ke…

Pint 0.6: faster and with better non-multiplicative units support

I have released version 0.6 of Pint, a Python units library.

Pint is Python package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units.

It provides a comprehensive and extensive list of physical units, prefixes and constants defined in a standalone text file. The registry can parse prefixed and pluralized forms of units resulting in a much shorter and maintainable unit definition list.

It also provides great NumPy integration without monkey patching or importing a particular module, with implicit unit conversion and an emphasis on correctness.

What's new The largest change landed in the way Pint handles offset units such as temperatures. It now provides a much better behavior that is both correct and useful. It deals properly with differences of temperatures, providing useful error messages when the requested operation is a…

PyVISA command-line utilities

PyVISA is a Python frontend for the VISA library that enables controlling all kinds of measurement equipment through GPIB, RS232, USB and Ethernet among others interfaces.

If you are following the development of PyVISA you might have seen that we have recently made the visa module executable to provide a few useful utilities. To try this, you need to update to the latest PyVISA:

$ pip install -U https://github.com/hgrecco/pyvisa/zipball/master

First, we now provide a simpler way to get debug information:

$ python -m visa info
Machine Details:
   Platform ID:    Darwin-10.8.0-x86_64-i386-32bit
   Processor:      i386

Python:
   Implementation: CPython
   Executable:     /Users/grecco/envs/lantz/bin/python
   Version:        3.2.3
   Compiler:       GCC 4.2.1 (Apple Inc. build 5666) (dot 3)
   Bits:           32bit
   Build:          Apr 10 2012 11:25:50 (#v3.2.3:3d0686d90f55)
   Unicode:        UCS2

PyVISA Version: 1.6.1

Backends:
   ni:
      Version: 1.6.1 (bundled with PyVISA)
      #1: /Library/Fram…

Communicating with instruments using PyVISA but without NI-VISA

PyVISA is a Python frontend for the VISA library that enables controlling all kinds of measurement equipment through GPIB, RS232, USB and Ethernet among others interfaces.

Starting form version 1.6, PyVISA allows to use different backends. The cool thing is that your code remains the same, except the line in which you instantiate the resource manager (which tells which backend to use).

A few days ago I blogged about one of such alternative backends called PyVISA-sim which allows your to mock the presence of instruments (in cased that you missed the announcement, is here). Today I am making public a second backend.

Until now, talking to instruments via PyVISA required that you had National Instruments VISA library installed in your system. This works most of the time, for most people. But NI-VISA is a proprietary library that only works on certain systems. That is when PyVISA-py jumps in. It is an implementation of message based communication (Serial/USB/Ethernet) using Python and som…

Simulated devices in PyVISA: early preview

PyVISA started as wrapper for the NI-VISA library and therefore you need to install National Instruments VISA library in your system. This works most of the time, for most people. But sometimes you need to test PyVISA without the devices or even without VISA.

Starting form version 1.6, PyVISA allows to use different backends. These backends can be dynamically loaded. PyVISA-sim is one of such backends. It implements most of the methods for Message Based communication (Serial/USB/GPIB/Ethernet) in a simulated environment. The behavior of simulated devices can be controlled by a simple configuration in plain text. In the near future, you will be able to load this from file to change it depending on your needs.


To test it you need to install PyVISA 1.6 which is currently only available from GitHub:

$ pip install -U https://github.com/hgrecco/pyvisa/zipball/master

And then install:

$ pip install -U https://github.com/hgrecco/pyvisa-sim/zipball/master


For those of you interest in the interna…