code: def permutation_cluster_1samp_test(
      X,
      threshold=None,
      n_permutations=1024,
      tail=0,
      stat_fun=None,
      adjacency=None,
      n_jobs=None,
      seed=None,
      max_step=1,
      exclude=None,
      step_down_p=0,
      t_power=1,
      out_type="indices",
      check_disjoint=False,
      buffer_size=1000,
      verbose=None,
  ):
      """Non-parametric cluster-level paired t-test.
  
      For details, see :footcite:p:`MarisOostenveld2007,Sassenhagen2019`.
  
      Parameters
      ----------
      X : array, shape (n_observations, p[, q][, r])
          The data to be clustered. The first dimension should correspond to the
          difference between paired samples (observations) in two conditions.
          The subarrays ``X[k]`` can be 1D (e.g., time series), 2D (e.g.,
          time series over channels), or 3D (e.g., time-frequencies over
          channels) associated with the kth observation. For spatiotemporal data,
          see also :func:`mne.stats.spatio_temporal_cluster_1samp_test`.
      %(threshold_clust_t)s
      %(n_permutations_clust_all)s
      %(tail_clust)s
      %(stat_fun_clust_t)s
      %(adjacency_clust_1)s
      %(n_jobs)s
      %(seed)s
      %(max_step_clust)s
      %(exclude_clust)s
      %(step_down_p_clust)s
      %(t_power_clust)s
      %(out_type_clust)s
      %(check_disjoint_clust)s
      %(buffer_size_clust)s
      %(verbose)s
  
      Returns
      -------
      t_obs : array, shape (p[, q][, r])
          T-statistic observed for all variables.
      clusters : list
          List type defined by out_type above.
      cluster_pv : array
          P-value for each cluster.
      H0 : array, shape (n_permutations,)
          Max cluster level stats observed under permutation.
  
      Notes
      -----
      From an array of paired observations, e.g. a difference in signal
      amplitudes or power spectra in two conditions, calculate if the data
      distributions in the two conditions are significantly different.
      The procedure uses a cluster analysis with permutation test
      for calculating corrected p-values. Randomized data are generated with
      random sign flips. See :footcite:`MarisOostenveld2007` for more
      information.
  
      Because a 1-sample t-test on the difference in observations is
      mathematically equivalent to a paired t-test, internally this function
      computes a 1-sample t-test (by default) and uses sign flipping (always)
      to perform permutations. This might not be suitable for the case where
      there is truly a single observation under test; see :ref:`disc-stats`.
      %(threshold_clust_t_notes)s
  
      If ``n_permutations`` exceeds the maximum number of possible permutations
      given the number of observations, then ``n_permutations`` and ``seed``
      will be ignored since an exact test (full permutation test) will be
      performed (this is the case when
      ``n_permutations >= 2 ** (n_observations - (tail == 0))``).
  
      If no initial clusters are found because all points in the true
      distribution are below the threshold, then ``clusters``, ``cluster_pv``,
      and ``H0`` will all be empty arrays.
  
      References
      ----------
      .. footbibliography::
      """
      stat_fun, threshold = _check_fun(X, stat_fun, threshold, tail)
      return _permutation_cluster_test(
          X=[X],
          threshold=threshold,
          n_permutations=n_permutations,
          tail=tail,
          stat_fun=stat_fun,
          adjacency=adjacency,
          n_jobs=n_jobs,
          seed=seed,
          max_step=max_step,
          exclude=exclude,
          step_down_p=step_down_p,
          t_power=t_power,
          out_type=out_type,
          check_disjoint=check_disjoint,
          buffer_size=buffer_size,
      )
  
imports: import numpy
  from scipy import ndimage, sparse
  from scipy.sparse.csgraph import connected_components
  from scipy.stats import f
  from scipy.stats import t
  from ..fixes import has_numba, jit
  from ..parallel import parallel_func
  from ..source_estimate import MixedSourceEstimate, SourceEstimate, VolSourceEstimate
  from ..source_space import SourceSpaces
  from ..utils import ProgressBar, _check_option, _pl, _validate_type, check_random_state, logger, split_list, verbose, warn
  from .parametric import f_oneway, ttest_1samp_no_p
label_desc: Use image node_id 27 for calling a global function with example usage: permutation_cluster_1samp_test(X, threshold, n_permutations, tail, stat_fun, adjacency, n_jobs, seed, max_step, exclude, step_down_p, t_power, out_type, check_disjoint, buffer_size, verbose) and returns: _permutation_cluster_test