Repository navigation
Fix stats permutation bugs - #14482
Merged
Merged
Conversation
Co-authored-by: Cora Kim <kimjico@gmail.com>
drammock
reviewed
Nov 2, 2026
drammock
approved these changes
Nov 2, 2026
| def _t_max(T, tail): | ||
| """Get the t-max statistic in the direction(s) of the tail.""" | ||
| T = np.abs(T) if tail == 0 else T * tail # tail == -1 -> positive for min(T) | ||
| return np.max(T, axis=-1) |
Member
There was a problem hiding this comment.
IIUC, this preserves the prior behavior of always returning a positive value, even if the most extreme T-value is negative. Would either of these changes make things easier to maintain?
- changing name from
_max_statto_most_extreme_stator similar (likewise for_t_max)? - returning a signed extremum, and adapting the logic of the consuming code?
Member
Author
There was a problem hiding this comment.
Yeah I think that's cleaner, pushed!
Co-authored-by: Daniel McCloy <dan@mccloy.info>
drammock
approved these changes
Nov 2, 2026
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.
Closes #14479
Closes #12216
Closes #11511
Okay this one was a pain.
n_permutations="all"in the cluster permutation tests does not run the full exact test #14479abswhen we actually needed to pick either the min or max depending ontailHas co-author trailer since this was WIP in #12216 (thanks @kimcoco !)
Diagnosed and code changes drafted with Claude Opus 5.5, I reviewed the code in depth. I also had it run equivalence tests with FieldTrip (installed locally as well) as extra insurance that we're hopefully doing things correctly now. 😅