Tuesday, September 13, 2011


This weekend I wrote my very first program with a graphical user interface (GUI, often pronounced "goo-ey"). It's a program to help me classify the thousands of spectra we have for our research project. After several months of effort, Dr. Takamiya finally decided that we couldn't rely on the computer to make determinations about the presence or absence of a particular spectral line because it produced too many false positives. It's  one of those jobs that are just better handled by a human eye and brain.

Anyway, since we have around 30,000 spectra to classify, I decided that I really needed a program that would allow me to work in more than one dimension at once, so I got to work learning wxPython and produced FluxClassify over the weekend. The version you see below is version 0.2, the first version with all the features needed to produce workable results.
FluxClassify version 0.2.
As you can see it's a fairly simple program, despite being over 1,200 lines long. Most of those lines are extremely repetitive ones dealing with the hundreds of checkboxes on this thing, so I actually wrote some other code to write that part for me. I think I only actually wrote maybe 100-150 lines of the code by hand. Each of the numbered checkboxes represents one of the 225 spectra in a cube file. The ones along the top check or uncheck an entire column, while the one labeled "Check All" does exactly what it says.

WxPython is basically a program that works with an existing Python installation (only versions 2.4-2.8 as of this writing, sadly) to provide wrappers for the wxWidgets library that provides a native look and feel for programs written in it no matter what platform they're implemented on. It's pretty cool, since it automatically includes such Windows 7 features as automatically expanding to fill half the screen when I drag the program to one side of my desktop.

...And looking at my screenshot here I just realized that I have both columns and rows labeled as columns. Time for version 0.2.01! A hui hou!

No comments:

Post a Comment

Think I said something interesting or insightful? Let me know what you thought! Or even just drop in and say "hi" once in a while - I always enjoy reading comments.