Warn and fix when t_max is not a multiple of t_save#342
Merged
Conversation
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>
f85ea91 to
c6683f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #341.
Summary
project()now emits a warning whent_maxis not a multiple oft_save, so users know their save grid doesn't align with the requested end time.t_maxis now always appended to the saved time vector, so it is available in the result even when the final interval is shorter thant_save. The loop already handles uneven intervals correctly viaround((times[[i]] - t) / dt).t_max; misalignment between an effort array's natural end time andt_saveis not flagged.Test plan
expect_warningtest:project(params, t_max = 10, t_save = 3)warns and returns time pointsc(0, 3, 6, 9, 10).expect_no_warningtest:project(params, t_max = 9, t_save = 3)is silent.test-project.Rpass.🤖 Generated with Claude Code