{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Notebook Basics\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This lesson assumes that the user has Jupyter [installed](https://jupyter.readthedocs.io/en/latest/install.html) and that the notebook server can be started by running:\n",
"\n",
" jupyter notebook\n",
"\n",
"For more details on how to run the notebook server, see [Running the Notebook Server](Running%20the%20Notebook%20Server.ipynb)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## The Dashboard\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When the notebook server is first started, a browser will be opened to the notebook dashboard. The dashboard serves as a home page for the notebook. Its main purpose is to display the portion of the filesystem accessible by the user, and to provide an overview of the running kernels, terminals, and parallel clusters."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Files Tab\n",
"\n",
"The files tab provides an interactive view of the portion of the filesystem which is accessible by the user. This is typically rooted by the directory in which the notebook server was started.\n",
"\n",
"The top of the files list displays clickable breadcrumbs of the current directory. It is possible to navigate the filesystem by clicking on these breadcrumbs or on the directories displayed in the notebook list.\n",
"\n",
"A new notebook can be created by clicking on the **`New`** dropdown button at the top of the list, and selecting the desired language kernel.\n",
"\n",
"Notebooks can also be uploaded to the current directory by dragging a notebook file onto the list or by clicking the **`Upload`** button at the top of the list.\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Running Tab\n",
"\n",
"The running tab displays the currently running notebooks which are known to the server. This view provides a convenient way to track notebooks that have been started during a long running notebook server session.\n",
"\n",
"Each running notebook will have an orange **`Shutdown`** button which can be used to shutdown its associated kernel. Closing the notebook's page is not sufficient to shutdown a kernel.\n",
"\n",
"Running terminals are also listed, provided that the notebook server is running on an operating system which supports PTY.\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Clusters Tab\n",
"\n",
"The clusters tab provides a summary view of [IPython Parallel](https://ipyparallel.readthedocs.io/en/latest/) clusters. The IPython Parallel extension must be [installed](https://github.com/ipython/ipyparallel) in order to use this feature.\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## The Notebook\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When a notebook is opened, a new browser tab will be created which presents the notebook user interface (UI). This UI allows for interactively editing and running the notebook document.\n",
"\n",
"A new notebook can be created from the dashboard by clicking on the **`Files`** tab, followed by the **`New`** dropdown button, and then selecting the language of choice for the notebook.\n",
"\n",
"An interactive tour of the notebook UI can be started by selecting **`Help -> User Interface Tour`** from the notebook menu bar."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Header\n",
"\n",
"At the top of the notebook document is a header which contains the notebook title, a menubar, and toolbar. This header remains fixed at the top of the screen, even as the body of the notebook is scrolled. The title can be edited in-place (which renames the notebook file), and the menubar and toolbar contain a variety of actions which control notebook navigation and document structure.\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Body\n",
"\n",
"The body of a notebook is composed of cells. Each cell contains either markdown, code input, code output, or raw text. Cells can be included in any order and edited at-will, allowing for a large ammount of flexibility for constructing a narrative.\n",
"\n",
"- **Markdown cells** - These are used to build a nicely formatted narrative around the code in the document. The majority of this lesson is composed of markdown cells.\n",
"\n",
"- **Code cells** - These are used to define the computational code in the document. They come in two forms: the *input cell* where the user types the code to be executed, and the *output cell* which is the representation of the executed code. Depending on the code, this representation may be a simple scalar value, or something more complex like a plot or an interactive widget.\n",
"\n",
"- **Raw cells** - These are used when text needs to be included in raw form, without execution or transformation.\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Modality\n",
"\n",
"The notebook user interface is *modal*. This means that the keyboard behaves differently depending upon the current mode of the notebook. A notebook has two modes: **edit** and **command**.\n",
"\n",
"**Edit mode** is indicated by a green cell border and a prompt showing in the editor area. When a cell is in edit mode, you can type into the cell, like a normal text editor.\n",
"\n",
"\n",
"\n",
"**Command mode** is indicated by a grey cell border. When in command mode, the structure of the notebook can be modified as a whole, but the text in individual cells cannot be changed. Most importantly, the keyboard is mapped to a set of shortcuts for efficiently performing notebook and cell actions. For example, pressing **`c`** when in command mode, will copy the current cell; no modifier is needed.\n",
"\n",
"\n",
"\n",
"
\n",
"