code: def test_forward_mixed_source_space(tmp_path):
      """Test making the forward solution for a mixed source space."""
      pytest.importorskip("nibabel")
      # get the surface source space
      rng = np.random.RandomState(0)
      surf = read_source_spaces(fname_src)
  
      # setup two volume source spaces
      label_names = get_volume_labels_from_aseg(fname_aseg)
      vol_labels = rng.choice(label_names, 2)
      with pytest.warns(
          RuntimeWarning, match="Found no usable.*CC_Mid_Ant.*"
      ):
          vol1 = setup_volume_source_space(
              "sample",
              pos=20.0,
              mri=fname_aseg,
              volume_label=vol_labels[0],
              add_interpolator=False,
          )
      vol2 = setup_volume_source_space(
          "sample",
          pos=20.0,
          mri=fname_aseg,
          volume_label=vol_labels[1],
          add_interpolator=False,
      )
  
      # merge surfaces and volume
      src = surf + vol1 + vol2
  
      # calculate forward solution
      fwd = make_forward_solution(
          fname_raw, fname_trans, src, fname_bem
      )
      assert repr(fwd)
  
      # extract source spaces
      src_from_fwd = fwd["src"]
  
      # get the coordinate frame of each source space
      coord_frames = np.array([s["coord_frame"] for s in src_from_fwd])
  
      # assert that all source spaces are in head coordinates
      assert (coord_frames == FIFF.FIFFV_COORD_HEAD).all()
  
      # run tests for SourceSpaces.export_volume
      fname_img = tmp_path / "temp-image.mgz"
  
      # head coordinates and mri_resolution, but trans file
      with pytest.raises(
          ValueError, match="trans containing mri to head"
      ):
          src_from_fwd.export_volume(
              fname_img, mri_resolution=True, trans=None
          )
  
      # head coordinates and mri_resolution, but wrong trans file
      vox_mri_t = vol1[0]["vox_mri_t"]
      with pytest.raises(
          ValueError, match="head<->mri, got mri_voxel->mri"
      ):
          src_from_fwd.export_volume(
              fname_img, mri_resolution=True, trans=vox_mri_t
          )
  
imports: from itertools import product
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
  from mne import convert_forward_solution, create_info, get_volume_labels_from_aseg, make_forward_solution, make_sphere_model, pick_info, pick_types, pick_types_forward, read_cov, read_dipole, read_evokeds, read_forward_solution, read_source_spaces, setup_volume_source_space, write_forward_solution
  from mne._fiff.constants import FIFF
  from mne.bem import make_bem_solution, read_bem_surfaces
  from mne.channels import make_standard_montage
  from mne.datasets import testing
  from mne.dipole import Dipole, fit_dipole
  from mne.forward import Forward, _do_forward_solution, use_coil_def
  from mne.forward._compute_forward import _magnetic_dipole_field_vec
  from mne.forward._make_forward import _create_meg_coils, make_forward_dipole
  from mne.forward.tests.test_forward import assert_forward_allclose
  from mne.io import read_info, read_raw_bti, read_raw_fif, read_raw_kit
  from mne.simulation import simulate_evoked
  from mne.source_estimate import VolSourceEstimate
  from mne.source_space._source_space import _compare_source_spaces, setup_source_space, write_source_spaces
  from mne.surface import _get_ico_surface
  from mne.transforms import Transform
  from mne.utils import catch_logging, requires_mne, requires_mne_mark, requires_openmeeg_mark, run_subprocess
label_desc: Use image node_id 14 for calling a global function with example usage: test_forward_mixed_source_space(tmp_path) without return types