Skip to content
Snippets Groups Projects
Commit b7ea5f9b authored by Christian Rohlfing's avatar Christian Rohlfing
Browse files

- adapted all URLS etc. to the new repository residence

parent cae1512b
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,9 @@ build-binder: ...@@ -38,9 +38,9 @@ build-binder:
- ls - ls
- apk update && apk add curl - apk update && apk add curl
- chmod +x binder/trigger-binder.sh - chmod +x binder/trigger-binder.sh
- binder/trigger-binder.sh https://mybinder.org/build/git/https%3A%2F%2Fgit.rwth-aachen.de%2FIENT%2Fjupyter-quickstart/master - binder/trigger-binder.sh https://mybinder.org/build/git/https%3A%2F%2Fgit-ce.rwth-aachen.de%2Fjupyter%2Fexample-profile/master
- binder/trigger-binder.sh https://gke.mybinder.org/build/git/https%3A%2F%2Fgit.rwth-aachen.de%2FIENT%2Fjupyter-quickstart/master - binder/trigger-binder.sh https://gke.mybinder.org/build/git/https%3A%2F%2Fgit-ce.rwth-aachen.de%2Fjupyter%2Fexample-profile/master
- binder/trigger-binder.sh https://ovh.mybinder.org/build/git/https%3A%2F%2Fgit.rwth-aachen.de%2FIENT%2Fjupyter-quickstart/master - binder/trigger-binder.sh https://ovh.mybinder.org/build/git/https%3A%2F%2Fgit-ce.rwth-aachen.de%2Fjupyter%2Fexample-profile/master
- ls - ls
only: only:
- master - master
......
...@@ -5,7 +5,7 @@ FROM ${BASE_IMAGE} ...@@ -5,7 +5,7 @@ FROM ${BASE_IMAGE}
# Update conda base environment to match specifications in environment.yml # Update conda base environment to match specifications in environment.yml
ADD environment.yml /tmp/environment.yml ADD environment.yml /tmp/environment.yml
USER root USER root
RUN sed -i "s|name\: jupyter-quickstart|name\: base|g" /tmp/environment.yml # we need to replace the name of the environment with base such that we can update the base environment here RUN sed -i "s|name\: jupyter-example-profile|name\: base|g" /tmp/environment.yml # we need to replace the name of the environment with base such that we can update the base environment here
USER $NB_USER USER $NB_USER
RUN conda env update -f /tmp/environment.yml # All packages specified in environment.yml are installed in the base environment RUN conda env update -f /tmp/environment.yml # All packages specified in environment.yml are installed in the base environment
......
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
![RWTH Logo](https://www.rwth-aachen.de/global/show_picture.asp?id=aaaaaaaaaaagazb) ![RWTH Logo](https://www.rwth-aachen.de/global/show_picture.asp?id=aaaaaaaaaaagazb)
# Jupyter Quickstart # Jupyter Example Profile Quickstart
Welcome to JupyterLab! Welcome to JupyterLab!
* Execute a single cell: <span class="fa-play fa"></span> * Execute a single cell: <span class="fa-play fa"></span>
* Execute all cells: Menu: Run <span class="fa-chevron-right fa"></span> Run All Cells * Execute all cells: Menu: Run <span class="fa-chevron-right fa"></span> Run All Cells
* To reboot kernel: <span class="fa-refresh fa"></span> * To reboot kernel: <span class="fa-refresh fa"></span>
Find more in the reference (menu: Help <span class="fa-chevron-right fa"></span> Jupyter Reference). Find more in the reference (menu: Help <span class="fa-chevron-right fa"></span> Jupyter Reference).
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Markdown ## Markdown
You can specify the cell type which is either _Code_ or _Markdown_. You can specify the cell type which is either _Code_ or _Markdown_.
### Lists ### Lists
* Like * Like
* this * this
1. We can even nest them like 1. We can even nest them like
2. this! 2. this!
* Isn't that wonderfull? * Isn't that wonderfull?
### Images ### Images
![Newtons cradle](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Newtons_cradle_animation_book_2.gif/200px-Newtons_cradle_animation_book_2.gif) ![Newtons cradle](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Newtons_cradle_animation_book_2.gif/200px-Newtons_cradle_animation_book_2.gif)
### LaTeX equations ### LaTeX equations
$$\mathrm{e}^{\mathrm{j} x} = \cos(x)+\mathrm{j}\sin(x)$$ $$\mathrm{e}^{\mathrm{j} x} = \cos(x)+\mathrm{j}\sin(x)$$
### Code ### Code
``` python ``` python
print("Hello world!") print("Hello world!")
``` ```
### Further reading ### Further reading
Read more in the reference (menu: Help <span class="fa-chevron-right fa"></span> Markdown Reference). Read more in the reference (menu: Help <span class="fa-chevron-right fa"></span> Markdown Reference).
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Python ## Python
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
print("Hello world!") print("Hello world!")
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## numpy ## numpy
Execute the cell below to see the contents of variable `a` Execute the cell below to see the contents of variable `a`
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import numpy as np import numpy as np
a = np.array([0, 1, -5]) a = np.array([0, 1, -5])
a a
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Plots with matplotlib ## Plots with matplotlib
Nice matplotlib [tutorial](https://matplotlib.org/tutorials/introductory/usage.html#sphx-glr-tutorials-introductory-usage-py) Nice matplotlib [tutorial](https://matplotlib.org/tutorials/introductory/usage.html#sphx-glr-tutorials-introductory-usage-py)
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
%matplotlib widget %matplotlib widget
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from rwth_colors_matplotlib import * from rwth_colors_matplotlib import *
fs = 44100; fs = 44100;
(t, deltat) = np.linspace(-10, 10, 20*fs, retstep=True) # t axis in seconds (t, deltat) = np.linspace(-10, 10, 20*fs, retstep=True) # t axis in seconds
fig,ax = plt.subplots(); ax.grid(); fig,ax = plt.subplots(); ax.grid();
ax.plot(t, np.sin(2*np.pi*t), 'rwth:blue') ax.plot(t, np.sin(2*np.pi*t), 'rwth:blue')
ax.set_xlabel(r'$t$'); ax.set_ylabel(r'$s(t) = \sin(2 \pi t)$'); ax.set_xlabel(r'$t$'); ax.set_ylabel(r'$s(t) = \sin(2 \pi t)$');
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from scipy import misc from scipy import misc
f = misc.face() f = misc.face()
fig,ax = plt.subplots(); fig,ax = plt.subplots();
ax.imshow(f); ax.imshow(f);
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Interactive Widgets ## Interactive Widgets
Jupyter Widgets. You can find a detailled widget list [here](https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html). Jupyter Widgets. You can find a detailled widget list [here](https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html).
This requires to install [Jupyter Matplotlib](https://github.com/matplotlib/jupyter-matplotlib) which is called with the `%matplotlib widget` magic. This requires to install [Jupyter Matplotlib](https://github.com/matplotlib/jupyter-matplotlib) which is called with the `%matplotlib widget` magic.
Uses Python [decorators](https://docs.python.org/3/glossary.html#term-decorator). Uses Python [decorators](https://docs.python.org/3/glossary.html#term-decorator).
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import ipywidgets as widgets import ipywidgets as widgets
# Create figure # Create figure
fig0, ax0 = plt.subplots(); fig0, ax0 = plt.subplots();
# Create update function and decorate them with widgets # Create update function and decorate them with widgets
@widgets.interact(F = widgets.FloatSlider(min=0.1, max=10, step=0.1, value=0, description='$F$:')) @widgets.interact(F = widgets.FloatSlider(min=0.1, max=10, step=0.1, value=0, description='$F$:'))
def update_plot(F): def update_plot(F):
# Generate signal with given F # Generate signal with given F
s = np.sin(2*np.pi*F*t) s = np.sin(2*np.pi*F*t)
# Plot # Plot
if not ax0.lines: # decorate axes with labels etc. (which is only needed once) if not ax0.lines: # decorate axes with labels etc. (which is only needed once)
ax0.plot(t, s, 'rwth:blue'); ax0.plot(t, s, 'rwth:blue');
ax0.set_xlabel(r'$t$'); ax.set_ylabel(r'$s(t)=\sin(2 \pi F t)$') ax0.set_xlabel(r'$t$'); ax.set_ylabel(r'$s(t)=\sin(2 \pi F t)$')
else: # update only lines and leave everything else as is (gives huge speed-up) else: # update only lines and leave everything else as is (gives huge speed-up)
ax0.lines[0].set_ydata(s) ax0.lines[0].set_ydata(s)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Audio ## Audio
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from IPython.display import Audio, Latex from IPython.display import Audio, Latex
def audio_play(s, fs, txt="", autoplay=False): def audio_play(s, fs, txt="", autoplay=False):
if txt: display(Latex(txt)) if txt: display(Latex(txt))
display(Audio(s, rate=fs, autoplay=autoplay)) display(Audio(s, rate=fs, autoplay=autoplay))
# Create sin # Create sin
s = np.sin(2*np.pi*440*t) s = np.sin(2*np.pi*440*t)
# Play back # Play back
audio_play(s, fs, r'$s(t)$') audio_play(s, fs, r'$s(t)$')
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## RWTH Colors ## RWTH Colors
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from rwth_colors_matplotlib import * from rwth_colors_matplotlib import *
# adapted from https://matplotlib.org/2.0.0/examples/color/named_colors.html # adapted from https://matplotlib.org/2.0.0/examples/color/named_colors.html
colors = rwth_colors; colors = rwth_colors;
ncols = 5; nrows = len(colors.keys()) // ncols + 1; ncols = 5; nrows = len(colors.keys()) // ncols + 1;
fig, ax = plt.subplots() fig, ax = plt.subplots()
X, Y = fig.get_dpi() * fig.get_size_inches() # Get height and width X, Y = fig.get_dpi() * fig.get_size_inches() # Get height and width
w = X / ncols; h = Y / (nrows + 1) w = X / ncols; h = Y / (nrows + 1)
for i, name in enumerate(colors.keys()): for i, name in enumerate(colors.keys()):
col = i % ncols col = i % ncols
row = i // ncols row = i // ncols
y = Y - (row * h) - h y = Y - (row * h) - h
xi_line = w * (col + 0.05); xf_line = w * (col + 0.25); xi_text = w * (col + 0.3) xi_line = w * (col + 0.05); xf_line = w * (col + 0.25); xi_text = w * (col + 0.3)
ax.text(xi_text, y, name, fontsize=10, horizontalalignment='left', verticalalignment='center') ax.text(xi_text, y, name, fontsize=10, horizontalalignment='left', verticalalignment='center')
ax.hlines(y + h * 0.1, xi_line, xf_line, color=colors[name], linewidth=(h * 0.6)) ax.hlines(y + h * 0.1, xi_line, xf_line, color=colors[name], linewidth=(h * 0.6))
ax.set_xlim(0, X); ax.set_ylim(0, Y); ax.set_axis_off(); ax.set_xlim(0, X); ax.set_ylim(0, Y); ax.set_axis_off();
fig.subplots_adjust(left=0, right=1, top=1, bottom=0, hspace=0, wspace=0) fig.subplots_adjust(left=0, right=1, top=1, bottom=0, hspace=0, wspace=0)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Magic ## Magic
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
%%svg %%svg
<svg width='300px' height='300px'> <svg width='300px' height='300px'>
<title>Small SVG example</title> <title>Small SVG example</title>
<circle cx='120' cy='150' r='60' style='fill: gold;'> <circle cx='120' cy='150' r='60' style='fill: gold;'>
<animate attributeName='r' from='2' to='80' begin='0' <animate attributeName='r' from='2' to='80' begin='0'
dur='3' repeatCount='indefinite' /></circle> dur='3' repeatCount='indefinite' /></circle>
<polyline points='120 30, 25 150, 290 150' <polyline points='120 30, 25 150, 290 150'
stroke-width='4' stroke='brown' style='fill: none;' /> stroke-width='4' stroke='brown' style='fill: none;' />
<polygon points='210 100, 210 200, 270 150' <polygon points='210 100, 210 200, 270 150'
style='fill: lawngreen;' /> style='fill: lawngreen;' />
<text x='60' y='250' fill='blue'>Hello, World!</text> <text x='60' y='250' fill='blue'>Hello, World!</text>
</svg> </svg>
``` ```
......
# Jupyter Quickstart # Jupyter Example Profile
## Introduction ## Introduction
This repository contains an exemplary Jupyter profile which works with the RWTH Jupyter server. To be more specific, it includes the following files This repository contains an exemplary Jupyter profile which works with the RWTH Jupyter server. To be more specific, it includes the following files
* `Quickstart.ipynb` which is an exemplary Jupyter notebook file. * `Quickstart.ipynb` which is an exemplary Jupyter notebook file.
* `environment.yml` which specifies the required Python packages needed to run `Quickstart.ipynb`. * `environment.yml` which specifies the required Python packages needed to run `Quickstart.ipynb`. This file is used by Anaconda or `conda`.
* `Dockerfile` which defines the linux environment. In the end, the packages in `environment.yml` are installed and a `postBuild` script is executed afterwards. * `Dockerfile` which defines the linux environment. In the end, the packages in `environment.yml` are installed and a `postBuild` script is executed afterwards.
* `.gitlab-ci.yml` which specifies the necessary Docker build commands (which are executed every time `Dockerfile` changes in Git). * `.gitlab-ci.yml` which specifies the necessary Docker build commands (which are executed every time `Dockerfile` changes in Git).
Run the notebook directly online [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fgit.rwth-aachen.de%2FIENT%2Fjupyter-quickstart/master?urlpath=lab/tree/index.ipynb) (the starting process of the session may take up to one minute). Run the notebook directly online [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fgit.rwth-aachen.de%2Fjupyter%2Fexample-profile/master?urlpath=lab/tree/Quickstart.ipynb) (the starting process of the session may take up to one minute).
## Installation ## Installation
...@@ -19,10 +19,10 @@ TBD ...@@ -19,10 +19,10 @@ TBD
### Docker ### Docker
For advanced users only: If you happen to have Docker installed, you can start a local dockerized JupyterLab with enabled GDET3-Demos with For advanced users only: If you happen to have Docker installed, you can start a local dockerized JupyterLab with
```bash ```bash
docker run --name='jupyter-quickstart' --rm -it -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes registry.git.rwth-aachen.de/ient/jupyter-quickstart:master docker run --name='jupyter-example-profile' --rm -it -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes registry.git-ce.rwth-aachen.de/jupyter/example-profile:master
``` ```
Copy and paste the displayed link to your favorite browser. Copy and paste the displayed link to your favorite browser.
...@@ -35,10 +35,10 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a ...@@ -35,10 +35,10 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a
* Download this repository to your local disk. You can download it as a zip-File or use `git`: * Download this repository to your local disk. You can download it as a zip-File or use `git`:
```bash ```bash
git clone --recurse-submodules git@git.rwth-aachen.de:IENT/jupyter-quickstart.git git clone --recurse-submodules git@git-ce.rwth-aachen.de:jupyter/example-profile.git
``` ```
* It is highly recommended to run the notebooks in an isolated Anaconda environment. You can create a new environment called `jupyter-quickstart` from the provided `environment.yml` by running the following command in the Anaconda prompt * It is highly recommended to run the notebooks in an isolated Anaconda environment. You can create a new environment called `jupyter-example-profile` from the provided `environment.yml` by running the following command in the Anaconda prompt
```bash ```bash
conda env create -f environment.yml conda env create -f environment.yml
...@@ -48,10 +48,10 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a ...@@ -48,10 +48,10 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a
* Activate this environment with * Activate this environment with
```bash ```bash
conda activate jupyter-quickstart conda activate jupyter-example-profile
``` ```
* Run two final commands in the Anaconda prompt (with activated `jupyter-quickstart` environment): * Run two final commands in the Anaconda prompt (with activated `jupyter-example-profile` environment):
```bash ```bash
chmod +x binder/postBuild chmod +x binder/postBuild
...@@ -62,13 +62,13 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a ...@@ -62,13 +62,13 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a
### Local Run ### Local Run
* Activate the environment with `conda activate jupyter-quickstart`. * Activate the environment with `conda activate jupyter-example-profile`.
* Run JupyterLab `jupyter lab`. In your browser, JupyterLab should start. You can then open `index.ipynb` for an overview over all notebooks. * Run JupyterLab `jupyter lab`. In your browser, JupyterLab should start. You can then open `index.ipynb` for an overview over all notebooks.
* You can deactivate the environment with `conda deactivate`. * You can deactivate the environment with `conda deactivate`.
## Contact ## Contact
* If you found a bug, please use the [issue tracker](https://git.rwth-aachen.de/IENT/jupyter-quickstart/issues). * If you found a bug, please use the [issue tracker](https://git-ce.rwth-aachen.de/jupyter/example-profile/issues).
* In all other cases, please contact [Christian Rohlfing](http://www.ient.rwth-aachen.de/cms/c_rohlfing/). * In all other cases, please contact [Christian Rohlfing](http://www.ient.rwth-aachen.de/cms/c_rohlfing/).
The code is licensed under the [MIT license](https://opensource.org/licenses/MIT). The code is licensed under the [MIT license](https://opensource.org/licenses/MIT).
name: jupyter-quickstart name: jupyter-example-profile
channels: channels:
- conda-forge - conda-forge
dependencies: dependencies:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment