Tag Archives: ipython

Talks in Python: Interactive Instruction with RISE

I had a chance to give a lecture on using Python/Pandas in scientific research this week, and it was __________ (fill this in after it happens…). Since I was talking about Python, I decided to make my talk in Python, too. I did this for a few classes in Winter and Summer quarters of 2013, but the technology has come a long way since then. For this time around, I used RISE aka the live_reveal extension, and I found it very promising, although _very_ “bleeding edge” (which is what happens when the cutting edge is too cutting).

To make it really work as a powerpoint killer, I think it needs a little more friendlyness on the slide layout side of things. I don’t need much, but I would like:
* a talk title slide that has title, name, and date;
* a full-screen image slide;
* a way to put slide titles in a consistent place;

Am I totally power-pointed in my desires? I should file some issues on github.

Other wishes, while it’s on my mind: would be helpful to start slideshow from highlighted cell, would be convenient if cell toolbar toggled automatically between slideshow to none when starting and stopping presentation display, make it all easy easy easy to use.

Leave a comment

Filed under education

IPython Notebook Clipboard Extension

I was so excited when I got the image pasting to work in my IPython Notebook, (although now I can’t find any mention of it on Healthy Algorithms…) but then things changed and I didn’t keep up, and it stopped working for me for a while. But then I _needed_ it, and so I figured out how to make it work again:

* upgrade IPython to the latest development version from github – https://github.com/ipython/ipython
* install the chrome_clipboard ipython notebook extension – https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/chrome_clipboard
* make it work each time, by adding a line to `~/.ipython/profile_[name]/static/custom/custom.js`:

$([IPython.events]).on('app_initialized.NotebookApp', function(){
require(['nbextensions/chrome_clipboard'],function(module){
module.load_ipython_extension();
});
});

So nice to have it back.

Leave a comment

Filed under software engineering

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

An ipython notebook to diff ipython notebooks

Here is something I needed recently that other people have been tweeting about needing, too: http://nbviewer.ipython.org/5649571

This could also a place to collect other ways to do it.

Comments Off

Filed under software engineering

hello, world of statistical graphics in IPython notebook

A few months ago, I had great success invoking the internet to come up with the “hello, world” of statistical graphics.

There are some exciting new developments in javascript-based plotting, and this graphic is just the thing to compare them. D3js has conquered the world in recent years, and is something that my colleagues are starting to think they need to know. Meanwhile, one of the d3js instigators has unveiled the next in his series of revolutions in data visualization, Vega. This is still in development, but may be more appropriate than d3js for routine plots. And it was very soon after the Vega specification and runtime appeared that a python package for it was also released.

Here is an IPython notebook comparing all of these options. The notebook doesn’t save javascript in a way that redisplays, but if you put it in your own notebook server and execute all the cells you should see something like this:

vincent_vega

p.s. google vincent vega to learn the pop culture joke behind this strangely named python package.

2 Comments

Filed under software engineering

Stan in IPython: reproducing 8 schools

Continuing my experiment using Stan in IPython, here is a notebook to do a bit of the eight schools example from the RStan Getting Started Guide.

Comments Off

Filed under software engineering

Stan in IPython: getting starting

There has been a low murmur about new MCMC package bouncing through my email inbox for a while now. Stan, it is. The project has reached the point where the developers are soliciting Python integration volunteers, so I decided it is time to check it out.

Good news, it installed and ran the example without frustration! I don’t take that for granted with research software.

IPython Notebook here.

Comments Off

Filed under software engineering