Skip to content

Commit e857c28

Browse files
authored
Fixing parallelization and LaTex->PDF workflow (mostly by giving up on the idea of supporting more unicode in the MD files)
1 parent 7f1d0e3 commit e857c28

File tree

7 files changed

+41
-16
lines changed

7 files changed

+41
-16
lines changed

.github/workflows/conditional_convert_via_pandoc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
.github/workflows/pandoc_texlive_packages.txt
6161
- name: Run Pandoc
6262
run: |
63-
echo "$list_changed_files"
63+
echo $list_changed_files
6464
bash ./pandoc.sh $list_changed_files
6565
# - name: Commit files # transfer the new files into the repository
6666
# run: |

.github/workflows/pandoc_texlive_packages.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ babel
1717
babel-greek
1818
xeCJK
1919
lualatexja
20+
lualatex-math
2021
framed
2122
fontspec
2223
selnolig

content/de/instructions/inelastischer-stoss/inelastischer-stoss.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
translationKey: "Inelastic Collision Instruction"
33
title: "(In)elastischer Stoß"
44
date: 2024-12-17T11:42:40+01:00
@@ -75,7 +75,7 @@ Der Reiter „Energie“ zeigt die zu den berechneten Höhen gehörenden Energie
7575

7676
## Physikalischer Hintergrund und Analysedetails
7777

78-
Phyphox zeichnet Audiodaten des Smartphone-Mikrofons auf und analysiert sie sequentiell (wie in der Konfiguration „akustische Stoppuhr“). Die Samples werden auf einen Bereich von -1 bis 1 normalisiert, wobei die genaue Bedeutung dieser Amplitude je nach Aufnahmehardware des Smartphones variieren kann. Wenn ein Sample die vom Benutzer eingestellte Trigger-Schwelle überschreitet, wird dies als Ereignis gezählt und die Zeit vermerkt. Die Zeit basiert auf der Abtastrate, die typischerweise 48 kHz (oder in einigen Fällen 44,1 kHz) beträgt. Das ergibt eine theoretische zeitliche Auflösung von \(21\,\mathrm{μs}\) (bzw. \(23\,\mathrm{μs}\)). In der Praxis ist diese Auflösung jedoch durch Unterschiede in den Geräuschen verschiedener Aufpralle, Dispersion und die Form der Schallwelle begrenzt. Während phyphox intern exakte Werte nutzt, werden daher nur drei Dezimalstellen (1 ms) angezeigt.
78+
Phyphox zeichnet Audiodaten des Smartphone-Mikrofons auf und analysiert sie sequentiell (wie in der Konfiguration „akustische Stoppuhr“). Die Samples werden auf einen Bereich von -1 bis 1 normalisiert, wobei die genaue Bedeutung dieser Amplitude je nach Aufnahmehardware des Smartphones variieren kann. Wenn ein Sample die vom Benutzer eingestellte Trigger-Schwelle überschreitet, wird dies als Ereignis gezählt und die Zeit vermerkt. Die Zeit basiert auf der Abtastrate, die typischerweise 48 kHz (oder in einigen Fällen 44,1 kHz) beträgt. Das ergibt eine theoretische zeitliche Auflösung von \(21\,\mathrm{\mu s}\) (bzw. \(23\,\mathrm{\mu s}\)). In der Praxis ist diese Auflösung jedoch durch Unterschiede in den Geräuschen verschiedener Aufpralle, Dispersion und die Form der Schallwelle begrenzt. Während phyphox intern exakte Werte nutzt, werden daher nur drei Dezimalstellen (1 ms) angezeigt.
7979

8080
Nach einem Ereignis werden die folgenden Audiosamples verworfen, bis die im unter „Mindestverzögerung“ eingestellte Zeit verstrichen ist. Danach wird das nächste Sample oberhalb der Schwelle als nächstes Ereignis erfasst. Die Zeitdifferenzen zwischen den aufeinanderfolgenden Ereignissen werden als „Zeit 1“, „Zeit 2“ usw. angezeigt.
8181

@@ -104,7 +104,7 @@ Die anfängliche Höhe \( h_0 \) wird extrapoliert, indem angenommen wird, dass
104104

105105
In der Praxis wird die anfängliche Höhe häufig unterschätzt, da bei höheren Aufprallgeschwindigkeiten mehr Energie in Wärme umgewandelt wird. Der erste Aufprall hat typischerweise die höchste Geschwindigkeit und verliert damit einen höheren Anteil seiner Energie. Die Annahme eines gleichen Verlustfaktors führt somit zu einer Unterschätzung der potentiellen Energie vor dem ersten Aufprall und damit zu einer Unterschätzung der Anfangshöhe.
106106

107-
107+
108108
## Probleme und Lösungen
109109

