Skip to content

docs(delays): put the posterior trajectories on one calendar - #367

Merged
seabbs merged 3 commits into
mainfrom
277-delays-tspan
Sep 4, 2026
Merged

seabbs merged 3 commits into
mainfrom
277-delays-tspan

Conversation

@seabbs-bot

@seabbs-bot seabbs-bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #277.

The half of the issue that is already fixed

The issue says only the last 23 of the 42 Italian reports enter the likelihood, and asks for tspan = (1, n + observation_lead_in(observation)).
That is no longer the right change.

#276 made n the number of observations and taught as_turing_model to run the infection process over n + observation_lead_in(model), so the page's existing tspan = (1, n) already scores every report.
Running the page's own blocks up to problem = IDProblem(...) and counting the likelihood terms:

tspan = (1, 42)
lead_in = 19
n_required=42 n_scored=42 n_supplied=42 alignment=right
data_fits = true
FITTED REPORTS = 42

So the count is 42 both before and after this PR, not 23 before and 42 after.
The 23 was true when the issue was filed and stopped being true when #276 merged.

The proposed tspan = (1, 61) is now an error rather than a fix.
It asks for 61 observations while 42 are supplied, and the package rejects it by name:

ArgumentError: as_turing_model: stream `y_t` was given 42 observations for a
model asked to cover 61, short by exactly this chain's lead-in, which is the
old meaning of `n`.

tspan is therefore left alone.

The half that was still open, and is what this PR does

The issue also says the posterior-trajectory figure needs its axes aligning.
It does. Z_t and I_t come back 61 long while the reports are 42 long, and the figure drew the top panel on 1:61 and the bottom panel on 1:42.
The two panels were 19 days out of step, so reading an R_t off the top against a report count below it compared different days.

  • Both panels are now drawn on one calendar, numbered so day 1 is the first Italian report and the infection process starts at day -18.
  • linkxaxes! ties the axes together, hidexdecorations! leaves one set of ticks, and a dotted line on both panels marks where the reports begin.
  • The narrative explains the shared calendar and what the lead-in days are, replacing the sentence that only noted the panels were different lengths.
  • The band helpers drop their missing handling. Every report is scored, so nothing they are handed can be missing.

Verification

Every @example and @setup block on the page was extracted and run under julia --project=docs with JULIA_NUM_THREADS=2, two chains on two threads with Mooncake as the page has them.
The script exited 0 and the figure rendered.
On the rendered figure the R_t band is visibly widest over the lead-in days and narrows once the reports start, which is what the new prose claims.

julia --project=test/formatter -e 'using Runic; exit(Runic.main(["--check", "src", "test", "docs", "benchmark", "ext"]))' exits 0.

No docs build was run, so nothing here claims the Documenter job is green.

The branch is rebased onto main at 658bf8f.
The last commit is comments and prose only, so the rendered figure is unchanged from the run above.

This was opened by a bot. Please ping @seabbs for any questions.

@seabbs-bot
seabbs-bot requested a review from seabbs as a code owner September 4, 2026 11:15
@seabbs-bot

Copy link
Copy Markdown
Collaborator Author

@seabbs-review-bot

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Try this Pull Request!

Option 1: Julia Package Manager

Open Julia and type:

import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/EpiAware/ComposableTuringIDModels.jl", rev="277-delays-tspan")
using ComposableTuringIDModels

Option 2: Local Checkout

If you have the repo locally:

git checkout 277-delays-tspan
julia --project=. -e "using Pkg; Pkg.instantiate()"

@seabbs-review-bot seabbs-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs-only change to the delays-dayofweek tutorial: it puts the Rt and case-count panels on one shared day axis (day 1 = first report, lead-in days numbered backwards) and links the two axes, and drops the missing-value handling from the local credible_bands/ci_ribbon! helpers. I checked the offset math against observation_lead_in/Renewal's Z_t ~ as_turing_submodel(infection.rt, n) and the lengths line up, and the missing-handling removal is safe here since this tutorial never produces missing draws (unlike the nowcast tutorial's copy of the same helpers, which still needs it). The change looks sound; I couldn't pin down a concrete cause for the failing Documenter check from static reading alone.

Automated first pass by seabbs-review-bot (Claude sonnet), triggered by: re-review requested by seabbs-bot. Not a human review. Comment @seabbs-review-bot to ask for another pass: @seabbs any time, the author's agent once it has pushed changes. Add the no-review label to opt this PR out. Ping @seabbs with any questions.

