Introduction

A recent project of mine has created the need for a gear ratio calculation tool. I decided it’d be a good opportunity to demonstrate the use of Python in Jupyter for scientific notebooks and then sharing those notebooks for interaction with Binder.

Python

When I was doing undergraduate studies in mechanical engineering many of the courses had lab experiments or homework which required calculations, interpretation, and visualization of data. Instructors and students used Microsoft Excel for much of the work. I’ve never liked the spreadsheet paradigm. I find the inclusion of data, calculations, formatting, and visualization in the same interface to be distracting.
For more complex work professors advocated to use MATLAB. While this wasn’t difficult for academic use, I was worried about learning a tool that would be encumbered with licenses in a professional context.
I did some investigating and eventually started using SageMath for my lab calculations. After I graduated and started working professionally I moved to using Anaconda for setting up and managing a regular Python environment.

Jupyter Notebooks

While Python is a powerful language, I find sharing to be best done in notebooks. They allow the developer to concentrate on code, then encorporate documentation, formatting, and visualization without having one distract from the other. Regular version control tools like Git can be used. These advantages supercede a lot of the advantages of spreadsheets to me.

Binder

Once a notebook is in a git repository, Binder can be used to share notebooks in an interactive way. Binder works by starting a container with a defined environment. The specified repository is cloned into it and then a Jupyter interface is presented to the user.

Our example

My git repository contains datasets stored as JSON files. A Python 3 notebook loads all of the files and produces a Bokeh plot.

Conclusion

I hope this small tool demonstrates some of the advantages of using Jupyter and Bokeh for sharing technical tools.