110110
* **Phyphox erfasst nicht alle Aufpralle.**

content/en/instructions/inelastic-collision/inelastic-collision.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
translationKey: "Inelastic Collision Instruction"
33
title: "(In)elastic Collision"
44
date: 2024-12-17T11:42:40+01:00
@@ -73,7 +73,7 @@ The energy tab shows energy data corresponding to the heights that have actually
7373

7474
## Physics background and analysis details
7575

76-
Phyphox records audio samples from the phone's microphone and considers them sequentially (like the "acoustic stopwatch" configuration). The samples are normalized to a range of -1 to 1, although the exact meaning can differ from phone to phone due to different recording hardware and processing. If a sample is above the trigger threshold set by the user, this is counted as an event and its time is noted. The time is based on the sampling rate of the recording, which is typically 48kHz (or in some cases 44.1kHz), resulting in a theoretical temporal resolution of \(21\,\mathrm{μs}\) (or \(23\,\mathrm{μs}\)). Note that in practice this resolution is severely limited by differences between the sounds from different bounces as well as dispersion and the shape of the waveform itself and phyphox only displays three decimals (1ms) while using the exact value internally.
76+
Phyphox records audio samples from the phone's microphone and considers them sequentially (like the "acoustic stopwatch" configuration). The samples are normalized to a range of -1 to 1, although the exact meaning can differ from phone to phone due to different recording hardware and processing. If a sample is above the trigger threshold set by the user, this is counted as an event and its time is noted. The time is based on the sampling rate of the recording, which is typically 48kHz (or in some cases 44.1kHz), resulting in a theoretical temporal resolution of \(21\,\mathrm{\mu s}\) (or \(23\,\mathrm{\mu s}\)). Note that in practice this resolution is severely limited by differences between the sounds from different bounces as well as dispersion and the shape of the waveform itself and phyphox only displays three decimals (1ms) while using the exact value internally.
7777

7878
The next sound samples will be discarded until a minimum time interval set by "Minimum Delay" has passed. After this time the next sample above the threshold is noted as the next event and the time difference between subsequent events is shown as "Time 1", "Time 2", etc.
7979

pandoc-generator/pandoc-single.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# You can add more extensions if you're fine with --standalone only
3+
Only_Standalone_Output_Types="latex docx odt"
4+
# Pandoc creates an AST (Abstract Syntax Tree); reuse this by saving/reading from .ast
5+
# You can add individual pandoc conversions by calling them after the 'done' part. Keep in mind to finish all lines with backslash
6+
7+
BASE="${1%.*}"
8+
FILENAME=$(basename -- "$1")
9+
LOGID="${FILENAME%.*}"
10+
SUPPORTDIR=$(dirname "$0")
11+
12+
echo "PANDOC Processing $1 as $LOGID"
13+
14+
pandoc --from markdown+tex_math_single_backslash --to native "$1" -o "$BASE.ast"
15+
for ext in ${Only_Standalone_Output_Types}; do
16+
echo "$LOGID Genrating $ext"
17+
pandoc --from native "$BASE.ast" --standalone --pdf-engine=lualatex -o "$BASE.$ext"
18+
done
19+
20+
# HTML
21+
echo "$LOGID Generating pdf"
22+
pandoc --from native "$BASE.ast" --standalone --mathml -o "$BASE.html"; \
23+
24+
# PDF
25+
echo "$LOGID Generating pdf"
26+
pandoc --from native "$BASE.ast" --standalone -H "$SUPPORTDIR/preamble.tex" --pdf-engine=pdflatex -o "$BASE.pdf"; \
27+
28+
echo "$LOGID Cleaning up"
29+
rm "./$BASE.ast"
30+
31+
echo "$LOGID Done."

pandoc-generator/preamble.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
% Not used at the moment, but can be used to customize the LaTeX-based PDF generation

pandoc.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/bash
2-
# You can add more extensions if you're fine with --standalone only
3-
Only_Standalone_Output_Types="latex pdf html docx odt"
4-
# Pandoc creates an AST (Abstract Syntax Tree); reuse this by saving/reading from .ast
5-
# You can add individual pandoc conversions by calling them after the 'done' part. Keep in mind to finish all lines with backslash
6-
parallel --jobs 0 \
7-
pandoc --from markdown --to native './{}' -o './{.}.ast' ';'\
8-
for i in "$Only_Standalone_Output_Types"';' do \
9-
pandoc --from native './{.}.ast' --standalone -o './{.}.$i' ';' \
10-
done';' \
11-
rm './{.}.ast' ::: "$1"
2+
#Just a wrapper for parallelization, but separating this into its own script saves some nasty escaping escapates.
3+
parallel --jobs 0 --ungroup ./pandoc-generator/pandoc-single.sh ::: "$@"

0 commit comments

Comments
 (0)