You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CH40208/notebooks_introduction/the_notebook_interface.md
+32-40Lines changed: 32 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,30 +6,26 @@ There are a few sections of the Notebook interface that will be useful to know y
6
6
7
7

8
8
9
-
1. The jupyterhub logo. Clicking on this takes you back to your **Notebook Dashboard**.
10
-
2. The name of your Notebook. Please do not leave this as `Untitled.ipynb`. You will thank me later.
11
-
3. Information about when this Notebook was last saved. (or, in Jupyter parlance, when a **checkpoint** was last created.).
12
-
You can force your Notebook to save using:
13
-
- ⌘S (Mac) / alt+S (Windows)
14
-
- Select `File` -> `Save and Checkpoint`.
15
-
4. The **Notebook Menubar**. This contains:
16
-
-`File`: File operations, e.g. create a new Notebook, open an existing Notebook, Copy your current Notebook, Save, etc.
17
-
-`Edit`: Manipulating **cells**
18
-
-`View`: Options for what appears on your screen, and for toggling various aspects on and off.
19
-
-`Cell`: Executing one of more **cells**, and manipulating the output of **cells**.
20
-
-`Kernel`: Stop, start, etc. the **kernel**.
21
-
-`Widgets`: Managing plugins and extensions that you might have installed.
22
-
-`Help`: Access to the built-in help.
23
-
- Particularly useful items here are `Help`→`User Interface Tour` and `Help`→`Notebook Help`.
24
-
5. The **Notebook Toolbar**
25
-
This contains buttons for the most common actions for working with Notebooks. Hovering you mouse over each button will show you a popup with some information about the associated action.
26
-
6. The currently selected cell.
27
-
7. Indicates whether a cell has run or not, and for cells that have been run, the order they ran in.
28
-
8. The text area for the **code cell**. This is where you can type in Pyton code to then run.
9
+
**The notebook tab**: This shows your notebook filename (e.g., `Untitled1.ipynb`). You can have multiple notebooks open in different tabs. You can rename your notebook by right-clicking on the tab and selecting `Rename Notebook…`. When you create a new notebook, it will be called `Untitled<N>.ipynb`. It is good practice to rename your notebooks when you create them so that you can more easily find them again later.
10
+
11
+
**The notebook toolbar**: Contains the most commonly used actions:
12
+
- 💾 Save notebook
13
+
-\+ Add a new cell below
14
+
- ✂️ Cut selected cells
15
+
- 📋 Copy and paste cells
16
+
- ▶️ Run the current cell
17
+
- ⏹️ Interrupt the kernel
18
+
- 🔄 Restart the kernel
19
+
-`Code ▼` Cell type selector (change between Code, Markdown, and Raw)
20
+
21
+
**The cell**: Below the toolbar is a "cell". This is where you type your Python code. A notebook can have multiple cells, which allows you to organise your code into components.
29
22
30
23
## Cells
31
24
32
25
The body of the notebook is made up of **input cells**. When you open a new notebook it will contain only one empty cell; this is the grey box with `In [ ]:` to the left.
26
+
27
+

28
+
33
29
There are three types of input cells where you can add content to a notebook.
34
30
35
31
### Code cells
@@ -38,7 +34,7 @@ There are three types of input cells where you can add content to a notebook.
38
34
A **code cell** can accept code, that can then be executed (run).
39
35
When the code in a code cell is run, the notebook displays any output generated by that code directly below the corresponding cell.
40
36
41
-

37
+

