code: def _check_stc(
      stc,
      evoked,
      idx,
      hemi,
      fwd,
      dist_limit=0.0,
      ratio=50.0,
      res=None,
      atol=1e-20,
  ):
      """Check correctness."""
      assert_array_almost_equal(stc.times, evoked.times, 5)
      stc_orig = stc
      if isinstance(stc, VectorSourceEstimate):
          assert (
              stc.data.any(1).any(1).all()
          )  # all dipoles should have some
          stc = stc.magnitude()
      amps = np.sum(stc.data**2, axis=1)
      order = np.argsort(amps)[::-1]
      amps = amps[order]
      verts = np.concatenate(stc.vertices)[order]
      hemi_idx = int(order[0] >= len(stc.vertices[1]))
      hemis = ["lh", "rh"]
      assert hemis[hemi_idx] == hemi
      dist = (
          np.linalg.norm(
              np.diff(
                  fwd["src"][hemi_idx]["rr"][[idx, verts[0]]], axis=0
              )[0]
          )
          * 1000.0
      )
      assert dist <= dist_limit
      assert amps[0] > ratio * amps[1]
      if res is not None:
          assert_stc_res(evoked, stc_orig, fwd, res, atol=atol)
  
file_path: mne-python/mne/inverse_sparse/tests/test_gamma_map.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal
  import mne
  from mne import VectorSourceEstimate, convert_forward_solution, pick_types_forward, read_cov, read_evokeds, read_forward_solution
  from mne.cov import regularize
  from mne.datasets import testing
  from mne.dipole import Dipole
  from mne.inverse_sparse import gamma_map
  from mne.inverse_sparse.mxne_inverse import make_stc_from_dipoles
  from mne.minimum_norm.tests.test_inverse import assert_stc_res, assert_var_exp_log
  from mne.utils import assert_stcs_equal, catch_logging
label_desc: Use image node_id 1 for calling a global function with example usage: _check_stc(stc, evoked, idx, hemi, fwd, dist_limit, ratio, res, atol) without return types