code: def test_spatio_temporal_cluster_adjacency(numba_conditional):
      """Test spatio-temporal cluster permutations."""
      pytest.importorskip("sklearn")
      from sklearn.feature_extraction.image import grid_to_graph
  
      (
          condition1_1d,
          condition2_1d,
          condition1_2d,
          condition2_2d,
      ) = _get_conditions()
  
      rng = np.random.RandomState(0)
      noise1_2d = rng.randn(
          condition1_2d.shape[0], condition1_2d.shape[1], 10
      )
      data1_2d = np.transpose(
          np.dstack((condition1_2d, noise1_2d)), [0, 2, 1]
      )
  
      noise2_d2 = rng.randn(
          condition2_2d.shape[0], condition2_2d.shape[1], 10
      )
      data2_2d = np.transpose(
          np.dstack((condition2_2d, noise2_d2)), [0, 2, 1]
      )
  
      adj = grid_to_graph(data1_2d.shape[-1], 1)
  
      threshold = dict(start=4.0, step=2)
      (
          T_obs,
          clusters,
          p_values_adj,
          hist,
      ) = spatio_temporal_cluster_test(
          [data1_2d, data2_2d],
          adjacency=adj,
          n_permutations=50,
          tail=1,
          seed=1,
          threshold=threshold,
          buffer_size=None,
      )
  
      buffer_size = data1_2d.size // 10
      (
          T_obs,
          clusters,
          p_values_no_adj,
          hist,
      ) = spatio_temporal_cluster_test(
          [data1_2d, data2_2d],
          n_permutations=50,
          tail=1,
          seed=1,
          threshold=threshold,
          n_jobs=2,
          buffer_size=buffer_size,
      )
  
      assert_equal(
          np.sum(p_values_adj < 0.05), np.sum(p_values_no_adj < 0.05)
      )
  
      # make sure results are the same without buffer_size
      T_obs, clusters, p_values2, hist2 = spatio_temporal_cluster_test(
          [data1_2d, data2_2d],
          n_permutations=50,
          tail=1,
          seed=1,
          threshold=threshold,
          n_jobs=2,
          buffer_size=None,
      )
      assert_array_equal(p_values_no_adj, p_values2)
      pytest.raises(
          ValueError,
          spatio_temporal_cluster_test,
          [data1_2d, data2_2d],
          tail=1,
          threshold=-2.0,
      )
      pytest.raises(
          ValueError,
          spatio_temporal_cluster_test,
          [data1_2d, data2_2d],
          tail=-1,
          threshold=2.0,
      )
      pytest.raises(
          ValueError,
          spatio_temporal_cluster_test,
          [data1_2d, data2_2d],
          tail=0,
          threshold=-1,
      )
  
imports: import os
  from functools import partial
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import linalg, sparse, stats
  from mne import MixedSourceEstimate, SourceEstimate, SourceSpaces, VolSourceEstimate
  from mne.stats import combine_adjacency, ttest_ind_no_p
  from mne.stats.cluster_level import f_oneway, permutation_cluster_1samp_test, permutation_cluster_test, spatio_temporal_cluster_1samp_test, spatio_temporal_cluster_test, summarize_clusters_stc, ttest_1samp_no_p
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 11 for calling a global function with example usage: test_spatio_temporal_cluster_adjacency(numba_conditional) without return types