42
38
43
39
In the figure above, the code cell has the Python code `print(4+3)` entered.
44
40
This cell has then been run, which executes (runs) the code in the cell: in this instance we add 4 and 3, and print the result.
@@ -49,19 +45,17 @@ A **markdown cell** contains text formatted using [Markdown](https://www.markdow
49
45
When a **markdown cell** is run, the markdown is converted into HTML, with the formatted text then shown _in place_ of the cell.
50
46
**Markdown cells** can be used to include formatted text, mathetmatical equations, images, tables, and more types of rich media.
This figure shows the same cell after it has been run, with the markdown converted to formatted text.
57
53
58
54
### Raw cells
59
55
Input entered into **Raw cells** is not converted when the cell is run. These cells are usually used to provide additional information for converting Jupyter Notebooks to a different format (e.g., a PDF document). You almost certainly will not need to use **Raw cells** during this course, but might be curious about this third cell type.
60
56
61
57
### Switching cell type.
62
-
Cells can be switched between **code** and **markdown** using the **Cell**→**Cell Type** menu options:
Cells can be switched between **code** and **markdown** using the `Code ▼` menubar option.
65
59
66
60
You can also switch between cell types in **commmand mode** (see below) using the keyboard shortcuts `Y` for **code**, `M` for **markdown**, and `R` for **raw**.
67
61
@@ -73,26 +67,24 @@ A cell is marked as **active** if it is highlighted. The colour of the highlight
73
67
74
68
**Command mode** is indicated by a blue highlight. When you are in command mode you can use **keyboard shortcuts** to cut, paste, and move cells, etc. You can see all the **keyboard shortcuts** under `Help`→`Keyboard Shortcuts`.
If you are in **command mode** then pressing `Enter` or clicking in the input text area of a cell will switch you to **edit mode**. **Edit mode** is indicated by a green highlight, and a pencil icon in the top right of the Notebook window.
To get out of **Edit Mode**, and back into **Command Mode**, press `Esc` or click outside the text entry area.
89
77
90
78
## Running cells
91
-
Each cell can consist of more than one line of input, which is not processed until the cell is executed, or “run”.
92
-
You can run the currently active cell from the menu bar by clicking **Cell**→**Run Cells**, or by clicking on the &lqduo;play&”; icon button in the menu bar.
93
-
You can also run the currently selected cell using keyboard shortcuts:
94
-
-**ctrl** + **enter**: Run the currently selected cell and keep this cell active.
95
-
-**shift** + **enter**: Run the currently selected cell and move the focus to the next cell below. If there is not a cell below, a new empty cell will be created.
96
-
-**alt** + **enter** or **option** + **enter**: Run the currently selected cell and create a new empty cell immediately below.
97
-
98
-
You can also run every cell in a notebook, from top to bottom, by selecting **Kernel**→**Restart & Run All** from the menu bar. This **halts** your Jupyter notebook and restarts it, before running each cell in sequence from the top down.
79
+
Each cell can consist of more than one line of input, which is not processed until the cell is executed, or "run".
80
+
81
+
You can run cells using:
82
+
- The ▶️ button in the toolbar
83
+
-**Keyboard shortcuts:**
84
+
-**Shift + Enter**: Run cell and move to next cell
85
+
-**Ctrl + Enter**: Run cell and stay on same cell
86
+
-**Alt + Enter**: Run cell and insert a new cell below
87
+
88
+
You can run all cells in a notebook using the ⏩ (Run All) button in the toolbar, or by right-clicking on a cell and selecting "Run All Above" or "Run All Below".
89
+
90
+
To restart the kernel and run all cells from scratch, use the 🔄 button in the toolbar followed by the ⏩ button, or right-click on any cell and select "Restart Kernel and Run All Cells...". This halts your Jupyter notebook, clears all stored variables, and runs each cell in sequence from top to bottom.
Copy file name to clipboardExpand all lines: CH40208/notebooks_introduction/using_noteable.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ If this is the first time you have logged on to Noteable, you will see the follo
23
23
:width: 700px
24
24
:align: center
25
25
```
26
+
<br/>
27
+
26
28
On the left is the Jupyter **File Browser**, which shows all of your files and folders/directories saved in Noteable. On the right is the **Launcher**, which contains buttons for quickly creating notebooks and shells.
27
29
28
30
## Creating a new Jupyter notebook
@@ -33,8 +35,9 @@ To create a new Jupyter notebook, click on the `Python 3 (ipykernel)` button in
33
35
:width: 300px
34
36
:align: center
35
37
```
36
-
38
+
<br/>
37
39
This will open a new Jupyter Notebook document in a new browser window, which should look like this:
40
+
<br/>
38
41
39
42
```{image} images/new_notebook_example.png
40
43
:width: 600px
@@ -43,14 +46,15 @@ This will open a new Jupyter Notebook document in a new browser window, which sh
43
46
44
47
## Renaming notebooks
45
48
46
-
We will look at using Jupyter Notebooks in more detail later. For now, notice at the top you have the text “Untitled”. This is a placeholder filename that has been assigned to this new Notebook you have just created. To rename your notebook, right click on `Untitled.ipynb` in the **File Browser** and click rename.
49
+
We will look at using Jupyter Notebooks in more detail later. For now, notice at the top you have the text "Untitled". This is a placeholder filename that has been assigned to this new Notebook you have just created. To rename your notebook, right click on `Untitled.ipynb` in the **File Browser** and click rename.
47
50
48
51
**Do not delete the `.ipynb` extension when renaming your notebook - Noteable will break if you do!**
49
52
50
53
```{image} images/rename_notebook_dialogue.png
51
54
:width: 500px
52
55
:align: center
53
56
```
57
+
<br/>
54
58
55
59
Rename your notebook to something more meaningful (e.g., “Lab 0.ipynb”) by typing the new name and hitting Enter.
56
60
@@ -67,6 +71,7 @@ This can be done using the square stop button, located on the notebook toolbar.
67
71
:width: 400px
68
72
:align: center
69
73
```
74
+
<br/>
70
75
71
76
72
77
If that doesn't work, then you can restart the Kernel (think of this as a reboot of the system) by clicking the `Kernel` tab of the Notebook menu followed by the `Restart Kernel` option.
0 commit comments