code: def test_apply_inverse_sphere(evoked, tmp_path):
      """Test applying an inverse with a sphere model (rank-deficient)."""
      evoked.pick(evoked.ch_names[:306:8])
      with evoked.info._unlock():
          evoked.info["projs"] = []
      cov = make_ad_hoc_cov(evoked.info)
      sphere = make_sphere_model("auto", "auto", evoked.info)
      fwd = read_forward_solution(fname_fwd)
      vertices = [
          fwd["src"][0]["vertno"][::5],
          fwd["src"][1]["vertno"][::5],
      ]
      stc = SourceEstimate(
          np.zeros((sum(len(v) for v in vertices), 1)),
          vertices,
          0.0,
          1.0,
      )
      fwd = restrict_forward_to_stc(fwd, stc)
      fwd = make_forward_solution(
          evoked.info,
          fwd["mri_head_t"],
          fwd["src"],
          sphere,
          mindist=5.0,
      )
      evoked = EvokedArray(fwd["sol"]["data"].copy(), evoked.info)
      assert fwd["sol"]["nrow"] == 39
      assert fwd["nsource"] == 101
      assert fwd["sol"]["ncol"] == 303
      temp_fname = tmp_path / "temp-inv.fif"
      inv = make_inverse_operator(evoked.info, fwd, cov, loose=1.0)
      # This forces everything to be float32
      write_inverse_operator(temp_fname, inv)
      inv = read_inverse_operator(temp_fname)
      stc = apply_inverse(
          evoked, inv, method="eLORETA", method_params=dict(eps=1e-2)
      )
      # assert zero localization bias
      assert_array_equal(
          np.argmax(stc.data, axis=0), np.repeat(np.arange(101), 3)
      )
  
imports: import copy
  import re
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_equal
  from scipy import sparse
  import mne
  from mne import Covariance, EvokedArray, SourceEstimate, combine_evoked, compute_raw_covariance, convert_forward_solution, make_ad_hoc_cov, make_forward_solution, make_sphere_model, pick_channels_forward, pick_types, pick_types_forward, read_cov, read_evokeds, read_forward_solution
  from mne.datasets import testing
  from mne.epochs import Epochs, EpochsArray, make_fixed_length_epochs
  from mne.event import read_events
  from mne.forward import apply_forward, is_fixed_orient, restrict_forward_to_stc
  from mne.io import read_info, read_raw_fif
  from mne.label import label_sign_flip, read_label
  from mne.minimum_norm import INVERSE_METHODS, apply_inverse, apply_inverse_cov, apply_inverse_epochs, apply_inverse_raw, apply_inverse_tfr_epochs, compute_rank_inverse, make_inverse_operator, prepare_inverse_operator, read_inverse_operator, write_inverse_operator
  from mne.source_estimate import VolSourceEstimate, read_source_estimate
  from mne.source_space._source_space import _get_src_nn
  from mne.surface import _normal_orth
  from mne.time_frequency import EpochsTFR
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 12 for calling a global function with example usage: test_apply_inverse_sphere(evoked, tmp_path) without return types