Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 3.09 KB

analysis_sharing_workflow.md

File metadata and controls

54 lines (42 loc) · 3.09 KB

Seamless analysis, presentation and discussion with jupyter notebooks and hypothes.is

I am developing most of my code in jupyter notebooks. So far presenting results (especially at an intermediate stage) has been a total nightmare. Cluttered plot folders on local drives and in the cloud and endless email back and forth seemed like a terrible workflow.

I have decided to adopt a more modern way of presenting and discussing things using jupyter notebook as the central medium.

My examples can be found in a github repo

There are really only two issues to address:

  1. When using notebooks and git/nbviewer, often times the masses of code obstruct a neat documentation of results and thoughts in the comment cells. We need a sleek way of hiding the code (and bringing it back when needed).

  2. Both github and nbviewer render notebooks as a static html site, which is missing the critical ability to comment on results and enable collaboration, without having to fire up the full code each time.

I found a solution to 1) here. In order to make the solution for 2) work, the preloader in this source cannot be used at this moment. But the basic ‘code-hiding’ ability can be achieved by pasting this code into a raw cell at the beginning of a jupyter notebook:

<script>
  function code_toggle() {
    if (code_shown){
      $('div.input').hide('500');
      $('#toggleButton').val('Show Code')
    } else {
      $('div.input').show('500');
      $('#toggleButton').val('Hide Code')
    }
    code_shown = !code_shown
  }

  $( document ).ready(function(){
    code_shown=false;
    $('div.input').hide()
  });
</script>
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Show Code"></form>

<script>
  $(document).ready(function(){
    $('div.prompt').hide();
    $('div.back-to-top').hide();
    $('nav#menubar').hide();
    $('.breadcrumb').hide();
    $('.hidden-print').hide();
  });
</script>

This converts this sample notebook into a really slick presentation. Note this does not work on github, only using the nbviewer.

Now to have the ability to comment, I am using hypothes.is. I have posted a few dummy comments on the notebook, check them out here.

I am using the chrome browser extension at the moment. I am not sure if that is required. Supposedly they also allow private groups, so you dont have to discuss your research publicly. If you want to try it out, here is the invitation to a test group. Let me know what you think!