Skip to content

Raise warning and errors when np.nan provided to mne.stats.permutation_t_test().#13813

Open
1himan wants to merge 5 commits intomne-tools:mainfrom
1himan:issue-13767
Open

Raise warning and errors when np.nan provided to mne.stats.permutation_t_test().#13813
1himan wants to merge 5 commits intomne-tools:mainfrom
1himan:issue-13767

Conversation

@1himan
Copy link
Copy Markdown
Contributor

@1himan 1himan commented Apr 5, 2026

Reference issue (if any)

What does this implement/fix?

Fixes #13767.

Additional information

Not sure if msg should always be equal to "to be plotted". In this case we might wanna tell the user that there's something wrong with the data - f"Some of the values in {data} are NaN."? In that case we want to improve the msg param as well.

Copy link
Copy Markdown
Contributor

@nordme nordme left a comment

Choose a reason for hiding this comment

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

Hi @1himan ! Thanks for the PR!

Looks good to me generally -- just a small suggestion to improve the warning message for the permutations t-test users since verbiage about plotting would be confusing!

Comment thread mne/stats/permutations.py
"""
from .cluster_level import _get_1samp_orders

_check_if_nan(X)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
_check_if_nan(X)
_check_if_nan(X, msg="in the data array for permutations testing")

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.

np.nan in mne.stats.permutation_t_test fails silently

2 participants