code: def test_rap_music_simulated():
      """Test RAP-MUSIC with simulated evoked."""
      evoked, noise_cov = _get_data(ch_decim=16)
      forward = mne.read_forward_solution(fname_fwd)
      forward = mne.pick_channels_forward(forward, evoked.ch_names)
      forward_surf_ori = mne.convert_forward_solution(
          forward, surf_ori=True
      )
      forward_fixed = mne.convert_forward_solution(
          forward, force_fixed=True, surf_ori=True, use_cps=True
      )
  
      n_dipoles = 2
      sim_evoked, stc = simu_data(
          evoked,
          forward_fixed,
          noise_cov,
          n_dipoles,
          evoked.times,
          nave=evoked.nave,
      )
      # Check dipoles for fixed ori
      with catch_logging() as log:
          dipoles = rap_music(
              sim_evoked,
              forward_fixed,
              noise_cov,
              n_dipoles=n_dipoles,
              verbose=True,
          )
      assert_var_exp_log(log.getvalue(), 89, 91)
      _check_dipoles(dipoles, forward_fixed, stc, sim_evoked)
      assert 97 < dipoles[0].gof.max() < 100
      assert 91 < dipoles[1].gof.max() < 93
      assert dipoles[0].gof.min() >= 0.0
  
      nave = (
          100000  # add a tiny amount of noise to the simulated evokeds
      )
      sim_evoked, stc = simu_data(
          evoked,
          forward_fixed,
          noise_cov,
          n_dipoles,
          evoked.times,
          nave=nave,
      )
      dipoles, residual = rap_music(
          sim_evoked,
          forward_fixed,
          noise_cov,
          n_dipoles=n_dipoles,
          return_residual=True,
      )
      _check_dipoles(dipoles, forward_fixed, stc, sim_evoked, residual)
  
      # Check dipoles for free ori
      dipoles, residual = rap_music(
          sim_evoked,
          forward,
          noise_cov,
          n_dipoles=n_dipoles,
          return_residual=True,
      )
      _check_dipoles(dipoles, forward_fixed, stc, sim_evoked, residual)
  
      # Check dipoles for free surface ori
      dipoles, residual = rap_music(
          sim_evoked,
          forward_surf_ori,
          noise_cov,
          n_dipoles=n_dipoles,
          return_residual=True,
      )
      _check_dipoles(dipoles, forward_fixed, stc, sim_evoked, residual)
  
file_path: mne-python/mne/beamformer/tests/test_rap_music.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy import linalg
  import mne
  from mne.beamformer import rap_music, trap_music
  from mne.cov import regularize
  from mne.datasets import testing
  from mne.minimum_norm.tests.test_inverse import assert_var_exp_log
  from mne.utils import catch_logging
label_desc: Use image node_id 4 for calling a global function with example usage: test_rap_music_simulated() without return types