code: def test_mxne_inverse_sure():
      """Tests SURE criterion for automatic alpha selection on MEG data."""
  
      def data_fun(times):
          data = np.zeros(times.shape)
          data[times >= 0] = 50e-9
          return data
  
      n_dipoles = 2
      raw = mne.io.read_raw_fif(fname_raw)
      info = mne.io.read_info(fname_data)
      with info._unlock():
          info["projs"] = []
      noise_cov = mne.make_ad_hoc_cov(info)
      label_names = ["Aud-lh", "Aud-rh"]
      labels = [
          mne.read_label(
              data_path / "MEG" / "sample" / "labels" / f"{ln}.label"
          )
          for ln in label_names
      ]
      fname_fwd = (
          data_path
          / "MEG"
          / "sample"
          / "sample_audvis_trunc-meg-eeg-oct-4-fwd.fif"
      )
      forward = mne.read_forward_solution(fname_fwd)
      forward = mne.pick_types_forward(
          forward, meg="grad", eeg=False, exclude=raw.info["bads"]
      )
      times = np.arange(100, dtype=np.float64) / raw.info["sfreq"] - 0.1
      stc = simulate_sparse_stc(
          forward["src"],
          n_dipoles=n_dipoles,
          times=times,
          random_state=1,
          labels=labels,
          data_fun=data_fun,
      )
      nave = 30
      evoked = simulate_evoked(
          forward,
          stc,
          info,
          noise_cov,
          nave=nave,
          use_cps=False,
          iir_filter=None,
      )
      evoked = evoked.crop(tmin=0, tmax=10e-3)
      stc_ = mixed_norm(
          evoked,
          forward,
          noise_cov,
          loose=0.9,
          n_mxne_iter=5,
          depth=0.9,
      )
      assert_array_equal(stc_.vertices, stc.vertices)
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less
  import mne
  from mne import convert_forward_solution, read_cov, read_evokeds, read_forward_solution
  from mne.datasets import testing
  from mne.dipole import Dipole
  from mne.inverse_sparse import mixed_norm, tf_mixed_norm
  from mne.inverse_sparse.mxne_inverse import _compute_mxne_sure, _split_gof, make_stc_from_dipoles
  from mne.inverse_sparse.mxne_optim import norm_l2inf
  from mne.label import read_label
  from mne.minimum_norm import apply_inverse, make_inverse_operator
  from mne.minimum_norm.tests.test_inverse import assert_stc_res, assert_var_exp_log
  from mne.simulation import simulate_evoked, simulate_sparse_stc
  from mne.source_estimate import VolSourceEstimate
  from mne.utils import _record_warnings, assert_stcs_equal, catch_logging
label_desc: Use image node_id 7 for calling a global function with example usage: test_mxne_inverse_sure() and returns: data