Skip to content

Commit

Permalink
Switch from jupyternotebook to jupyterlab
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisThielemans committed Jan 20, 2023
1 parent 94714cd commit a42ca6b
Show file tree
Hide file tree
Showing 37 changed files with 53 additions and 44 deletions.
8 changes: 3 additions & 5 deletions DocForInstructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is a basic list of things to do and tell people during the course.
update_VM.sh # if required
cd ~/devel/SIRF-Exercises/
scripts/download_data.sh -m -p
jupyter notebook
jupyter lab
```
Then open a web-browser on your local laptop and point it to http://localhost:8888 (fill in the password or the token).

Expand All @@ -24,15 +24,13 @@ Then open a web-browser on your local laptop and point it to http://localhost:99

## Basic jupyter notebook manipulations
1. Open notebook and tell them about execution and keyboard shortcuts (via menu).
2. Warn that closing the tab leaves a python session running. This can be surprising (for instance with read/write access).
Show how to close the session (either `File->Close and halt` or go "home" and click on the `Running` tab.
3. Show how to create a terminal ("home", `New` on the right, `Terminal`). Use this to start the Gadgetron. Say this is not necessary on Docker as already started.
3. Show how to create a terminal ("Launcher" (or first "+"), `Terminal`). Use this to start the Gadgetron. Say this is not necessary on Docker as already started.
```bash
gadgetron&
```
4. Warn that you cannot have 2 Python sessions simultaneously accessing
the same MR HDF5 file.
The only work-around is to use “File->Close and halt” after you’ve finished with a notebook (or just “Kernel->Shutdown”).
The only work-around is to use “kernel -> "Shutdown kernel" in one notebook, or close it).

5. Warn that pressing `Logout` will mean all sessions are closed and you will have to start again. Warn that pressing
`Quit` means the server will quit and they will be in trouble. (On Azure, the server should restart after a few seconds,
Expand Down
12 changes: 9 additions & 3 deletions DocForParticipants.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ The next sections contain instructions to start the Jupyter notebook server with

## Start a jupyter notebook server for the SIRF exercises

***Warning:** these instructions are when using JupyterLab as opposed to the "classic" notebook
interface. If you choose to use the classic interface, you will have to modify the notebooks
marginally by replacing `%matplotlib widget` with `%matplotlib notebook`.
See also the [iPython section](#ipython) below.


### Using an Azure client (if available)

The web-address should be something like https://sirf1....cloudapp.azure.com:9999/. See local instructions of your training sessoin.
Expand All @@ -75,15 +81,15 @@ Follow instructions given elsewhere.
```bash
# optionally update to the latest release of SIRF and the SIRF-Exercises
update_VM.sh
jupyter notebook
jupyter lab
```

Then open a web-browser on your computer (i.e. the host) and point it to http://localhost:8888 (fill in the password or the token).

If this fails, you could try to use web browser in the VM instead.
```bash
sudo apt install firefox
jupyter notebook --browser firefox
jupyter lab --browser firefox
```

### Using Docker
Expand All @@ -98,7 +104,7 @@ Please note that for at present (at least up to SIRF 3.4), you need to point you
You have a jupyter server (as you followed the [installation instructions](INSTALL.md)) so just use
```bash
cd /wherever/you/installed/it/SIRF-Exercises
jupyter notebook
jupyter lab
```

## Starting a terminal via Jupyter
Expand Down
3 changes: 2 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ sure that you use a Python version which is compatible with how you compiled SIR

Of course, if you've used (Ana)conda to install Python etc (and are sure
SIRF was compiled with that Python version), you can use conda to install
dependencies as well. Or you could still choose to use conda's `pip` after
dependencies as well (except the brainweb module, at the time of writing).
Or you could still choose to use conda's `pip` after

conda install pip

Expand Down
2 changes: 1 addition & 1 deletion notebooks/Geometry/c_fully3dgeom.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook"
"%matplotlib widget"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Geometry/d_manipulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook"
"%matplotlib widget"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Introductory/acquisition_model_mr_pet_ct.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"outputs": [],
"source": [
"# Make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"import notebook_setup\n",
"from sirf_exercises import cd_to_working_dir\n",
"cd_to_working_dir('Introductory', 'acquisition_model_mr_pet_ct')"
Expand Down
5 changes: 3 additions & 2 deletions notebooks/Introductory/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"outputs": [],
"source": [
"# Make sure figures appears inline and animations works\n",
"%matplotlib notebook"
"# Edit this to \"\"%matplotlib notebook\" when using the \"classic\" jupyter notebook interface\n",
"%matplotlib widget"
]
},
{
Expand Down Expand Up @@ -803,5 +804,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"# import engine module\n",
"from sirf.Gadgetron import *\n",
"\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# process command-line options\n",
"data_file = 'simulated_MR_2D_cartesian.h5' \n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/Old_notebooks/fully_sampled_recon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"\n",
"# import engine module\n",
"#exec('from p' + args['--engine'] + ' import *')\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"from sirf.Gadgetron import *\n",
"\n",
"# Simulated Data\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/Old_notebooks/grappa_basic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"#__version__ = '0.1.0'\n",
"from docopt import docopt\n",
"#args = docopt(__doc__, version=__version__)\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"# import engine module\n",
"#exec('from p' + args['--engine'] + ' import *')\n",
"from sirf.Gadgetron import *\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/a_fully_sampled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/b_kspace_filter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/c_coil_combination.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/d_undersampled_reconstructions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/e_advanced_recon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/f_create_undersampled_kspace.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook"
"%matplotlib widget"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/tools/acqh5info.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"slc = acq_cont.get_ISMRMRD_info('slice')\n",
"rep = acq_cont.get_ISMRMRD_info('repetition')\n",
"\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"plt.plot(ec1, label='enc 1')\n",
"plt.plot(ec2, label='enc 2')\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MR/tools/im5info.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"# Set output based on shape returned above\n",
"img = dset[2,0,0,:,:]\n",
"\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"plt.imshow(img, cmap='gray')\n",
"plt.colorbar()\n"
Expand Down
2 changes: 1 addition & 1 deletion notebooks/PET/DIY_OSEM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/PET/MAPEM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/PET/ML_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/PET/OSEM_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
4 changes: 2 additions & 2 deletions notebooks/PET/display_and_projection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook"
"%matplotlib widget"
]
},
{
Expand Down Expand Up @@ -285,7 +285,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that when using the `%matplotlib notebook` or `inline` back-ends, the `title` is currently not shown when using `show`. Apologies"
"Note that when using the `%matplotlib widget` or `inline` back-ends, the `title` is currently not shown when using `show`. Apologies"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/PET/image_creation_and_simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/PET/reconstruct_measured_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Reg/sirf_registration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/BrainWeb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/HKEM_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"outputs": [],
"source": [
"#%% make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/MAPEM_Bowsher.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"# plotting settings\n",
"plt.ion() # interactive 'on' such that plots appear during loops\n",
"\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"#%% some handy function definitions\n",
"def imshow(image, limits=None, title=''):\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"# plotting settings\n",
"plt.ion() # interactive 'on' such that plots appear during loops\n",
"\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"#%% some handy function definitions\n",
"def imshow(image, limits=None, title=''):\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/cil_joint_tv_PET.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"outputs": [],
"source": [
"# Make sure figures appears inline\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"%matplotlib inline"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/cil_joint_tv_PET_SPECT.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"outputs": [],
"source": [
"# Make sure figures appears inline\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"%matplotlib inline"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/cil_joint_tv_mr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"outputs": [],
"source": [
"# Make sure figures appears inline and animations works\n",
"%matplotlib notebook"
"%matplotlib widget"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/Synergistic/gradient_descent_mr_pet_ct.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"outputs": [],
"source": [
"# Make sure figures appears inline and animations works\n",
"%matplotlib notebook\n",
"%matplotlib widget\n",
"\n",
"# Setup the working directory for the notebook\n",
"import notebook_setup\n",
Expand Down
Loading

0 comments on commit a42ca6b

Please sign in to comment.