IPython inline images and videos

Posted on Leave a comment

When working with large arrays of data, especially spatiotemporal data, visualization methods are needed. While the imshow function of scipy provides a backend-agnostic way of visualizing array data, and allows for all sorts of annotations, like axes labels, I found myself unhappy with the result more often than not. There are two things that are difficult to get right when displaying image arrays in an IPython notebook: First, the figure size determines the maximum size of the image and cannot be adjusted dynamically by dragging its edges in the browser. Second, the architecture of matplotlib requires the image to undergo […]

Quick tip: concatenate MP3s on the command line

Posted on 2 Comments

Joshua Barratt posted a quick hack for concatenating MP3s here: find . -name ‘*.mp3’ -exec lame –decode ‘{}’ – ‘;’ | lame -a –tt “Title” –tl “Album” –ta “Artist” -b 96 – concatenat.mp3 LAME will decode the MP3s to WAV files and concatenate these to a single stream, which is then passed to LAME for reencoding. If you do it this way, however, the WAV headers of the files following the first one will end up being interpreted as waveform, which may lead to noticeable glitches at the seams. This one is better (and shorter): cat *.mp3 | lame –decode […]

Graphical code profiling in IPython

Posted on Leave a comment

As you might know, IPython is the new Matlab. The great thing about using IPython notebooks for scientific data analysis is that Python is very extensible. I have been adding many little helper functions to my environment that make developing a lot easier. Here’s a little helper function that evaluates a given Python statement and turns it into a graphical summary of where the largest portions of CPU runtime are spent. The output looks like this (click for larger view): from nbhelpers import profviz statement = ‘for i in range( 1000 ): svd( dot( standard_normal( ( 10, 200 ) ), […]