Skip to content

Instantly share code, notes, and snippets.

@kingjr
Created February 19, 2020 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingjr/90de3691cd62392836493f5d2621e0da to your computer and use it in GitHub Desktop.
Save kingjr/90de3691cd62392836493f5d2621e0da to your computer and use it in GitHub Desktop.
cluster test
def stats(X, n_jobs=-1, seed=0, **kwargs):
from mne.stats import spatio_temporal_cluster_1samp_test
X = np.asarray(X)
if X.ndim==2:
X = X[:, :, None]
_, clusters, c_pv, _ = spatio_temporal_cluster_1samp_test(
X, n_jobs=n_jobs, seed=seed, out_type='mask', **kwargs
)
p_vals = [(mask*p + (mask==0)) for mask, p in zip(clusters, c_pv)
if p < .05]
return np.min(p_vals, axis=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment