Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • blup
  • master
2 results

Target

Select target project
  • acs/public/teaching/slew/slew-jupyter-profile
  • upasana1993pal31may/iambanalyses
  • hristo.vassilev/2-d-3-d
  • Arnd2/itsd-demo
  • andrea.hanke/datenverarbeitung-ii
  • inda/innda
  • felix.schwinger/ifo-m-2022-profile
  • john.arnold/cos-3-a-uebung
  • alexander.bonkowski/physchem-ii
  • jupyter/example-profile
  • johanna.ochs/example-profile
  • fibis/example-profile
  • ChristophGuenther/example-profile
  • annabell.brocker/example-profile
  • yanik.soeltzer/example-profile
  • henrik.hose/example-profile
  • christoph.weyer/example-profile
  • jakob-beetz/ifcopenshell-jupyter-profile
  • rohlfing/example-profile
  • noemi.kremer/example-profile
  • maximilian.vitz/jupyter-profile
  • japhba/edyn
  • ulf.liebal/iambanalyses
  • john.arnold/cos-3-a-uebung-showcase
  • steffen.kortmann/multi-energy-systems
  • hristo.vassilev/ml4ce-env
  • felix.gaumnitz/multi-energy-systems
  • jakob-beetz/bim-programming-2023
  • Christoph.Bannwarth/cos-3-a-uebung
  • aev-lectures/digitalization-of-energy-distribution-grids
  • joneschakk/example-profile-test-copy
  • thilo.birkenfeld/ex-phys-3
  • philipp.soldin/experimentalphysik-4-excercises
  • unruh/jupyter-intro-qc
  • kjlehmann/fb-bio-bioinformatics-course
  • mlcg/teaching/binf24
  • jens.brandt/jupyter-profile-oscar
  • yousseftarek12.yt/innda
  • lars.goettgens/jupyter-profile-oscar
  • mlcg/bioinfo-workshop
40 results
Select Git revision
  • Update_WS2024
  • master
2 results
Show changes

Commits on Source 7

