pep-dortmund / toolbox-workshop

Materialien zum PeP et al. Toolbox-Workshop
http://toolbox.pep-dortmund.org
Other
26 stars 6 forks source link

WIP: Example report exercise steps #448

Closed LuckyJosh closed 1 month ago

LuckyJosh commented 1 month ago

Still Work in Progress but only one or two step are missing (for a checklist of the different steps see #419, which I do have to update).

I tried a few methods to reduce the amount of duplication, e.g. using diff and patch or branches in a git repo to switch to the next step. In both versions you had to fix the same error in multiple files (the same file in multiple branches) which also felt error prone and inconvenient.

So I came up with this solution: Each file has a template file on which each version of this file is based upon. For example all auswertung.py files in each of the 10 step directories are generated from one template file auswertung_py_template[1]

The template 'files-format' adds just one comment at the end of each line, that contains the information in which step the respective line is included. The 'range'-syntax is inspired by the latex-beamer overlay syntax (a python slice like 2:4 would have been confusing, since these ranges are inclusive on both ends).

An example from the auswertung_py_template:

# padding so that the copy button does not overlap the code
#
#
# Erklärung:                                                                                       # <2-2>
# Die Daten aus Dateien mit mehreren spalten muss man in einer extra Zeile skalieren               # <2-2>
# Masse und Umfang der Kugel                                                                       # <2-10>
m_b, u_b = np.genfromtxt("data/Messwerte_Kugel.txt", delimiter=",", unpack=True)                   # <2-4>
m_b, m_b_unc, u_b, u_b_unc = np.genfromtxt("data/Messwerte_Kugel.txt", delimiter=",", unpack=True) # <5-10>
m_b = m_b/1000 # kg                                                                                # <2-4>
u_b = u_b/100 # m                                                                                  # <2-4>
m_b = unc.ufloat(m_b,m_b_unc)/1000 # kg                                                            # <5-10>
u_b = unc.ufloat(u_b,m_b_unc)/100 # m                                                              # <5-10>

The first two lines in this snippet are only apearing in step-2/auswertung.py, the third one in all ten steps. In step-5 uncertainties are included and so from this step onwards the loading of the datafiles has to be changed.

Before using this custom 'file format' I tried json for the template files, but that was ways less readable than this minimal version.

In addition to adding the 10th step I probably could clean up the Makefile to some extend.

[1] the templates don't have a file ending to prevent formatters from destroying the alignment of the comments

chrbeckm commented 1 month ago

For this year, we could tell them to do it in their version of the template repo.

LuckyJosh commented 1 month ago

For this year, we could tell them to do it in their version of the template repo.

Fine by me. :+1:

Using the full template repo would make (at least) step 10 more or less obsolete

I thought the template might be less overwhelming if the participants building it up by themself.

LuckyJosh commented 1 month ago

Everything except for step-11 should be fine and running with make in the directory of this exercise. I'll hook it up to the 'whole repo'-Makefile-chain shortly

chrbeckm commented 1 month ago

For this year, we could tell them to do it in their version of the template repo.

Fine by me. 👍

Using the full template repo would make (at least) step 10 more or less obsolete

I thought the template might be less overwhelming if the participants building it up by themself.

I thought about

  1. Using the template repo to create their own repo
  2. create v16516 dir in that directory, maybe by copying vXXX
  3. start with step-02 from this exercise
LuckyJosh commented 1 month ago

Done with the build process of all 11 steps, missing:

aknierim commented 1 month ago

Is it expected behaviour that the full report is built in both steps 1 and 11?

LuckyJosh commented 1 month ago

Is it expected behaviour that the full report is built in both steps 1 and 11?

Yes, to have a reference from the start, and they can use this completed version to copy the text from.

aknierim commented 1 month ago

Okay, makes sense

chrbeckm commented 1 month ago

Starting with step 07, I only see

# Beispiel Protokoll

Einleitung:
Um dieser Aufgabe sinnvoll folgen zu können sollte diese von Anfang an bearbeitet werden. Folgt den 
Anweisungen in den 'aufgabe.txt' Dateien in den Unterordnern des Ordners 'example-report'.

in aufgabe.txt.

aknierim commented 1 month ago

This is expected behaviour as the instructions seem to be placholders from 7 onward. See 8-all/example-report/templates/aufgabe-step-*.txt

aknierim commented 1 month ago

That is something that has to be fixed of course.

LuckyJosh commented 1 month ago

Yes I just added the missing task descriptions 7-11 :+1: