Python


  • Tuesday, August 24, 2010 - 07:54

    In mid July 2010 I defended my thesis. The defense was followed by a rush to get my thesis revised and submitted by July 31. After the mad dash, a committee member that had more revisions than all the other four combined, and barely getting that member to sign in time, I finally printed my thesis and had it submitted to the graduate college. And yes, you read that correctly, I had five committee members on my ms committee.

  • Thursday, April 8, 2010 - 11:38

    Occasionally one has to jump through a lot of hoops and do some pretty bizzare and unorthadox things when coding. Especially when working with multiple versions of libraries. At work all of our iMacs were recently upgraded to Snow Leopard and Python 2.6 and libraries isntalled (all in 64-bit). Its nice to upgrade . . . when it doesn't break things. Unfortunately during the upgrade numpy 1.4 was installed. Now this was only unfortunate because the super computer we also need to run on has numpy 1.3 which won't unpickle objects pickled with numpy 1.4.

  • Saturday, March 13, 2010 - 15:36

     I use matplotlib fairly frequently in my research, it rocks. However, the fact that the MacOSX backed doesn't let me use 'Cmd-Q' to close things down is annoying. So my solution is a combination of pycario and preview with a little AppleScript through in for fun. I program in Eclipse with PyDev, however I run my python programs exclusively from iTerm. Hence, I'm used to cmd-tabbing back and forth between iterm and eclipse. However, when I run a program that opens up a gui, such doing "pylab.show()" things get annoying.

  • Thursday, February 25, 2010 - 12:31

    In my work I ended up needing to know the minimum volume bounding box (MVBB) of a given of points in 3d. This is also called the oriented bounding box (OBB). Finding the axis-aligned bounding box (AABB) is a simple task, however it can have a volume much larger than needed. Come to find out, finding the minimum volume bounding box is a very difficult problem with several techniques for finding it. However, I didn't find any useful code for finding the MVBB.

  • Wednesday, February 17, 2010 - 15:36

     So I needed to bind a lambda function to an object. I've been writing code that needs to run faster than it currently does and I've traced some slow-downs to repeated comparisons that are really wasted and things don't change once the object is instantiated. For instance below is an example to show you how one might code something (note this is just an example, not actual code)

  • Monday, April 6, 2009 - 13:16

    I have for some time now been using matplotlib to do all my graphing in python. Its a great package! Recently I've been wanting to do basic animation of graphs, while you'd think it would be simple has turned into a bit of a trek. There is a simple animation example found here: http://matplotlib.sourceforge.net/examples/animation/simple_anim_gtk.html it works okay, but if you try to move the window it freezes, and you can't use anything on the toolbar.

  • Sunday, February 15, 2009 - 15:18

    The more I work with python the cooler it becomes, especially the more I let my mind think of way out there things to do with the tools python provides. In my work I frequently find my self writing code in this order:

  • Friday, February 13, 2009 - 15:22

    So one of the coolest things I just found out about python is that it will let you chain comparisons, so 1 < a < 10 works. Even 1 < a < 10 < b < 25, and so on, you can even get really crazy and try a < 5 > b, wich is a funky way of saying a < 5 and b < 5, pretty cool huh!

  • Monday, February 9, 2009 - 18:25

    So today I used my first function closure in Python. I had always wondered why/how someone would use them, but today after reading an article earlier this morning I ran across a place to use them while coding this evening. Here we go:

  • Monday, November 24, 2008 - 11:40

    Python has a really cool feature called decorators. Which allow you to wrap functions around other functions in a clean way. The classic example would be the @trace decorator which would let us do this:

    @trace
    def sayHello(name):
       print 'Hello %s!' % name

    If we define the trace decorator like this: