code: def test_apply_dics_csd(_load_forward, idx, inversion, weight_norm):
      """Test applying a DICS beamformer to a CSD matrix."""
      fwd_free, fwd_surf, fwd_fixed, _ = _load_forward
      (
          epochs,
          _,
          csd,
          source_vertno,
          label,
          vertices,
          source_ind,
      ) = _simulate_data(fwd_fixed, idx)
      reg = 1  # Lots of regularization for our toy dataset
  
      with pytest.raises(ValueError, match="several sensor types"):
          make_dics(epochs.info, fwd_free, csd)
      epochs.pick(picks="grad")
  
      # Try different types of forward models
      assert label.hemi == "lh"
      for fwd in [fwd_free, fwd_surf, fwd_fixed]:
          filters = make_dics(
              epochs.info,
              fwd,
              csd,
              label=label,
              reg=reg,
              inversion=inversion,
              weight_norm=weight_norm,
          )
          power, f = apply_dics_csd(csd, filters)
          assert f == [10, 20]
  
          # Did we find the true source at 20 Hz?
          dist = _fwd_dist(power, fwd_free, vertices, source_ind)
          assert dist == 0.0
  
          # Is the signal stronger at 20 Hz than 10?
          assert power.data[source_ind, 1] > power.data[source_ind, 0]
  
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 7 for calling a global function with example usage: test_apply_dics_csd(_load_forward, idx, inversion, weight_norm) without return types