Skip to content

Commit

Permalink
Update notebook setup for jupyter and jupytext (#32)
Browse files Browse the repository at this point in the history
* Update notebook setup for jupyter and jupytext

* fix paths

* Apply suggestions from code review by willingc

Co-authored-by: Carol Willing <[email protected]>

* Apply suggestions from code review by Melissa

Co-authored-by: Melissa Weber Mendonça <[email protected]>

---------

Co-authored-by: Carol Willing <[email protected]>
Co-authored-by: Melissa Weber Mendonça <[email protected]>
  • Loading branch information
3 people authored Oct 16, 2024
1 parent 6993502 commit 9860015
Showing 1 changed file with 49 additions and 34 deletions.
83 changes: 49 additions & 34 deletions napari-workshops/notebook_setup.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Downloading and launching this workshop's Jupyter notebooks

During this tutorial, we will be working through a set of Jupyter notebooks. On
this page, we will download the notebooks and launch the `jupyter notebook`
application.
The complete, executed notebooks are hosted in the materials on this website. We encourage you
to follow along with the workshop in a fresh, blank notebook. However, if you
would like to be able to run the completed notebooks locally, you can download them
and launch the `jupyter lab` application using the instructions below.

## Downloading the notebooks

There are two ways to download the notebooks; follow the instructions below for
either downloading a .zip file (recommended for beginners) or cloning via git.

### Downloading .zip
### Downloading a .zip file
To download the notebooks as a .zip file, do the following:

1. Navigate your web browser to the workshop's github repository (for this
template, this is https://github.com/napari/napari-workshop-template)
2. Click the green "Code" button to open the download menu and then
1. Click the GitHub logo at the top of this page or navigate your web browser to the workshop's GitHub repository (for this
template, this is [https://github.com/napari/napari-workshop-template](https://github.com/napari/napari-workshop-template))
2. Click the green (or blue) "Code" button to open the download menu and then
"Download ZIP" ![download code](./resources/download_code.png)
3. Choose the location you would like to download the .zip into.
4. Open your file browser and double click on the .zip file to uncompress it.
Expand All @@ -38,44 +39,58 @@ this tutorial.
git clone https://github.com/napari/napari-workshop-template.git
```

## Launch the `jupyter notebook` application
## Install the additional `jupytext` dependency

Open your terminal and navigate to the `notebooks` subdirectory of the
`napari-workshop-template` directory you just downloaded.
Because the notebooks were converted to MyST Markdown files (with a .md extension),
to better visualize on GitHub and provide a nice rendered look on the web,
you need to install one additional dependency to run them locally.

````{important}
Remember to activate the right environment!
```bash
conda activate napari-workshop
```
````

```bash
conda install jupytext jupyterlab-myst
```


## Launch the `jupyter lab` application

Navigate to the `notebooks` subdirectory of the
`napari-workshop-template` directory you just cloned or downloaded.

```
cd <path to napari-workshop-template>/notebooks
```

Now activate the `napari-tutorial` conda environment you created in the
installation step.
Remember to activate the `napari-workshop` conda environment if you haven't already.

```bash
conda activate napari-workshop
```
conda activate napari-tutorial

To start the Jupyter application, enter:

```bash
jupyter lab
```

To start the Jupyter Notebook application, enter
The Jupyter interface will open in a browser window and you will see the notebooks
in the file browser on the left.

````{important}
To open these workshop notebooks in the Jupyter interface, right click the notebook name in the file navigation panel from the Jupyter interface, and click "Open with -> Notebook".
![Right click on "intro_bioimage_visualization.md" file, and select "Open with -> Notebook"](./resources/open_with_notebook.png)
Or, as an alternative you can first convert them to `.ipynb` files using:
```bash
jupyter notebook
jupytext --to ipynb <notebook_file>.md
```
Jupyter Notebook will open in a browser window and you will see the following
notebooks:

- `part_0_viewer_intro.ipynb`: in this activity, you will gain familiarity with
loading and viewing images in napari.
- `part_1_segmenting_and_measuring_nuclei.ipynb`: in this notebook, you will use
cellpose to segment nuclei and scikit-image to measure them.
- `part_2_spot_detection_tutorial_beginner.ipynb`: this is the spot detection
notebook for people new to image processing with Python
- `part_2_spot_detection_tutorial_advanced.ipynb`: this is the spot detection
notebook for people with experience performing image processing with Python
- `part_2_spot_detection_tutorial_solution.ipynb`: this is the solution to the
spot detection activity.

All of the "part 2" notebooks cover the same activities, with different levels
of engagement required to reach the solution. For your convenience, we have
rendered the solutions to these notebooks in the following pages.

![jupyter notebook](./resources/jupyter_notebook.png)
````

0 comments on commit 9860015

Please sign in to comment.