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.

On readthedocs, see the left menu bar “Python Setup” for an introduction on how to setup your Python environment.

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/test/bin/activate

# Then launch jupyter
jupyter notebook

For Windows:

# If not already done.
.tox\test\Scripts\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, inside the notebook code, add the project folder to the 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("../../")
[ ]: