code: def test_apply_dics_ori_inv(_load_forward, pick_ori, inversion, idx):
      """Test picking different orientations and inversion modes."""
      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_ = 5 if inversion == "matrix" else 1
      filters = make_dics(
          epochs.info,
          fwd_surf,
          csd,
          label=label,
          reg=reg_,
          pick_ori=pick_ori,
          inversion=inversion,
          depth=None,
          weight_norm="unit-noise-gain",
      )
      power, f = apply_dics_csd(csd, filters)
      assert f == [10, 20]
      dist = _fwd_dist(power, fwd_surf, vertices, source_ind)
      # This is 0. for unit-noise-gain-invariant:
      assert dist <= (0.02 if inversion == "matrix" else 0.0)
      assert power.data[source_ind, 1] > power.data[source_ind, 0]
  
      # Test unit-noise-gain weighting
      csd_noise = csd.copy()
      inds = np.triu_indices(csd.n_channels)
      csd_noise._data[...] = np.eye(csd.n_channels)[inds][:, np.newaxis]
      noise_power, f = apply_dics_csd(csd_noise, filters)
      want_norm = 3 if pick_ori in (None, "vector") else 1
      assert_allclose(noise_power.data, want_norm, atol=1e-7)
  
      # Test filter with forward normalization instead of weight
      # normalization
      filters = make_dics(
          epochs.info,
          fwd_surf,
          csd,
          label=label,
          reg=reg_,
          pick_ori=pick_ori,
          inversion=inversion,
          weight_norm=None,
          depth=1.0,
      )
      power, f = apply_dics_csd(csd, filters)
      assert f == [10, 20]
      dist = _fwd_dist(power, fwd_surf, vertices, source_ind)
      mat_tol = {0: 0.055, 100: 0.20, 200: 0.015, 233: 0.035}[idx]
      max_ = mat_tol if inversion == "matrix" else 0.0
      assert 0 <= dist <= max_
      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 8 for calling a global function with example usage: test_apply_dics_ori_inv(_load_forward, pick_ori, inversion, idx) without return types