Recent Entries »

Analysis of the 2011-2015 Boston Marathon results

I recently analyzed the 2011-2015 Boston Marathon results. You can see the results in this GitHub Repo, or go straight to the IPython/Jupyter Notebook for the details.

Boston’s getting competitive

One of the more interesting observations is that with the tighter qualifying standards the race is much more competitive. Runners have apparently responded by stepping up their game, or perhaps, the race is now limited to faster runners.

The combination of a -5 minute adjustment across the board combined with the “fastest get in first” rule has created a much more competitive environment. This can be seen by comparing the distribution of finishing times for the M18-39 age group from 2011 (before the changes) to 2015 (the most recent year). (Both years generally were “fast”, as measured the mean and median finishing times)



You can see that the mode (most frequent bin) has been pushed from sub-3:10 to sub-3:00. This is very impressive for such a large race.

Check out the full results for more details!

Converting an IPython Notebook to PDF

If you have an IPython Notebook (*.ipynb file), you may want to convert to PDF for distribution. If you read the documentation for ipython nbconvert, it seems fairly straightforward:

$ ipython nbconvert --to PDF <your notebook>.ipynb

However, if you run that, you’re likely to run into an error asking to you install Pandoc; this is because nbconvert relies on an intermediate conversion to LaTeX first, and then to the final PDF output. Pandoc is used for this. To install on OS X:

$ brew install pandoc

Running the conversion again yields another error, suggesting you need the pdflatex command; Pandoc doesn’t include any built-in support for LaTeX->PDF, so you’ll need a LaTeX install. The Pandoc documentation suggests BasicTeX:

$ brew cask install basictex

Trying conversion results in another failure. Turns out, you need to install some more LaTeX packages:

$ sudo tlmgr update --self
$ sudo tlmgr install adjustbox
$ sudo tlmgr install collectbox
$ sudo tlmgr install ucs

After this, you should be able to do your conversion and have a fairly-decent PDF output based on your IPython Notebook:

$ ipython nbconvert --to PDF <your notebook>.ipynb

Remote Python debugging using PyDev/LiClipse for OpenStack Swift

We all know what debugging is – stepping through running code, line by line, inspecting variables and trying to figure out what’s wrong with your program while simultaneously tearing your hair out. However, usually when debugging Python code, the Python process is running locally on your system. What happens if you want to debug through code running on another server?

This is typically the case when working with OpenStack Swift, since the Swift-all-in-one (SAIO) instructions tell you to use a VM to run your Swift installation in, and a Vagrant VM provided by SwiftStack simplifies this. However, this means that the Swift code is not running locally; it’s running inside of your VM – so how do you debug into it?

Remote debugging aims to solve this by allowing you to inspect, trace and step through code running in a Python process on another machine. Setting this up requires some work, but is well worth the effort when debugging a non-trivial application running on a remote server or VM.