Posts

Showing posts from October, 2012

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 communication channels…