Alex's Abode

Photo of crazy professor with full chalkboard

Here is some of the code I have developed in the past or am currently working on. I also host this, and possibly other, projects on my github account so check that out, especially if you'd like to contribute.

Note that all of the code here is as-is and probably squarely falls into the academic code category. By this I mean that, while I stress easy to read code when I write--especially the library or API stuff--some of this may be a mess, buggy, fragile, etc. The goal of easy to read also means that the methods employed may not be the most efficient algorithms possible. These projects are written for my own enjoyment and hopefully you can get something out of them too!

Unless otherwise noted, all work on this page is by Alex Kuhl and is licensed under the BSD 3-clause open source license.


Oil and Gas Price Visualization and Statistics

Graph of percentage change of oil and gas since 1997... they roughly follow each other surprisingly I am hoping this is still a work in progress, but I am going ahead and putting up the current results. I started this project basically because I (and everyone else) notice huge jumps upward in gas prices but not downward, and basically for no apparent reasons. So, this project is partly to see how closely tied to oil prices gas really is and second just as a programming exercise in Python and its graph capabilities. Overall it appears that, in terms of % change since 1997, gas pretty much follows oil at the high level. I started at 1997 because that is when the government sources I got the data from become consistent for both data sets. See the graph for more information and here are some simple statistics. Although the average upward changes are higher, they are not enough to be that significant. Similarly, the max upward changes are close to the max downward (which I call min change below) changes; oil's downward change even beats out the upward. Note that oil is in $/barrel and gas is cents/gallon.
  • Max oil change: 9.17
  • Min oil change: -11.85
  • Avg oil change up: 0.691491628615
  • Avg oil change down: 0.626773211568
  • Max gas change: 45.9
  • Min gas change: -33.3
  • Avg gas change up: 1.74642313546
  • Avg gas change down: 1.54368340944
[download python file] - to run the file you need matplotlib, xlrd (for reading csv files), and numpy

Library and APIs

Colorspace Conversions

Small C++ library for changing colorspaces; converts RGB to HSV or HSL and back to RGB. I have not been terribly satisfied with the C++ code that I can find out there--either more inaccurate or hard to follow--so I wrote my own implementation based on the formulas found on Wikipedia (as of 3/2009). I am intending to add other conversions to this at some point in the future! [download c++ file]