pygpibtoolkit

pygpibtoolkit is a Python toolkit for talking with GPIB devices. It consist in a set of python modules (low-level and some more high-level) in order to ease writing python code to play with GPIB devices.

There are also some utility commands and GUI tools written using this library (and PyQt5 for GUI tools).

The aim of the project is to have an infrastructure that make it easy to write code to command/interact with GPIB-controlled devices, and, as a corrolary, make it easy to write “description” code for specific test equipments.

Quick start

The simplest way to install pygpibtoolkit is to use pip. I strongly recommend you use virtualenvs for this, for example via virtualenvwrapper or pew. Here is an example session using virtualenvwrapper on a Debian stretch machine:

david@host:~$ mkvirtualenv -p /usr/bin/python3 pygpib
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/david/.virtualenvs/pygpib/bin/python3
Also creating executable in /home/david/.virtualenvs/pygpib/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

(pygpib) david@host:~$ pip install pygpibtoolkit
[...]
Installing collected packages: pyserial, numpy, sip, PyQt5, pyqtgraph, pygpibtoolkit
Successfully installed PyQt5-5.10.1 numpy-1.14.3 pygpibtoolkit-0.1.0 pyqtgraph-0.10.0 pyserial-3.4 sip-4.19.8
(pygpib) david@pavo:~$ pygpib-detect --help
usage: A simple tool for detecting connected GPIB devices [-h] [-d DEVICE] [-v]

optional arguments:
  -h, --help            show this help message and exit
      -d DEVICE, --device DEVICE
                        Device of connected Prologix GPIB bundle
                        [/dev/ttyUSB0]
      -v, --verbose
(pygpib) david@host:~$ python
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pygpibtoolkit.prologix import GPIB
>>> from pygpibtoolkit.gpibcontroller import GPIBController
>>> cnx = GPIB(device='/dev/ttyUSB0')
>>> ctl = GPIBController(cnx)
>>> dvm = c.register_device(24, "HP3456A")
>>> dvm.S0F1 # set DVM to DC Voltage mode

Indices and tables