Week 4 laboratory

Python calculates the numbers. Typst makes the PDF.

This page shows the Week 4 loop so you can see how the pieces fit together. Your graded files live in your private repo, in the folder week04-report/. A Python script reads your CSV and writes two files: output/numbers.typ (the results sentence and the table) and output/figure.png (the graph). You then run typst compile main.typ, and Typst turns main.typ into output/main.pdf. The preview lower on this page runs in the browser so you can try the idea in class. The work you turn in is the PDF you compile on your own computer. Install Typst before lab if you can.

edit your writing or the script → run the script → compile the PDF → read it → edit again The mean in the paper comes from the script. If a number looks wrong, change the script or the CSV and run it again.
Markdown

What you claim

week04-report/README.md is the short lab note you paste on Canvas. You write the prediction, what you changed, and anything a reader should know about the data. The script fills in the results.

Python

What you compute

report/scripts/summarize.py reads the CSV, writes output/numbers.typ, and draws output/figure.png. The script uses matplotlib. Install it inside this project's .venv folder so it stays with the lab.

Typst

What you typeset

report/main.typ pulls in the generated snippet (the table and the figure) with #include. Run typst compile main.typ output/main.pdf to make the paper. Turn in that PDF along with the source files.

In the private repository

Install Typst, then run the loop

Copy the starter from report/ into a folder named week04-report/ in your private repo. Run the first build on sample-rt.csv so you can see that the compiler works. Then point the script at your Week 2 or Week 3 CSV. In the VS Code terminal:

cd week04-report
python3 -m venv .venv
source .venv/bin/activate
bash build.sh sample-rt.csv
# then, on your own file:
bash build.sh ../week02-rt/YOURFILE.csv

Windows (PowerShell): py -3 -m venv .venv, then .\.venv\Scripts\Activate.ps1, then py -3 -m pip install -r requirements.txt, then py -3 scripts/summarize.py --csv YOURFILE.csv --out output --report README.md, then typst compile main.typ output/main.pdf. If Git is installed, bash build.sh YOURFILE.csv also works.

On a Mac, install Typst with brew install typst. On Windows, use winget install --id Typst.Typst. Check that it worked with typst --version. The longer note is on workflow.html#typst.

Practice loop · runs in the browser

See what the script writes

The first code box is the results snippet the script would write (output/numbers.typ). The second box is the whole paper (main.typ): the title, the prediction, the included results, and a limitation. The page on the right is a browser preview of how that paper looks. Compile on your laptop when you want the real PDF.

Load a file, write a prediction, then rebuild the preview.

Generated snippet · output/numbers.typ

Run the preview to fill this block.

Full paper source · main.typ

The compiled PDF includes the title, the prediction, the results, and the limitation.
Remix

Modification

After the first PDF, rewrite the title, prediction, and limitation in main.typ until another student can say your claim in one sentence. Then change something the script controls: which trials you leave out, how the figure is drawn (how the bars are grouped, or the first half of the trials versus the second half), or a second summary number. Run the build again so output/main.pdf updates. In the README, quote the old results sentence and the new one. Keep the mean the script calculated.

Weekly report

What to submit

Turn in the paths to week04-report/README.md, week04-report/main.typ, week04-report/output/numbers.typ, week04-report/output/figure.png, and week04-report/output/main.pdf, plus the path to the CSV you used. Also name one change you made after the first build, and say what changed in the PDF. Due Tuesday 29 September. There is no class on the 30th.

Class night

Agenda

18:00 Introduction
A report is a set of steps you can run again. The number in the PDF comes from a file the script reads.
18:25 Demonstration
The instructor runs build.sh on a sample CSV, opens the PDF, changes one line, and compiles again.
18:40 Exercise
Install Typst if you still need it. Build the sample first. Then point the script at your own CSV. Write the prediction before you look at the mean.
19:25 Results
Show the class the PDF (or the generated table) and one limitation.
20:05 Modification
Rewrite the sentences until someone else can state your claim. Then change the exclusion rule or add a second summary number, and rebuild the PDF.
Reading
report/README.md and the note on agentic coding.

Report: the file paths, the CSV you used, and one change you can describe. The mean in the paper comes from the script.