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

bugfix in notebook.py

parent eb328c09
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Feedback
`rwth_nb.misc.rwth_feedback` adds a functionality to rate a certain course.
Usage examples are demonstrated in [Submission](#Submission).
Existing submissions retrieved by mail or from _RWTHJupyter_ submission service can be [evaluated](#Evaluation) later.
%% Cell type:markdown id: tags:
## Submission
``` RWTHFeedbackMail(feedback_name, questions, feedback_path, lang, mail_to) ``` for usage with mail
``` RWTHFeedbackJupyter(feedback_name, questions, realm) ``` for usage in _RWTHJupyter_ cluster
Call method depending on use case:
%% Cell type:code id: tags:
``` python
import rwth_nb.misc.feedback as rwth_feedback
feedback_name = rwth_feedback.get_notebook_name() # get name of notebook automatically
questions = [
{'id': 'likes', 'type': 'free-text-required', 'label': 'Das war gut:'},
{'id': 'dislikes', 'type': 'free-text-required', 'label': 'Das könnte verbessert werden:'},
{'id': 'misc', 'type': 'free-text', 'label': 'Was ich sonst noch sagen möchte:'},
{'id': 'learning', 'type': 'scale', 'label' : 'Ich habe das Gefühl etwas gelernt zu haben.'},
{'id': 'supervision', 'type': 'scale', 'label' : 'Die Betreuung des Versuchs war gut.'},
{'id': 'script', 'type': 'scale', 'label' : 'Die Versuchsunterlagen sind verständlich.'},
]
```
%% Cell type:markdown id: tags:
E-Mail or offline usage
%% Cell type:code id: tags:
``` python
rwth_feedback.RWTHFeedbackMail(feedback_name, questions, feedback_path='feedback.json', lang='de', mail_to="example@rwth-aachen.de");
```
%% Cell type:markdown id: tags:
_RWTHJupyter_ submmission service
%% Cell type:code id: tags:
``` python
rwth_feedback.RWTHFeedbackJupyter(feedback_name, questions, lang='de', realm="feedback");
try:
rwth_feedback.RWTHFeedbackJupyter(feedback_name, questions, lang='de', realm="feedback")
except:
print('RWTHJupyter is needed for this')
```
%% Cell type:markdown id: tags:
## Evaluation
%% Cell type:markdown id: tags:
### Collection
``` RWTHFeedbackCollector() ```
* ``` get_all_folder(filepath) ``` - get submissions in form of json files inside a folder
* ``` get_all_jupyter(realm) ``` - retrieve and collect submissions from _RWTHJupyter_ submission realm
%% Cell type:code id: tags:
``` python
from rwth_nb.misc.feedback import RWTHFeedbackCollector
import os
# get feedback for all notebooks in a folder
feedback_dir = './Feedbacks/FeedbackV6'
collector = RWTHFeedbackCollector()
data_v6 = collector.get_all_folder('./Feedbacks/FeedbackV6')
data_v6 = None
data_v7 = None
if os.path.isdir(feedback_dir):
data_v6 = collector.get_all_folder(feedback_dir)
#data_v7 = collector.get_all_jupyter('feedback')
```
%% Cell type:markdown id: tags:
### Evaluation
``` RWTHFeedbackEvaluator() ```
* ``` evaluate(data) ``` - build widgets for evaluation of data collections. Note that ```data``` can also be a list of dataframes
%% Cell type:code id: tags:
``` python
%matplotlib widget
from rwth_nb.misc.feedback import RWTHFeedbackEvaluator
eva = RWTHFeedbackEvaluator()
eva.evaluate([data_v6, data_v7], lang='de')
try:
eva.evaluate([data_v6, data_v7], lang='de')
except:
print('RWTHjupyter is needed')
```
......
%% Cell type:markdown id: tags:
<div><img src="https://www.rwth-aachen.de/global/show_picture.asp?id=aaaaaaaaaaagazb" style="float: right; height: 5em;"></div>
[//]: # (TODO: Replace RWTH Logo with institute logo in corporate design)
# Vorlage Praktikum Aufgabenstellung
%% Cell type:markdown id: tags:
<div class="alert rwth-topic">
## Aufgabe 1: Beispielaufgabenstellung
Skizzieren Sie die Aufsichtsperson.
</div>
%% Cell type:markdown id: tags:
<div class="alert alert-block rwth-subtopic">
### Aufgabe 1.1: Unteraufgabe
Setzen Sie den Stift zweimal ab.
</div>
%% Cell type:code id: tags:
``` python
# Lösen Sie Aufgabe 1.1 in dieser Zelle.
```
%% Cell type:markdown id: tags:
<div class="alert alert-block" style="background-color: var(--rwth-purple-50);";>
__Frage:__ Wie groß ist die Person?
_Hinweis:_ Runden Sie auf Meter.
</div>
%% Cell type:code id: tags:
``` python
#height = input();
#print('Die Person ist ' + height + 'm groß.')
```
%% Cell type:markdown id: tags:
---
<div class="alert alert-block rwth-subtopic">
### Aufgabe 1.2: Unteraufgabe
Setzen Sie den Stift nur einmal ab.
_Hilfreiche Links_:
[np.zeros()](https://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html)
</div>
%% Cell type:code id: tags:
``` python
# Lösen Sie Aufgabe 1.2 in dieser Zelle.
```
%% Cell type:markdown id: tags:
---
<div class="alert alert-block rwth-subtopic">
### Aufgabe 1.3: Unteraufgabe
Füllen Sie die Tabelle aus!
</div>
%% Cell type:markdown id: tags:
| k | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| - | - | - | - | - | - | - | - | - |
| f |
%% Cell type:markdown id: tags:
---
<div class="alert alert-block rwth-feedback">
## Feedback
Liebe TeilnehmerInnen,
wir würden uns freuen, wenn ihr am Ende jeder Aufgabe kurz eure Meinung aufschreibt. Ihr könnt auf die darunter liegende Zelle zugreifen und eure Anmerkungen zu der Aufgabe (oder auch Generelles) reinschreiben.
</div>
%% Cell type:code id: tags:
``` python
import rwth_nb.misc.feedback as rwth_feedback
mail_to = "example@rwth-aachen.de"
feedback_name = rwth_feedback.get_notebook_name()
rwth_feedback.RWTHFeedback(feedback_name, [
rwth_feedback.RWTHFeedbackMail(feedback_name, [
{'id': 'likes', 'type': 'free-text-required', 'label': 'Das war gut:'},
{'id': 'dislikes', 'type': 'free-text-required', 'label': 'Das könnte verbessert werden:'},
{'id': 'misc', 'type': 'free-text', 'label': 'Was ich sonst noch sagen möchte:'},
{'id': 'learning', 'type': 'scale', 'label' : 'Ich habe das Gefühl etwas gelernt zu haben.'},
{'id': 'supervision', 'type': 'scale', 'label' : 'Die Betreuung des Versuchs war gut.'},
{'id': 'script', 'type': 'scale', 'label' : 'Die Versuchsunterlagen sind verständlich.'},
], "feedback.json", "de", mail_to);
], feedback_path="feedback.json", lang="de", mail_to=mail_to);
```
%% Cell type:markdown id: tags:
---
Weiter geht es mit [Teil 2](http://www.ient.rwth-aachen.de).
......
%% Cell type:markdown id: tags:
# rwth.nb
## Introduction
This project consists of Jupyter Notebook definitions used by RWTH Aachen University.
## Table of Contents
* [RWTH Plots](RWTH%20Plots.ipynb)
* [RWTH Colors](RWTH%20Colors.ipynb)
* [RWTH Colors](docs/source/examples/RWTH%20Colors.ipynb)
* [RWTH Plots](docs/source/examples/RWTH%20Plots.ipynb)
## Jupyter Quick Start
* To run all cells of a notebook: In the menu: Run <span class="fa-chevron-right fa"></span> Run All
* To restart the kernel: <span class="fa-refresh fa"></span>-Button
* To run a single cell: <span class="fa-play fa"></span> Run-Button
## Contributors
* [Christian Rohlfing](http://www.ient.rwth-aachen.de/cms/c_rohlfing/)
* [Lars Thieling](http://www.iks.rwth-aachen.de/institut/ueber-uns/mitarbeiter/lars-thieling/)
* [Christoph Weyer](http://www.iks.rwth-aachen.de/institut/ueber-uns/mitarbeiter/christoph-weyer-m-sc/)
* [Jens Schneider](http://www.ient.rwth-aachen.de/cms/j_schneider/)
%% Cell type:markdown id: tags:
The code is licensed under the [MIT license](https://opensource.org/licenses/MIT).
......
import os
import requests
from IPython.lib import kernel
# from IPython.lib import kernel
import ipykernel
base_url = 'https://jupyter.rwth-aachen.de'
hub_api_url = f'{base_url}/hub/api'
......@@ -9,7 +11,8 @@ def get_current_path():
token = os.environ['JUPYTERHUB_API_TOKEN']
user = os.environ['JUPYTERHUB_USER']
connection_file_path = kernel.get_connection_file()
#connection_file_path = kernel.get_connection_file()
connection_file_path = ipykernel.get_connection_file()
connection_file = os.path.basename(connection_file_path)
kernel_id = connection_file.split('-', 1)[1].split('.')[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment