Wednesday, September 01, 2010

DAQpy

Once upon a time I needed to write an application that interfaced with the real world.  I decided I wanted to use a data acquisition device from NI but I'm picky.  I want easy prototyping with fine control in the finished product.  That kicks out LabVIEW (luckily I'm forgetful or else I could write post after post about the good and bad of LabVIEW).

So I decided to use the C with DAQmx.  For prototyping I decided to use Python with its ctypes library.  I found some example bindings on a scipy page but they were hand generated and didn't seem very pythonic.  So I wrote my own generator and then added some custom helpers on top to make common operations more pythonic.  Unlike pydaqmx (which I just now found out about) I include my code-gen tool and I don't try to create a fake OOP system on top of the DAQmx API.

I even took some of the basic examples included with DAQmx and created the Python equivelants.

You can find a copy of DAQpy on github.  I would caution I re-organized the code on my Linux box which means I don't have access to DAQmx to validate things.  Patches welcome :)