I used the IPython Notebook for my lab book for a year. How did it go?

It was exactly a year ago when I firmed up a workflow wherein the IPython Notebook was the center of my daily scientific research. All notes end up in a .ipynb file, and my code, plots, and equations all live together there. Looking back on 2013, how did it go and what should I change for 2014?

I am very happy with it overall. I have 641 .ipynb files, with names like 2013_01_01_EM_4_1_2.ipynb and 2013_12_22a_dm_pde_for_pop_prediction.ipynb. This includes notes for two courses I taught and plan to teach again, for several papers that we published, and for a large number of projects that didn’t pan out. I’ll definitely use the course notes again the next time I teach, I’ve already had to look up the calculations from some of those papers for responses to reviewers and clarifications after publication, and maybe I can come back to projects that didn’t pan out in the future with some new insight.

What could go better? I couldn’t decide if my lab book should capture everything, like I was taught in science class, or have a curated collection of my work including only the parts I would need in the future. Probably some blend is best, and since it is hard to know the right balance ahead of time, I tried to keep everything in a git repo, so that I could curate and edit, but recover anything that I realized I still wanted after cutting. I only ended up with 59 git commits, though. If that approach was working, I would expect more commits than notebooks.

I sometimes lost things in my stack of notebooks. The .ipynb format is not easy to search, so I kept a .py copy of everything and grepped through them looking for the notebooks about a specific technique or project. Since I organized my notebooks chronologically, I ended up doing this a lot more than if I had organized them thematically, but even if I already had all of my congenital heart disease notes in one place, I would still find myself saying, “I know I did some data munging like this for a different project recently, how does the pandas.melt function work again?”, or whatever.

The feature I would like the most is a way to paste images into my notebook. I wrote some notes about it in a github issue page about IPython Notebook feature requests. I want the digital equivalent of stapling a copy into my lab book, and I want it to be easy.

Collaboration worked pretty well. I have a lot of colleagues who don’t want to see Python code, no matter how much easier it would make their lives. I’ve had good success sending them pdf version of notebooks, or sticking my research notes in a github gist and sending them a link to nbviewer. I think there is room for improvement in this, too, though.

2 Comments

Filed under global health

2 responses to “I used the IPython Notebook for my lab book for a year. How did it go?

  1. kjforeman

    How about tagging your py/ipynb files to facilitate subsequent searching? File system tags are unfortunately not very portable, so maybe just include tags/keywords in a comment at the start of the file?

    I think it’d work great in theory, but in practice I’d be hard pressed to actually keep it up…

  2. That is a really good idea, and something that I should try. I’ll definitely start by adding some text at the top of my notebook, not with any OS level solution.

    My obsessive tendencies rebel against tagging, because I don’t use the same tags when I should. Technology can help with this, and I can see how well the wordpress approach has worked for healthyalgorithms over the last few years (pretty well).