From dda5c4c7a72228e91021ea8c52003132c2396377 Mon Sep 17 00:00:00 2001 From: athishdresu Date: Sat, 21 Mar 2026 22:31:46 +0530 Subject: [PATCH 1/5] DOC: clarify that min neighbors for clusters is 0 in permutation_cluster_test --- mne/stats/cluster_level.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py index eb887e74a7d..234ca85e8a8 100644 --- a/mne/stats/cluster_level.py +++ b/mne/stats/cluster_level.py @@ -909,6 +909,9 @@ def _permutation_cluster_test( Note. X is required to be a list. Depending on the length of X either a 1 sample t-test or an F test / more sample permutation scheme is elicited. + Note: By default, the minimum number of neighboring points (e.g., channels) + required to form a cluster is 0. This means a single significant point can technically + constitute a cluster. """ _check_option("out_type", out_type, ["mask", "indices"]) _check_option("tail", tail, [-1, 0, 1]) From f8a9bea0164a1664960996969d9de5c843a05c03 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 17:14:47 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne/stats/cluster_level.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py index 234ca85e8a8..e1031513c2a 100644 --- a/mne/stats/cluster_level.py +++ b/mne/stats/cluster_level.py @@ -910,7 +910,7 @@ def _permutation_cluster_test( either a 1 sample t-test or an F test / more sample permutation scheme is elicited. Note: By default, the minimum number of neighboring points (e.g., channels) - required to form a cluster is 0. This means a single significant point can technically + required to form a cluster is 0. This means a single significant point can technically constitute a cluster. """ _check_option("out_type", out_type, ["mask", "indices"]) From a68e8ec045df0604a70152675780baf66d97ccb3 Mon Sep 17 00:00:00 2001 From: Athish M Date: Sun, 22 Mar 2026 14:39:46 +0530 Subject: [PATCH 3/5] FIX: break long line to pass ruff linting --- mne/stats/cluster_level.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py index 234ca85e8a8..c1ffcf45013 100644 --- a/mne/stats/cluster_level.py +++ b/mne/stats/cluster_level.py @@ -909,8 +909,10 @@ def _permutation_cluster_test( Note. X is required to be a list. Depending on the length of X either a 1 sample t-test or an F test / more sample permutation scheme is elicited. - Note: By default, the minimum number of neighboring points (e.g., channels) - required to form a cluster is 0. This means a single significant point can technically + Note: By default, the minimum number of + neighboring points (e.g., channels) + required to form a cluster is 0. This means a + single significant point can technically constitute a cluster. """ _check_option("out_type", out_type, ["mask", "indices"]) From bad37de7f7fb5560ed89be835bb2f946314dfb50 Mon Sep 17 00:00:00 2001 From: Athish M Date: Tue, 24 Mar 2026 21:48:17 +0530 Subject: [PATCH 4/5] MRG: move note to public functions and add changelog --- doc/changes/dev/13774.other.rst | 1 + mne/stats/cluster_level.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 doc/changes/dev/13774.other.rst diff --git a/doc/changes/dev/13774.other.rst b/doc/changes/dev/13774.other.rst new file mode 100644 index 00000000000..65d7df43157 --- /dev/null +++ b/doc/changes/dev/13774.other.rst @@ -0,0 +1 @@ +- Clarify that the default minimum number of neighbors for clusters is 0 in :func:`mne.stats.permutation_cluster_test` and :func:`mne.stats.spatio_temporal_cluster_test`, by `Athish M`_. \ No newline at end of file diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py index 3cff4bbcb96..51260b5dac7 100644 --- a/mne/stats/cluster_level.py +++ b/mne/stats/cluster_level.py @@ -909,11 +909,6 @@ def _permutation_cluster_test( Note. X is required to be a list. Depending on the length of X either a 1 sample t-test or an F test / more sample permutation scheme is elicited. - Note: By default, the minimum number of - neighboring points (e.g., channels) - required to form a cluster is 0. This means - a single significant point can technically - constitute a cluster. """ _check_option("out_type", out_type, ["mask", "indices"]) _check_option("tail", tail, [-1, 0, 1]) @@ -1248,6 +1243,10 @@ def permutation_cluster_test( References ---------- .. footbibliography:: + Note: By default, the minimum number of neighboring + points (e.g., channels) required to form a cluster is 0. + This means a single significant point can + technically constitute a cluster. """ stat_fun, threshold = _check_fun(X, stat_fun, threshold, tail, "between") return _permutation_cluster_test( @@ -1548,6 +1547,10 @@ def spatio_temporal_cluster_test( References ---------- .. footbibliography:: + Note: By default, the minimum number of neighboring + points (e.g., channels) required to form a cluster is 0. + This means a single significant point can + technically constitute a cluster. """ # convert spatial_exclude before passing on if necessary if spatial_exclude is not None: From 60677d8383a5adcbafb8127af567cce47f2e6b4f Mon Sep 17 00:00:00 2001 From: Athish M Date: Tue, 31 Mar 2026 21:30:42 +0530 Subject: [PATCH 5/5] DOC: move notes to correct section --- mne/stats/cluster_level.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py index 51260b5dac7..b2c8c4aad39 100644 --- a/mne/stats/cluster_level.py +++ b/mne/stats/cluster_level.py @@ -1239,14 +1239,14 @@ def permutation_cluster_test( Notes ----- %(threshold_clust_f_notes)s - - References - ---------- - .. footbibliography:: Note: By default, the minimum number of neighboring points (e.g., channels) required to form a cluster is 0. This means a single significant point can technically constitute a cluster. + + References + ---------- + .. footbibliography:: """ stat_fun, threshold = _check_fun(X, stat_fun, threshold, tail, "between") return _permutation_cluster_test( @@ -1543,14 +1543,14 @@ def spatio_temporal_cluster_test( Notes ----- %(threshold_clust_f_notes)s - - References - ---------- - .. footbibliography:: Note: By default, the minimum number of neighboring points (e.g., channels) required to form a cluster is 0. This means a single significant point can technically constitute a cluster. + + References + ---------- + .. footbibliography:: """ # convert spatial_exclude before passing on if necessary if spatial_exclude is not None: