code: def test_real(_load_forward, idx):
      """Test using a real-valued filter."""
      fwd_free, fwd_surf, fwd_fixed, fwd_vol = _load_forward
      (
          epochs,
          _,
          csd,
          source_vertno,
          label,
          vertices,
          source_ind,
      ) = _simulate_data(fwd_fixed, idx)
      epochs.pick(picks="grad")
      reg = 1  # Lots of regularization for our toy dataset
      filters_real = make_dics(
          epochs.info,
          fwd_surf,
          csd,
          label=label,
          reg=reg,
          real_filter=True,
          inversion="single",
      )
      # Also test here that no warnings are thrown - implemented to check whether
      # src should not be None warning occurs:
      power, f = apply_dics_csd(csd, filters_real)
  
      assert f == [10, 20]
      dist = _fwd_dist(power, fwd_surf, vertices, source_ind)
      assert dist == 0
      assert power.data[source_ind, 1] > power.data[source_ind, 0]
  
      # Test rank reduction
      filters_real = make_dics(
          epochs.info,
          fwd_surf,
          csd,
          label=label,
          reg=5,
          pick_ori="max-power",
          inversion="matrix",
          reduce_rank=True,
      )
      power, f = apply_dics_csd(csd, filters_real)
      assert f == [10, 20]
      dist = _fwd_dist(power, fwd_surf, vertices, source_ind)
      assert dist == 0
      assert power.data[source_ind, 1] > power.data[source_ind, 0]
  
      # Test computing source power on a volume source space
      filters_vol = make_dics(
          epochs.info, fwd_vol, csd, reg=reg, inversion="single"
      )
      power, f = apply_dics_csd(csd, filters_vol)
      vol_source_ind = _nearest_vol_ind(
          fwd_vol, fwd_surf, vertices, source_ind
      )
      assert f == [10, 20]
      dist = _fwd_dist(
          power, fwd_vol, fwd_vol["src"][0]["vertno"], vol_source_ind
      )
      vol_tols = {100: 0.008, 200: 0.008}
      assert dist <= vol_tols.get(idx, 0.0)
      assert (
          power.data[vol_source_ind, 1] > power.data[vol_source_ind, 0]
      )
  
      # check whether a filters object without src_type throws expected warning
      del filters_vol[
          "src_type"
      ]  # emulate 0.16 behaviour to cause warning
      with pytest.warns(
          RuntimeWarning,
          match="spatial filter does not contain " "src_type",
      ):
          apply_dics_csd(csd, filters_vol)
  
imports: import copy
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
  import mne
  from mne import pick_types
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import pick_info
  from mne.beamformer import Beamformer, apply_dics, apply_dics_csd, apply_dics_epochs, apply_dics_tfr_epochs, make_dics, read_beamformer
  from mne.beamformer._compute_beamformer import _prepare_beamformer_input
  from mne.beamformer._dics import _prepare_noise_csd
  from mne.beamformer.tests.test_lcmv import _assert_weight_norm
  from mne.datasets import testing
  from mne.io import read_info
  from mne.proj import compute_proj_evoked, make_projector
  from mne.surface import _compute_nearest
  from mne.time_frequency import CrossSpectralDensity, EpochsTFR, csd_morlet, csd_tfr
  from mne.time_frequency.csd import _sym_mat_to_vector
  from mne.transforms import apply_trans, invert_transform
  from mne.utils import catch_logging, object_diff
label_desc: Use image node_id 10 for calling a global function with example usage: test_real(_load_forward, idx) without return types