Python modules by Rob W.W. Hooft

Although most of the python modules I'm working on are for the data collection software for the Bruker AXS Single Crystal Diffraction systems (and can not be redistributed), there are a few nice ones that I think are more generally applicable.

I'll put them here. Tell me if you use/like/dislike any of this!

task.py (RCS version 1.28, (2001/02/09))
Manage asynchronous subprocess tasks.

This differs from the 'subproc' package!

After starting the task, we can just: Summarizing: Another difference of task with 'subproc': Differences with the previous version (1.15) which was here:

stdoutfilter.py
Filter stdout and stderr to prevent I/O errors on stdout.

Some people background programs that are producing output on STDOUT or STDERR. If they close the terminal window after that, the tty becomes unavailable, and the program might crash when it tries to write there. Since the stack trace goes to stderr.....

This module replaces stdout and stderr by pseudo-files that will start writing to a file when IOErrors occur on the tty.

dis.py
An example program on how to display Numeric arrays using PIL. I have this problem in my work (See ndisp), where the data is 16 bit integer, and all 16 bits are significant. Therefore "dis.py" shows some special features for scaling any integer or floating point value to an 8-bit displayable image.

enum.py
An example of how to do/use enumeration types in python.

follow.py
An undressed version of the python profiler that prints every call and return when it is executed. I have used this to trace problems in code that "crash" the interpreter instead of printing a stack trace (This can happen for some exceptions in Numeric python, or for gui code like PyQt).

comparestrings.py (2005/05/28)
A one-function module to compare short strings and give a similarity score. The similarity score is based on an algorithm used in Bioinformatics to compare protein sequences. Letters adjacent to each other on the keyboard are considered somewhat similar. This can be used to compare commands given on a keyboard to possible commands of a program. If one possibility stands out, that is probably what the user meant to type. This is only suitable for ASCII strings, and probably not much longer than around 25 characters.

For non-python related issues, see my home page.
Rob Hooft, Last modified May 28, 2005