Running these notebooks

Notebooks for this course can be run by You!!

In fact, if you are reading these notes on readthedocs, then this page itself was generated from a Jupyer Notebook into a readthedocs page. To work with the Jupyter Notebooks in this course, then you should first download the actual code from the git repo.

On readthedocs, see the left menu bar “Python Setup” for an introduction on how to setup your Python environment. Specifically, you must chose Option 2, which sets things up inside a virtual env created by the tox command.

NOTE:

Getting jupyter to run your code in this package relies on 3 things:

  • You must ensure you start jupyter within the tox environment.

For Linux/Mac:

# If not already done.
source .tox/py37/bin/activate

# Then launch jupyter
jupyter notebook

For Windows:

# If not already done.
source .tox/py37/bin/activate

# Then launch jupyter
jupyter notebook
  • Then, within your web browser, navigate to and run the chosen MPHY0026 course notebook. Select the right kernel (named MPHY0026) from the kernel menu item.

  • Additionally add project folder to system path, as below.

[1]:
# Jupyter notebook sets the cwd to the folder containing the notebook.
# So, you want to add the root of the project to the sys path, so modules load correctly.
import sys
sys.path.append("../../")