Software I've written myself, or projects to which I've made a reasonable contribution.

Mailcap files, defined in RFC 1524, allow you to tell you mail clients, web browsers, and other programs how you want to view and edit various MIME types. Since interaction with your mailcap files often occurs deep within the bowels of your program, I've written up a very simple Python script to test your mailcap entries: mailcap-test.py. Enjoy!

Posted Thu Dec 1 20:43:14 2011 Tags: code

In the course of my research, I've spend a good deal of time developing clean, Python interfaces to much of our lab equipment. I also tend to have strong opinions on the One True Way® to solve a problem. This means that I occasionaly end up writing script to run other people's experiment, especially when they don't take all that much time to write.

I wrote slow_bend for Liming Zhao, who was a postdoc in our lab from 2008 to 2010. Liming coated one side of an AFM cantilever with a film of cellulose and used slow bend.py (version 0.2) to monitor the cantilever deflection as he flushed in different buffers (paper). Unfortunately, the paper claims the data aquisition was carried out in LabView.

slow_bend is not a complicated program; it polls analog input channels using pycomedi (and optionally reads temperatures using backends from pypid). The polling continues until slow_bend recieves a KeyboardInterrupt.

$ slow_bend.py --version
0.4
$ slow_bend.py 0 3
#time (second)  chan 0 (bit)    chan 0 (volt)   chan 3 (bit)    chan 3 (volt)
1.81198e-05 34727   0.598001    39679   2.10925
4.00409 34956   0.667887    38033   1.60693
8.00408 35074   0.703899    36780   1.22454
12.0041 35041   0.693828    35814   0.929732
16.0041 34917   0.655985    35044   0.694743
^C
Posted Sat Nov 12 17:50:00 2011 Tags: code

Available in a git repository.
Repository: cookbook
Author: W. Trevor King

I've been running a home-rolled recipe webapp for a year now, and it worked fairly well in a bare-bones sort of way. However, I recently had to make some changes to my personal website (since EveryDNS and aparently most other free DNS providers were bought by Dyn), which prompted me to translate cookbook into a Django app. Thanks to the wonders of Django, Grappelli, and django-taggit, the code is now leaner, meaner, and prettier!

See the README for details.

Posted Fri Aug 5 13:59:01 2011 Tags: code

Available in a git repository.
Repository: h5config
Author: W. Trevor King

Since the number of packages mooching off pypiezo's configuration scheme was growing, I've split it out into it's own package. Now there's a general package for all your HDF5-based configuration needs.

The README is posted on the PyPI page.

Posted Thu Jul 28 12:25:06 2011 Tags: code

Available in a git repository.
Repository: pypid
Author: W. Trevor King

I've just finished rewriting my PID temperature control package in pure-Python, and it's now clean enough to go up on PyPI. Features:

  • Backend-agnostic architecture. I've written a first-order process with dead time (FOPDT) test backend and a pymodbus-based backend for our Melcor MTCA controller, but it should be easy to plug in your own custom backend.
  • The general PID controller will automatically tune your backend using any of a variety of tuning rules.

The README is posted on the PyPI page.

Posted Wed Jul 27 12:06:19 2011 Tags: code

Available in a git repository.
Repository: insider
Author: W. Trevor King

Insider is a little Django app I wrote to help my brother, Garrett, track insider trading with a simple, familiar web interface. It's a pretty simple app, partly thanks to Bradley Ayers' django-tables2, which does the table formatting. Just goes to show that a good scripting language and framework make developing simple apps a breeze!

The README is posted on the PyPI page.

Posted Thu Jul 21 18:30:33 2011 Tags: code

Available in a git repository.
Repository: pyrisk
Author: W. Trevor King

Play Risk (or similar games) over email!

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: code

Available in a git repository.
Repository: pycomedi
Author: W. Trevor King

I was getting frustrated with Comedi's SWIG wrappers, so I wrote a more object-oriented wrapper using Cython.

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: code

Available in a git repository.
Repository: pypiezo
Author: W. Trevor King

This is a piezo-actuator control library based on pycomedi. It also contains some atomic-force-microscope-specific logic. The higher-level library pyafm extends the AFM-control framework with coarse positioning.

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: code

Available in a git repository.
Repository: pyafm
Author: W. Trevor King

Here is my Python module for AFM cantilever positioning, combining both the fine adjustment of pypiezo and the coarse adjustment of stepper.

The README is posted on the PyPI page.

Posted Tue Apr 19 15:18:29 2011 Tags: code