Posts

Showing posts with the label Automation

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-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...

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)  ...

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...

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...

PyVISA 1.6 brings comprehensive resources classes, thread-safety and more

PyVISA is a Python frontend for the VISA library that enables controlling all kinds of measurement equipment through GPIB, RS232, USB, Ethernet among others interfaces. PyVISA 1.6 release is close and it brings several new nice things. One of the most visible improvements is the addition of a comprehensive set of resources classes , each mapping to a one of the 13 types of resources. Each class implements the methods and attributes that the specific session can handle, providing a Pythonic way to interact with the device (See here ). This has allowed us to implement higher level functions such as the group execute trigger in the GPIB Interface. PyVISA 1.6 brings a much better way to query a device for values , providing a comprehensive API to convert back and from ASCII and binary blocks. An API to write values to a device has been added (See here ). PyVISA 1.6 is thread-safe . While the VISA library has always been thread-safe, PyVISA was not. We have refactored the code r...

PyVISA 1.5 is out

PyVISA is a Python wrapper for the VISA library that enables controlling all kinds of measurement equipment through GPIB, RS232, USB and Ethernet. It has served the instrumentation community very well since 2005 (that's Python 2.3!) and still does. However, Python and the different supported platforms have changed a lot in the recent years. We thought that PyVISA could use an update. Within the Lantz Project we did a small proof of principle of such update in visalib . Now we are taking what worked well and use it into PyVISA 1.5 (without changing the API!). In other words, PyVISA 1.5 brings several important changes in the underlying architecture without forcing you to change the programs . Some time ago I posted that we were going beta. Now PyVISA 1.5 is finally released. The new architecture is summarized here and the comparison with the previous one is here . Briefly you get Python 3 support , Mac OS X support , a better way to find libraries in your platform , a...

A new PyVISA release is around the corner and we need your help

PyVISA is a Python wrapper for the VISA library that enables controlling control all kinds of measurement equipment through GPIB, RS232, USB and Ethernet. It has served the instrumentation community very well since 2005 (that's Python 2.3!) and still does. However, Python and the different supported platforms have changed a lot in the recent years. We think that PyVISA can use an update. Within the Lantz Project we did a small proof of principle of such update in visalib . Now we are taking what worked well and use it into PyVISA 1.5 (without changing the API!). In other words, PyVISA 1.5 brings several important changes in the underlying architecture without forcing you to change the programs. The new architecture is summarized here and the comparison with the previous one is here . Briefly you get Python 3 support , Mac OS X support , a better way to find libraries in your platform , an isolated ctypes wrapper. But the most important change is that the VISA library is not op...

The structure of a Lantz Driver

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. All Lantz drivers classes are derived from Driver , which provides the infrastructure and boiler plate code to perform common operations. Logging, timing, async calls and other features are enabled by sub-classing from Driver. But usually you do not subclass from Driver directly, but rather from a specialized class depending on the way you communicate with your instrument. For example, if the instrument is controlled over RS-232 (Serial), you sub-class from SerialDriver . If it is controlled over TCP, you sub-class from TCPDriver . There is also a class for GPIB and there be soon will for USB. All these classes belong to the same family as they communicate with instruments by exchanging  textual messages. They share a common interface and therefore it is very easy to build drivers that support different commu...

Moving to Lantz

Image
Lantz is a Python automation and instrumentation toolkit that allows you to control instruments in a clean and efficient manner writing pure Python code. Since I released Lantz a few weeks ago, I have received a lot of positive e-mails about the project. Most of them can be summarized as: It looks very nice! I love Python and I have been looking for a Pythonic way to do instrumentation! It is encouraging to receive such positive comments and also confirms that Lantz is in the right path: Not a Domain-specific language, not a do-it-my-way framework, but a complete, coherent and concise set of classes and functions for instrumentation in Python. Lantz provides base classes and functions decorators to help you write your drivers as shown in the figure (thanks Pablo Jais!). Y ou can find more details in the documentation's overview . Inertia is what stopping many to start using Lantz. For most of us, instrumentation is the means to an end. We need to measure, do experiment...

Announcing Lantz: Instrumentation in Python

Image
Today I am releasing Lantz , a Python automation and instrumentation toolkit that allows you to control instruments in a clean and efficient manner writing pure Python code. Instrumentation and experiment automation became a cornerstone of modern science. Most of the devices that we use to quantify and perturb natural processes can or should be computer controlled. Moreover, the ability to control and synchronize multiple devices, enables complex experiments to be accomplished in a reproducible manner. This toolkit emerges from my frustration with current solution. If you have worked in a research lab, you know that most that is out there is done using Domain Specific Languages (DSL) like LabVIEW and MatLab Instrumentation Toolbox . They are great for their original purpose but as soon as you want to code a real application their idiosyncrasy gets in the way. They lack certain features and good design that we enjoy in some general purpose languages. So the choices are: you ...