Skip to content
/ pylt Public
forked from bsdphk/pylt

Fork of PHK's Python LabTools for talking to GPIB instruments

Notifications You must be signed in to change notification settings

talister/pylt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, <[email protected]>.


License?
=========

/*
 * ----------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42):
 * <[email protected]> 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
 * ----------------------------------------------------------------------------
 */

About

Fork of PHK's Python LabTools for talking to GPIB instruments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.3%
  • C 7.7%