Skip to content

Warn and fix when t_max is not a multiple of t_save#342

Merged
gustavdelius merged 1 commit into
masterfrom
fix/warn-t_max-not-multiple-of-t_save
May 12, 2026
Merged

Warn and fix when t_max is not a multiple of t_save#342
gustavdelius merged 1 commit into
masterfrom
fix/warn-t_max-not-multiple-of-t_save

Conversation

@gustavdelius
Copy link
Copy Markdown
Member

Fixes #341.

Summary

  • project() now emits a warning when t_max is not a multiple of t_save, so users know their save grid doesn't align with the requested end time.
  • The state at t_max is now always appended to the saved time vector, so it is available in the result even when the final interval is shorter than t_save. The loop already handles uneven intervals correctly via round((times[[i]] - t) / dt).
  • In the effort-array path the fix only fires when the user explicitly passed t_max; misalignment between an effort array's natural end time and t_save is not flagged.

Test plan

  • expect_warning test: project(params, t_max = 10, t_save = 3) warns and returns time points c(0, 3, 6, 9, 10).
  • expect_no_warning test: project(params, t_max = 9, t_save = 3) is silent.
  • All 91 existing tests in test-project.R pass.

🤖 Generated with Claude Code

When `t_max` is not a multiple of `t_save`, `project()` previously
silently dropped the final time point. Now it warns the user and always
appends `t_max` to the saved time vector so the state at `t_max` is
always available in the result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gustavdelius gustavdelius force-pushed the fix/warn-t_max-not-multiple-of-t_save branch from f85ea91 to c6683f2 Compare May 12, 2026 06:48
@gustavdelius gustavdelius merged commit b455d17 into master May 12, 2026
1 check failed
@gustavdelius gustavdelius deleted the fix/warn-t_max-not-multiple-of-t_save branch May 12, 2026 07:18
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.

Warn when t_max is not a multiple of t_save

1 participant