code: def test_gamma_map_vol_sphere():
      """Gamma MAP with a sphere forward and volumic source space."""
      evoked = read_evokeds(
          fname_evoked, condition=0, baseline=(None, 0), proj=False
      )
      evoked.resample(50, npad=100)
      evoked.crop(tmin=0.1, tmax=0.16)  # crop to window around peak
  
      cov = read_cov(fname_cov)
      cov = regularize(cov, evoked.info, rank=None)
  
      info = evoked.info
      sphere = mne.make_sphere_model(
          r0=(0.0, 0.0, 0.0), head_radius=0.080
      )
      src = mne.setup_volume_source_space(
          subject=None,
          pos=30.0,
          mri=None,
          sphere=(0.0, 0.0, 0.0, 0.08),
          bem=None,
          mindist=5.0,
          exclude=2.0,
          sphere_units="m",
      )
      fwd = mne.make_forward_solution(
          info, trans=None, src=src, bem=sphere, eeg=False, meg=True
      )
  
      alpha = 0.5
      stc = gamma_map(
          evoked,
          fwd,
          cov,
          alpha,
          tol=1e-4,
          xyz_same_gamma=False,
          update_mode=2,
          return_residual=False,
      )
      assert_array_almost_equal(stc.times, evoked.times, 5)
  
      # Computing inverse with restricted orientations should also work, since
      # we have a discrete source space.
      stc = gamma_map(
          evoked, fwd, cov, alpha, loose=0.2, return_residual=False
      )
      assert_array_almost_equal(stc.times, evoked.times, 5)
  
      # Compare orientation obtained using fit_dipole and gamma_map
      # for a simulated evoked containing a single dipole
      stc = mne.VolSourceEstimate(
          50e-9 * np.random.RandomState(42).randn(1, 4),
          vertices=[stc.vertices[0][:1]],
          tmin=stc.tmin,
          tstep=stc.tstep,
      )
      evoked_dip = mne.simulation.simulate_evoked(
          fwd, stc, info, cov, nave=1e9, use_cps=True
      )
  
      dip_gmap = gamma_map(
          evoked_dip, fwd, cov, 0.1, return_as_dipoles=True
      )
  
      amp_max = [np.max(d.amplitude) for d in dip_gmap]
      dip_gmap = dip_gmap[np.argmax(amp_max)]
      assert dip_gmap[0].pos[0] in src[0]["rr"][stc.vertices[0]]
  
      dip_fit = mne.fit_dipole(evoked_dip, cov, sphere)[0]
      assert np.abs(np.dot(dip_fit.ori[0], dip_gmap.ori[0])) > 0.99
  
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 3 for calling a global function with example usage: test_gamma_map_vol_sphere() without return types