Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Example report exercise steps #448

Merged
merged 83 commits into from
Oct 4, 2024
Merged

Conversation

LuckyJosh
Copy link
Contributor

@LuckyJosh LuckyJosh commented Oct 1, 2024

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

@LuckyJosh
Copy link
Contributor Author

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.

@LuckyJosh
Copy link
Contributor Author

LuckyJosh commented Oct 3, 2024

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
Copy link
Member

chrbeckm commented Oct 3, 2024

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
Copy link
Contributor Author

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

  • the task descriptions have to be written.
  • hooking into the makefile change of the repo

@aknierim
Copy link
Member

aknierim commented Oct 4, 2024

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

@LuckyJosh
Copy link
Contributor Author

LuckyJosh commented Oct 4, 2024

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
Copy link
Member

aknierim commented Oct 4, 2024

Okay, makes sense

@chrbeckm
Copy link
Member

chrbeckm commented Oct 4, 2024

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
Copy link
Member

aknierim commented Oct 4, 2024

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

@aknierim
Copy link
Member

aknierim commented Oct 4, 2024

That is something that has to be fixed of course.

@LuckyJosh
Copy link
Contributor Author

LuckyJosh commented Oct 4, 2024

Yes I just added the missing task descriptions 7-11 👍

@chrbeckm chrbeckm merged commit ae302c7 into main Oct 4, 2024
1 check passed
@chrbeckm chrbeckm deleted the example-report-exercise-steps branch October 4, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants