Python LabTools for talking to GPIB instruments
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
README
hp3245a.py
hp3245a_service.c
hp33120a.py
hp3336c.py
hp34401a.py
hp3458a.py
hp3577a.py
hp5370b.py
hp5372a.py
hp6626a.py
hp6626a_calibrate.py
hp6653a.py
hp85662a.py
hp8568b.py
hp8657a.py
pcl_util.py
prologix_usb.py
pylt.py
svg_plotter.py
tds540a.py
u2004a.py
usb488.py

README

What?
======
This is a set of Python classes for communicating with IEEE488/GPIB
instruments which I use in my private lab.

The base class is "pylt" - PYthon LabTools - which defines the generic
API that hides the particular details of getting HPIB working for
this instrument.

As a result, a typical Python script for measuring something can look
almost readable:

	import u2004a

	d = u2004a.u2004a()

	# 1 MHz, -25 dBm, best resolution
	d.config(1e6, -25, 4)

	while True:
		print(d.measure())

Currently two hardware connections are supported:  Prologix USB-GPIB
adapter and direct USBTMC/USB488 connection.


Why?
=====

For those of you who are happy with LabView, etc., this will look
like yet another 1980s rerun.   Now that I've said it, you
don't need to waste email-bandwidth telling anybody that :-)

Yes, I am aware of py-visa and a few other efforts, but I needed
something that worked and found that they generally spent a lot
of code offering things I didn't need or even want.

Be aware that this is not even close to a nice and polished release,
and that you will probably never see one either:  This is a snapshot 
of what I happened to have on my lab-computer right now, and I will
update it as time/need/inspiration strikes.

There is a sort of vision behind it which has matured as I went
along and learned more and more Python, and I will try to move
closer to that as I go.  The best place to spot it is in the
pylt.py file, where the methods all instruments should support
are defaulted.


Prologix.biz USB-GPIB
=====================

The one thing you need to know is that you must tell where to
find your instruments.  

For instance:

        class hp3336c(prologix_usb.gpib_dev):
                def __init__(self, name = "gpib0", adr = 13):

"gpib0" corresponds to /dev/gpib0 (which is where one of my
Prologix USB-GPIB adapters show up), and 13 is the bus address.

There is a nifty multiplexing facility built in, so you can
talk to multiple instruments at a Prologix driven bus at the
same time from the same Python script, without having to
think about it.


USBTMC/USB488
=============

This one caused me no end of pain. What a sucky standard, but
at least it looks like the Agilent U2004A Power Sensor works
reliably now.

You will need py-usb 1.0 and some backend for it; I use libusb.


Getting started
===============

With git installed do:

	cd /some/where
	mkdir pylt
	cd pylt
	git clone git://github.com/bsdphk/pylt.git


Who?
=====

Written by Poul-Henning Kamp, <phk@FreeBSD.org>.


License?
=========

/*
 * ----------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42):
 * <phk@FreeBSD.ORG> wrote this file.  As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
 * ----------------------------------------------------------------------------
 */