{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Running these notebooks\n", "\n", "Notebooks for this course can be run by You!!\n", "\n", "In fact, if you are reading these notes on [readthedocs](https://mphy0026.readthedocs.io/en/latest/), then this page itself was generated from a Jupyer Notebook into a readthedocs page. \n", "\n", "On readthedocs, see the left menu bar \"Python Setup\" for an introduction on how to setup your Python environment.\n", "\n", "\n", "## NOTE:\n", "\n", "Getting jupyter to run your code in this package relies on 3 things:\n", "\n", "* You must ensure you start jupyter within the tox environment.\n", "\n", "For Linux/Mac:\n", "```\n", "# If not already done.\n", "source .tox/test/bin/activate\n", "\n", "# Then launch jupyter\n", "jupyter notebook\n", "```\n", "\n", "For Windows:\n", "```\n", "# If not already done.\n", ".tox\\test\\Scripts\\activate\n", "\n", "# Then launch jupyter\n", "jupyter notebook\n", "```\n", "\n", "* 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.\n", "\n", "* Additionally, inside the notebook code, add the project folder to the system path, as below." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Jupyter notebook sets the cwd to the folder containing the notebook.\n", "# So, you want to add the root of the project to the sys path, so modules load correctly.\n", "import sys\n", "sys.path.append(\"../../\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "mphy0026", "language": "python", "name": "mphy0026" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.16" } }, "nbformat": 4, "nbformat_minor": 4 }