Posts Tagged 'Python'

Determining Python program behavior based on available imports

Python’s import statement is an executable statement like any other. This means it can be used to determine if a particular external module is available. If a module is not available for import, the program can either modify its behavior accordingly, or shut down in a graceful fashion. Continue reading ‘Determining Python program behavior based on available imports’


C++, CUDA, Python, and Really Big Cameras

I can’t believe this blog is still here. Amazing. I figured WordPress would close it down by now.

A lot has happened since the last entry. My book was released by O’Reilly (and it’s been doing OK), I came down with a severe case of food poisoning (and ended up in the ICU), and some months later had triple-bypass open-heart surgery (and another stay at the Hotel ICU). Fun times.

Here’s a link to the book, if you’re interested (shameless self-promotion):

and of course it’s also available on Amazon.

Continue reading ‘C++, CUDA, Python, and Really Big Cameras’

It’s been a while…

In case you were wondering, well, I didn’t fall off the face of the Earth. At least not yet.

I haven’t had a chance to post anything since the middle of August because I’ve been massively busy wrapping up a big project, writing a couple of book proposals and trying to work on some technical papers. Of course that means that I’m spending a lot of time putting out little fires, chasing down issues that seem to only pop up at the last minute, and not getting a whole lot of sleep.

Anyway, I’m just about ready to post the last two parts of the PGM series, but in the meantime I would like to direct the attention of the Python folks to the tool Epydoc. If you write more than just simple utility scripts in Python, then you really should take a look at this (if you haven’t already). It may not have all the bells and whistles that Doxygen has, but it has enough to make it very useful. At work I have a cron job set up on the lab server to run Epydoc across the code base every night and put the results up where folks can access them via the internal web server.

More (much more) to come. Stay tuned, film at eleven.

Netpbm and the PGM Format – Part 2

This is the second part of a series on processing PGM format image files in Python. For an overview of what PGM is refer to Part 1. In this part we’ll look at how a PGM file is generated and create a few small images to look at. In part 3 of this series we’ll examine some utility functions to write, read and display PGM image data. Lastly, in part 4, we’ll take a look at a case study of how the PGM format was used for scientific CCD camera testing, and offer some suggestions for how you might be able to use it.

Continue reading ‘Netpbm and the PGM Format – Part 2’

Netpbm and the PGM Format – Part 1

In this series of articles I’ll introduce the Netpbm suite of tools and its simple and versatile PGM image file format, and demonstrate how PGM can be used for image processing and arbitrary data storage in Python.

In this part we meet Netpbm and its PGM file format. In the next installment I’ll present some Python code to read and write a PGM file. Later on I’ll present a simple image viewer to display the data, and lastly, I’ll present some unconventional techniques for storing things other than actual images in the PGM format, along with some reasons for why one might want to do that.

Continue reading ‘Netpbm and the PGM Format – Part 1’

INI Files

So-called “INI” files are ubiquitous. You can find them on Unix systems, Windows platforms, and even in the flash memory of embedded systems. I even once wrote my own INI parser for some software on a embedded diskless VME control system running WindRiver’s VxWorks. It allowed us to upload new configuration and control parameters on-the-fly in a human-readable format. Very handy.

Continue reading ‘INI Files’

Determining button up/down times in wxPython

I recently encountered a need to be able to determine how long a user held down a button on a GUI dialog in order to command a proportional amount of movement in a mechanism. In other words, the longer the button was down, the longer the mechanism would be commanded to move.

Continue reading ‘Determining button up/down times in wxPython’

Follow Crankycode on

Little Buddy

An awesome little friend

Jordi the Sheltie passed away in 2008 at the ripe old age of 14. He was the most awesome dog I've ever known.