Appendix

How to code within the Appendix pages?

For coding the pages below, you can click the rocket on the upper right: img then click Binder in the pop-up button and you will be directed to a browser-based environment on Binder in which you can expand and execute the code by your self.

Binder, like other interactive computing products and services f.ex. JupyterHub, JupyterLab or Jupyter Notebook and Jupyter{Book} (the tools we have used to write and code this research paper) is part of the Jupyter Project, a nonprofit organization created to “develop open-source software, open-standards, and services for interactive computing across different programming languages” (Python, R, Julia).

Binder is meant for interactive and ephemeral interactive coding.

After you have clicked on the Binder-button on the upper right, the virtual environment in which you can code will be loaded into your browser. This will take around 1 minute:

push-pop

After the environment is ready to use you can go into folder structure:

img

and click the page/notebook of your choice:

img

This will open an editable and executable Jupyter Notebook into your browser:

img

Editing Jupyter Notebooks

Parts of the following introduction are modified from Allison Parrish’s Python-Intro-Notebooks < thanx Allison!

An Jupyter Notebook consists of a number of “cells,” stacked on the page from top to bottom. Cells can have text or code in them. You can change a cell’s type using the “Cell” menu at the top of the page; go to Cell > Cell Type and select either Code for Python code or Markdown for text. (You can also change this for the current cell using the drop-down menu in the toolbar.)

Text cells

Make a new cell, change its type to Markdown, type some stuff and press Ctrl-Enter. Jupyter Notebook will “render” the text and display it on the page in rendered format. You can hit Enter or click in the cell to edit its contents again. Text in Markdown cells is rendered according to a set of conventions called Markdown. Markdown is a simple language for marking up text with basic text formatting information (such as bold, italics, hyperlinks, tables, etc.).

See also the Jupyter Notebook in the Experimental Informatics Github Repo: Markdown-basics.ipynb.

Code cells

You can also press Alt-Enter to render the current cell and create a new cell.

New cells will by default be Code cells, as follows:

print("This is a code cell.")
print("")
print("Any Python code you type in this cell will be run when you press the 'Run' button,")
print("or when you press Ctrl-Enter.")
print("")
print("If the code evaluates to something, or if it produces output, that output will be")
print("shown beneath the cell after you run it.")
This is a code cell.

Any Python code you type in this cell will be run when you press the 'Run' button,
or when you press Ctrl-Enter.

If the code evaluates to something, or if it produces output, that output will be
shown beneath the cell after you run it.
print("If your Python code generates an error, the error will be displayed in addition")
print("to any output already produced.")

1 / 0
If your Python code generates an error, the error will be displayed in addition
to any output already produced.
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-27-1ebad54fe81d> in <module>
      2 print("to any output already produced.")
      3 
----> 4 1 / 0

ZeroDivisionError: division by zero

Keyboard shortcuts

As mentioned above, Ctrl-Enter runs the current cell; Alt-Enter runs the current cell and then creates a new cell. Enter will start editing whichever cell is currently selected. To quit editing a cell, hit Esc. If the cursor isn’t currently active in any cell (i.e., after you’ve hit Esc), a number of other keyboard shortcuts are available to you:

  • m converts the selected cell to a Markdown cell

  • b inserts a new cell below the selected one

  • x “cuts” the selected cell; c “copies” the selected cell; v pastes a previously cut cell below the selected cell

  • h brings up a help screen with many more shortcuts.

Saving your expanded version

Please note that none of the changes you make in Binder will be saved. If you do make changes or notes, you will need to download the notebook to your own computer by clicking File > Download as > Notebook.ipynb.

If you run Jupyter Notebook locally, then just hit Cmd-S at any time to save your notebook. Jupyter Notebook also automatically saves occasionally. Make sure to give your notebook a descriptive title by clicking on “Untitled0” at the top of the page and replacing the text accordingly. Notebooks you save will be available on your server whenever you log in again, from wherever you log into the server.