# Specify parent image. Please select a fixed tag here. # Specify parent image. Please select a fixed tag here.
ARG BASE_IMAGE=registry.git.rwth-aachen.de/jupyter/profiles/rwth-courses:2020-ss.1 ARG BASE_IMAGE=registry.git.rwth-aachen.de/jupyter/profiles/rwth-courses:latest
FROM ${BASE_IMAGE} FROM ${BASE_IMAGE}
# Install packages via requirements.txt # Install packages via requirements.txt
...@@ -10,6 +10,6 @@ RUN pip install -r requirements.txt ...@@ -10,6 +10,6 @@ RUN pip install -r requirements.txt
ADD environment.yml /tmp/environment.yml ADD environment.yml /tmp/environment.yml
# All packages specified in environment.yml are installed in the base environment # All packages specified in environment.yml are installed in the base environment
RUN conda env update -f /tmp/environment.yml && \ RUN mamba env update -f /tmp/environment.yml && \
conda clean -a -f -y mamba clean -a -f -y
ARG BASE_IMAGE=registry.git.rwth-aachen.de/jupyter/profiles/rwth-courses-python-3.10:latest
FROM ${BASE_IMAGE}
ARG conda_env=python310
ARG py_ver=3.10
ARG disp_name="Python 3.10 (ipykernel)"
# Install packages via requirements.txt
ADD requirements.txt .
RUN "${CONDA_DIR}/envs/${conda_env}/bin/pip" install --no-cache-dir -r requirements.txt
# .. Or update conda base environment to match specifications in environment.yml
ADD environment.yml /tmp/environment.yml
# All packages specified in environment.yml are installed in the base environment
RUN mamba env update -n "${conda_env}" -f /tmp/environment.yml && \
mamba clean -a -f -y
ARG BASE_IMAGE=registry.git.rwth-aachen.de/jupyter/profiles/rwth-courses-python-3.11:latest
FROM ${BASE_IMAGE}
ARG conda_env=python311
ARG py_ver=3.11
ARG disp_name="Python 3.11 (ipykernel)"
# Install packages via requirements.txt
ADD requirements.txt .
RUN "${CONDA_DIR}/envs/${conda_env}/bin/pip" install --no-cache-dir -r requirements.txt
# .. Or update conda base environment to match specifications in environment.yml
ADD environment.yml /tmp/environment.yml
# All packages specified in environment.yml are installed in the base environment
RUN mamba env update -n "${conda_env}" -f /tmp/environment.yml && \
mamba clean -a -f -y
ARG BASE_IMAGE=registry.git.rwth-aachen.de/jupyter/profiles/rwth-courses-python-3.12:latest
FROM ${BASE_IMAGE}
ARG conda_env=python312
ARG py_ver=3.12
ARG disp_name="Python 3.12 (ipykernel)"
# Install packages via requirements.txt
ADD requirements.txt .
RUN "${CONDA_DIR}/envs/${conda_env}/bin/pip" install --no-cache-dir -r requirements.txt
# .. Or update conda base environment to match specifications in environment.yml
ADD environment.yml /tmp/environment.yml
# All packages specified in environment.yml are installed in the base environment
RUN mamba env update -n "${conda_env}" -f /tmp/environment.yml && \
mamba clean -a -f -y
ARG BASE_IMAGE=registry.git.rwth-aachen.de/jupyter/profiles/rwth-courses-python-3.13:latest
FROM ${BASE_IMAGE}
ARG conda_env=python313
ARG py_ver=3.13
ARG disp_name="Python 3.13 (ipykernel)"
# Install packages via requirements.txt
ADD requirements.txt .
RUN "${CONDA_DIR}/envs/${conda_env}/bin/pip" install --no-cache-dir -r requirements.txt
# .. Or update conda base environment to match specifications in environment.yml
ADD environment.yml /tmp/environment.yml
# All packages specified in environment.yml are installed in the base environment
RUN mamba env update -n "${conda_env}" -f /tmp/environment.yml && \
mamba clean -a -f -y
%% 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 Example Profile 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 * import rwth_nb.plots.mpl_decorations as rwth_plots
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:
``` python
from scipy import misc
f = misc.face()
fig,ax = plt.subplots();
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 *
# 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_plots.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>
``` ```
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
## Introduction ## Introduction
This repository contains an exemplary Jupyter profile which works with the RWTHjupyter cluster. To be more specific, it includes the following files This repository contains an exemplary Jupyter profiles which works with the RWTHjupyter cluster. 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`. This file is used by Anaconda or `conda`. * `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. * `Dockerfile` which defines the linux environment based on Python3.9. In the end, the packages in `environment.yml` are installed.
* `Dockerfile.python-*` defines the linux environment based on a specific python version. In the end, the packages in `environment.yml` are installed.
* `.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).
## Installation ## Installation
...@@ -31,7 +32,12 @@ cd ${WORKDIR} ...@@ -31,7 +32,12 @@ cd ${WORKDIR}
docker login registry.git.rwth-aachen.de docker login registry.git.rwth-aachen.de
# Build the Docker image # Build the Docker image
docker build --tag jupyter-example-profile . docker build --tag jupyter-example-profile . # Default version (Python 3.9)
docker build --tag jupyter-example-profile -f Dockerfile.python-3.10 # Python 3.10
docker build --tag jupyter-example-profile -f Dockerfile.python-3.11 # Python 3.11
docker build --tag jupyter-example-profile -f Dockerfile.python-3.12 # Python 3.12
docker build --tag jupyter-example-profile -f Dockerfile.python-3.13 # Python 3.13
# Run the Docker image # Run the Docker image
docker run --name='jupyter-example-profile' --rm --interactive --tty --publish 8888:8888 --volume ${WORKDIR}:/home/jovyan jupyter-example-profile docker run --name='jupyter-example-profile' --rm --interactive --tty --publish 8888:8888 --volume ${WORKDIR}:/home/jovyan jupyter-example-profile
...@@ -72,6 +78,6 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a ...@@ -72,6 +78,6 @@ To run the notebooks on your local machine, you may use [Anaconda](https://www.a
## Contact ## Contact
* If you found a bug, please use the [issue tracker](https://git-ce.rwth-aachen.de/jupyter/profiles/examples/issues). * If you found a bug, please use the [issue tracker](https://git-ce.rwth-aachen.de/jupyter/profiles/examples/issues).
* In all other cases, please contact [Christian Rohlfing](http://www.ient.rwth-aachen.de/cms/c_rohlfing/). * In all other cases, please contact the [ServiceDesk of the ITC](mailto:servicedesk@itc.rwth-aachen.de).
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).