Another year of hackerific

Posted by matt
on Monday, January 19

2008 was an eventful year for hackerific, I entered my second year of blogging in October (and nearly didn’t notice), started posting more on TextMate and Python, and discovered and got involved with loads of cool projects.

I had originally intended to write a ‘year in review’ type of post, but instead of something retrospective, I’ve decided to talk about things I’d like to accomplish this year. Here the list:

  • Lots more work and posting on the IPython TextMate Bundle. A quick google reveal an entire page of links related to this project, and it’s only just started! I’m hoping that this year we’ll get all of the bits I listed in my future directions post sorted, and lots more besides. In particular, the twisted based server should allow lots more functionality. You can find lots more info about this bundle in the announcement post. I’d encourage you to fork the project on github and join the mailing list to get involved.
  • More features in the Plain Text Wiki TextMate bundle. I’m still trying to change my habits to use this bundle more effectively, and I’m beginning to get there. It’s also been noticed by some other people, notably Marcelo Alvim who’s hacked in support for absolute links and subdirectories.
  • tm-terminal looks like a cool idea. It’s a command that injects TextMate’s environment into a terminal to help you code commands. I’m planning on extending it to work with my shell of choice, zsh.
  • Fix the online help commands in the Gnuplot bundle. This is still on my todo list.
  • Screencasts! Based on the success of my previous screencasts, I plan to make more! At the moment, I have ideas on screencasts for the gnuplot and IPython bundles. It’s unbelievably fun, and takes ages though, so it may be a while before I get around to it.
  • Other fun, useful or interesting things as I find them – this goes without saying!
  • Finish my PhD thesis. I know this is not particularly related to this blog (apart from that it’s eating all of my time), but this is a fairly large chunk of my life. Once I’m done I should have plenty more free time to hack and blog to my hearts content… once I’ve got a job that is. If you know of any work in the South West of England that you think I might be particularly suitable for, drop me an email, I’d really appreciate it!

Feel free to leave comments below, and here’s to a great 2009.

More Chaco

Posted by matt
on Friday, November 07

I’ve been doing a little bit more tweaking with chaco, learning how to use groups and containers. The docs are great, if a bit incomplete, so I ended up looking at various examples.

I’ve updated my simple AM demo so that it now shows the frequency content of the signal (calculated on the fly, using an FFT).

The running program looks like this:

AM Demo with FFT
Uploaded with plasq’s Skitch!

I’d still like to add zooming and area selections to the x-axis, and tidy the plots up a bit, but it’s looking good.

The code used to generate this coolness was:

Short and sweet.

Exploration with Chaco

Posted by matt
on Wednesday, November 05

This morning I was reading this tutorial on Chaco, a 2-D visualisation toolkit for Python (it’s part of the enthought python distribution), and I wanted a toy project to get a feel for it.

I decided to put together a very quick model of amplitude modulation, the kind of thing elec-eng students cover early in their degrees.

I came up with this:

AM Demo
Uploaded with plasq’s Skitch!

It’s very heavily based on the code in the tutorial above, but it works well, and it looks and feels pretty cool.

I find this kind of app very useful for helping me get a feel for how something works, and using something like chaco in this way makes it very easy to throw quick models together to play with.

My next challenge to to find something useful to do with it!

Here’s the code:

Aesthetics in Plotting and Visualisation

Posted by matt
on Tuesday, October 28

I’m fairly sure that aesthetics play a large part in how people view your work – ugly correct results are probably viewed as being worse than pretty, but wrong results. Aesthetics must play a fairly big role in how people perceive your work.

I’ve just finished generating a lot of quiver plots for my thesis. A quiver plot is a graph of vectors, illustrating a flow field. My results typically show an image with motion vectors overlaid, all plotted with Matlab, a piece of software which is very heavily used in academia in the UK (and probably all over the world).

Matlab quiver plots are ugly, and all of my plotting got me wondering how other system’s quiver plots look. In particular, I’ve started playing with numpy and scipy, so I decided to do a quick comparison between matlab, and matplotlib, the python close of matlab’s plotting tools. The results are very interesting.

I generated a quick example motion field, and plotted it with quiver. Then I took screenshots. I used the Gimp on my Linux box, for the matlab example) and Skitch on my MacBook for the python example.

First, here’s the matlab example. This was generated on linux using Matlab 2007a:

matlab_quiver
Uploaded with plasq’s Skitch!

Here’s the matplotlib python example, generated using the enthought python distribution. I used colour here because I could: matplotlib’s quiver supports it out of the box. Matlab’s doesn’t.

Figure 1
Uploaded with plasq’s Skitch!

I think the difference between the results is abundantly clear. Matplotlib’s arrows look great, they’re shapely and well scaled. Matlab’s look like jaggedy lines in comparison. However, I think the main difference is down to anti-aliasing. The matplotlib’s result looks better because they’re smoother and look far more modern the 90s throwback that is matlab’s interface (on linux and Mac at least – I can’t speak for Windows).

These results have pretty much convinced me to try my next project using Python and scipy instead of Matlab. Not only is it completely free (EPD is free for academic use, and matplotlib, scipy and numpy are just plan free), the aesthetic is there too. It’s almost like python’s elegant simplicity ideals spilled over into their plotting engines.

Automated Photo Borders

Posted by matt
on Tuesday, July 15

If you’ve ever wanted to automatically add a coloured border to an image, then this ruby script might come in handy.

add_border.rb does exactly what you expect; it adds a border. You can specify the outer and inner sizes, and the colour of the inner border between. By default, this colour will be the average RBG value, giving you an awesome look by default.

To use it, just run ruby ./add_border.rb, or chmod +x it, and run ./add_border.rb. Available arguments are:

  • --help or -h for help.
  • --color, or -c to specify the border colour
  • --inner, or -i for the inner (coloured) border thickness
  • --outer or -o for the outer (black) border thickness
  • remaining arguments are considered filenames to process.

The script will output files whose names are the same, but with _border added before the filetype suffix, so that my_image.jpg would become my_image_border.jpg.

You can get it from:

  • svn
  • Github (preferred) as I probably won’t update SVN anymore.

add_border.rb requires RMagick.

Note: I lost the original description page when I nuked my site. So this is a new one.