code: def test_gamma_map_standard():
      """Test Gamma MAP inverse."""
      forward = read_forward_solution(fname_fwd)
      forward = convert_forward_solution(forward, surf_ori=True)
  
      forward = pick_types_forward(forward, meg=False, eeg=True)
      evoked = read_evokeds(
          fname_evoked, condition=0, baseline=(None, 0), proj=False
      )
      evoked.resample(50, npad=100)
      evoked.crop(tmin=0.1, tmax=0.14)  # crop to window around peak
  
      cov = read_cov(fname_cov)
      cov = regularize(cov, evoked.info, rank=None)
  
      alpha = 0.5
      with catch_logging() as log:
          stc = gamma_map(
              evoked,
              forward,
              cov,
              alpha,
              tol=1e-4,
              xyz_same_gamma=True,
              update_mode=1,
              verbose=True,
          )
      _check_stc(stc, evoked, 68477, "lh", fwd=forward)
      assert_var_exp_log(log.getvalue(), 20, 22)
  
      with catch_logging() as log:
          stc_vec, res = gamma_map(
              evoked,
              forward,
              cov,
              alpha,
              tol=1e-4,
              xyz_same_gamma=True,
              update_mode=1,
              pick_ori="vector",
              return_residual=True,
              verbose=True,
          )
      assert_var_exp_log(log.getvalue(), 20, 22)
      assert_stcs_equal(stc_vec.magnitude(), stc)
      _check_stc(stc_vec, evoked, 68477, "lh", fwd=forward, res=res)
  
      stc, res = gamma_map(
          evoked,
          forward,
          cov,
          alpha,
          tol=1e-4,
          xyz_same_gamma=False,
          update_mode=1,
          pick_ori="vector",
          return_residual=True,
      )
      _check_stc(
          stc,
          evoked,
          82010,
          "lh",
          fwd=forward,
          dist_limit=6.0,
          ratio=2.0,
          res=res,
      )
  
      with catch_logging() as log:
          dips = gamma_map(
              evoked,
              forward,
              cov,
              alpha,
              tol=1e-4,
              xyz_same_gamma=False,
              update_mode=1,
              return_as_dipoles=True,
              verbose=True,
          )
      exp_var = assert_var_exp_log(log.getvalue(), 58, 60)
      dip_exp_var = np.mean(sum(dip.gof for dip in dips))
      assert_allclose(
          exp_var, dip_exp_var, atol=10
      )  # not really equiv, close
      assert isinstance(dips[0], Dipole)
      stc_dip = make_stc_from_dipoles(dips, forward["src"])
      assert_stcs_equal(stc.magnitude(), stc_dip)
  
      # force fixed orientation
      stc, res = gamma_map(
          evoked,
          forward,
          cov,
          alpha,
          tol=1e-4,
          xyz_same_gamma=False,
          update_mode=2,
          loose=0,
          return_residual=True,
      )
      _check_stc(
          stc, evoked, 85739, "lh", fwd=forward, ratio=20.0, res=res
      )
  
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 2 for calling a global function with example usage: test_gamma_map_standard() without return types