Skip to content

Commit c0c57af

Browse files
committed
Updated for JuypterLab interface
1 parent 757c7c3 commit c0c57af

8 files changed

Lines changed: 39 additions & 42 deletions

File tree

-76.6 KB
Loading
13.8 KB
Loading
-62.2 KB
Loading
-65.5 KB
Loading
-213 KB
Loading

CH40208/notebooks_introduction/the_notebook_interface.md

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,26 @@ There are a few sections of the Notebook interface that will be useful to know y
66

77
![](images/notebook_interface.png)
88

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.
2922

3023
## Cells
3124

3225
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+
![](images/code_cell.png)
28+
3329
There are three types of input cells where you can add content to a notebook.
3430

3531
### Code cells
@@ -38,7 +34,7 @@ There are three types of input cells where you can add content to a notebook.
3834
A **code cell** can accept code, that can then be executed (run).
3935
When the code in a code cell is run, the notebook displays any output generated by that code directly below the corresponding cell.
4036

41-
![](images/code_cell.png)
37+
![](images/code_cell_run.png)
4238

4339
In the figure above, the code cell has the Python code `print(4+3)` entered.
4440
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
4945
When a **markdown cell** is run, the markdown is converted into HTML, with the formatted text then shown _in place_ of the cell.
5046
**Markdown cells** can be used to include formatted text, mathetmatical equations, images, tables, and more types of rich media.
5147

52-
![](https://github.com/pythoninchemistry/ch40208/raw/main/CH40208/notebooks_introduction/images/md_cell.png)
48+
![](images/md_cell.png)
5349
This figure shows a markdown cell being edited, with raw markdown entered.
5450

55-
![](https://github.com/pythoninchemistry/ch40208/raw/main/CH40208/notebooks_introduction/images/formatted_md.png)
51+
![](images/formatted_md.png)
5652
This figure shows the same cell after it has been run, with the markdown converted to formatted text.
5753

5854
### Raw cells
5955
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.
6056

6157
### Switching cell type.
62-
Cells can be switched between **code** and **markdown** using the **Cell** &rarr; **Cell Type** menu options:
63-
64-
![](https://github.com/pythoninchemistry/ch40208/raw/main/CH40208/notebooks_introduction/images/cell_switch.png)
58+
Cells can be switched between **code** and **markdown** using the `Code ▼` menubar option.
6559

6660
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**.
6761

@@ -73,26 +67,24 @@ A cell is marked as **active** if it is highlighted. The colour of the highlight
7367

7468
**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` &#8594; `Keyboard Shortcuts`.
7569

76-
![](https://github.com/pythoninchemistry/ch40208/raw/main/CH40208/notebooks_introduction/images/command_mode.png)
77-
7870
#### Edit mode
7971

8072
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.
8173

82-
![](https://github.com/pythoninchemistry/ch40208/raw/main/CH40208/notebooks_introduction/images/edit_mode.png)
83-
8474
Typing now inserts text into the currently active cell:
8575

86-
![](https://github.com/pythoninchemistry/ch40208/raw/main/CH40208/notebooks_introduction/images/edit_mode_filled.png)
87-
8876
To get out of **Edit Mode**, and back into **Command Mode**, press `Esc` or click outside the text entry area.
8977

9078
## Running cells
91-
Each cell can consist of more than one line of input, which is not processed until the cell is executed, or &ldquo;run&rdquo;.
92-
You can run the currently active cell from the menu bar by clicking **Cell** &rarr; **Run Cells**, or by clicking on the &lqduo;play&&rdquo;; 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** &rarr; **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.

CH40208/notebooks_introduction/using_noteable.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ If this is the first time you have logged on to Noteable, you will see the follo
2323
:width: 700px
2424
:align: center
2525
```
26+
<br/>
27+
2628
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.
2729

2830
## Creating a new Jupyter notebook
@@ -33,8 +35,9 @@ To create a new Jupyter notebook, click on the `Python 3 (ipykernel)` button in
3335
:width: 300px
3436
:align: center
3537
```
36-
38+
<br/>
3739
This will open a new Jupyter Notebook document in a new browser window, which should look like this:
40+
<br/>
3841

3942
```{image} images/new_notebook_example.png
4043
:width: 600px
@@ -43,14 +46,15 @@ This will open a new Jupyter Notebook document in a new browser window, which sh
4346

4447
## Renaming notebooks
4548

46-
We will look at using Jupyter Notebooks in more detail later. For now, notice at the top you have the text &ldquo;Untitled&rdquo;. 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.
4750

4851
**Do not delete the `.ipynb` extension when renaming your notebook - Noteable will break if you do!**
4952

5053
```{image} images/rename_notebook_dialogue.png
5154
:width: 500px
5255
:align: center
5356
```
57+
<br/>
5458

5559
Rename your notebook to something more meaningful (e.g., &ldquo;Lab 0.ipynb&rdquo;) by typing the new name and hitting Enter.
5660

@@ -67,6 +71,7 @@ This can be done using the square stop button, located on the notebook toolbar.
6771
:width: 400px
6872
:align: center
6973
```
74+
<br/>
7075

7176

7277
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.
24.2 KB
Loading

0 commit comments

Comments
 (0)