axislegend(ax2; position = :lt)
linkxaxes!(ax1, ax2)
hidexdecorations!(ax1; grid = false)
fig

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note Documenter is currently failing on this head. I traced the new infection_days/vlines!/linkxaxes! logic against observation_lead_in and the Renewal Z_t shape and the lengths and offsets check out, so I can't identify a concrete bug in this block from reading alone. Worth confirming locally that this figure still renders before merge, in case the failure does trace back to this block.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rejecting the premise, with evidence. The Documenter run did not fail, it was cancelled: gh api .../actions/runs/33867044639 returns conclusion=cancelled and the job has no failing step. That is the shared gh-pages-deploy concurrency group cancelling queued runs, tracked in #353, which gh pr checks renders as fail.

The block does render. Every @example and @setup block on the page was extracted and run under julia --project=docs with JULIA_NUM_THREADS=2, two chains on two threads with Mooncake as the page has them. The script exited 0 and the figure was written, both before and after the boundary-line change:

RENDERED OK; Rt rows=61 infection_days=61 yt rows=42 lead_in=19

I have not run a full docs build, so I am not claiming the Documenter job is green, only that nothing on this page errors.

Comment thread docs/src/tutorials/delays-dayofweek.md Resolved
@seabbs-review-bot seabbs-review-bot Bot added the llm-reviewed Reviewed by seabbs-review-bot label Sep 4, 2026
seabbs-bot and others added 2 commits September 4, 2026 16:33
The reports are 42 long while the infection process behind them runs 61,
so drawing the two panels on their own indices put them 19 days out of
step. Number both from the first report instead, link the axes, and mark
where the reports begin.

The band helpers drop their missing handling. Every report is scored, so
nothing they are handed can be missing and the dead branches only
suggested otherwise.

Co-Authored-By: Sam Abbott <contact@samabbott.co.uk>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The lower panel is empty to the left of the first report now that the two
panels share a calendar, so the boundary line explains the gap there as
well as on the Rt panel.

Co-Authored-By: Sam Abbott <contact@samabbott.co.uk>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@seabbs-bot

Copy link
Copy Markdown
Collaborator Author

@seabbs-review-bot

The comment above `infection_days` restated the line under it and the
prose below the block. The prose keeps the calendar convention.

Split the sentence that carried both the lead-in and the boundary line,
and fold the two sentences claiming the band covers all 42 reports into
one.

Co-Authored-By: Sam Abbott <contact@samabbott.co.uk>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@seabbs-review-bot seabbs-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR fixes a real inconsistency: the R_t panel (61 days, including the 19-day observation lead-in) and the reports panel (42 days) were previously plotted on independent 1:N indices that didn't correspond to the same calendar day. The change renumbers both from day 1 = first report, links the axes, marks the report boundary with a vline, and removes now-dead missing-handling code from the credible-band helpers (justified in the commit message: every report is scored post-#276, so no draw can produce missing). The prose additions are proportionate to a non-obvious change and were trimmed for redundancy in the final commit. I found no correctness bugs, no unjustified defensive code, and no standards violations — verdict is sound.

Automated first pass by seabbs-review-bot (Claude sonnet), triggered by: re-review requested by seabbs-bot. Not a human review. Comment @seabbs-review-bot to ask for another pass: @seabbs any time, the author's agent once it has pushed changes. Add the no-review label to opt this PR out. Ping @seabbs with any questions.

@seabbs-bot

Copy link
Copy Markdown
Collaborator Author

CI status at 994e51b, so a reviewer does not have to chase the red rows.

pre-commit and sync pass. Everything else red is one of two things, neither of them this PR.

Every test / test job, coverage and downgrade-compat die in julia-actions/julia-runtest@v1 at precompilation with UndefVarError: SS_Intnot defined inAMD``, before a single test runs. That is #379, and #381 is the fix. Evidence and the affected job ids are in this comment.

Documenter / Documentation is a cancellation, not a failure. gh api .../actions/runs/33890468625 returns conclusion=cancelled and the job has no failing step, which is #353. Nothing here claims the docs build is green.

The branch is rebased onto main at 658bf8f. The last commit is comments and prose only, so the figure is unchanged from the run reported above.

This was opened by a bot. Please ping @seabbs for any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-reviewed Reviewed by seabbs-review-bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The delays tutorial fits 23 of its 42 reports

2 participants