code: def test_plot_volume_source_estimates_morph():
      """Test interactive plotting of volume source estimates with morph."""
      pytest.importorskip("nibabel")
      pytest.importorskip("dipy")
      pytest.importorskip("nilearn")
      forward = read_forward_solution(fwd_fname)
      sample_src = forward["src"]
      vertices = [s["vertno"] for s in sample_src]
      n_verts = sum(len(v) for v in vertices)
      n_time = 2
      data = np.random.RandomState(0).rand(n_verts, n_time)
      stc = VolSourceEstimate(data, vertices, 1, 1)
      sample_src[0]["subject_his_id"] = "sample"  # old src
      morph = compute_source_morph(
          sample_src,
          "sample",
          "fsaverage",
          zooms=5,
          subjects_dir=subjects_dir,
      )
      initial_pos = (-0.05, -0.01, -0.006)
      # sometimes get scalars/index warning
      with _record_warnings():
          with catch_logging() as log:
              stc.plot(
                  morph,
                  subjects_dir=subjects_dir,
                  mode="glass_brain",
                  initial_pos=initial_pos,
                  verbose=True,
              )
      log = log.getvalue()
      assert "t = 1.000 s" in log
      assert "(-52.0, -8.0, -7.0) mm" in log
  
      with pytest.raises(ValueError, match="Allowed values are"):
          stc.plot(sample_src, "sample", subjects_dir, mode="abcd")
      vertices.append([])
      surface_stc = SourceEstimate(data, vertices, 1, 1)
      with pytest.raises(
          TypeError, match="an instance of VolSourceEstimate"
      ):
          plot_volume_source_estimates(
              surface_stc, sample_src, "sample", subjects_dir
          )
      with pytest.raises(ValueError, match="Negative colormap limits"):
          stc.plot(
              sample_src,
              "sample",
              subjects_dir,
              clim=dict(lims=[-1, 2, 3], kind="value"),
          )
  
file_path: mne-python/mne/viz/tests/test_3d_mpl.py
imports: import re
  import numpy
  import pytest
  from mne import SourceEstimate, VolSourceEstimate, VolVectorSourceEstimate, compute_covariance, compute_source_morph, make_fixed_length_epochs, make_forward_solution, read_bem_solution, read_forward_solution, read_trans, setup_volume_source_space
  from mne.datasets import testing
  from mne.io import read_raw_fif
  from mne.minimum_norm import apply_inverse, make_inverse_operator
  from mne.utils import _record_warnings, catch_logging
  from mne.viz import plot_volume_source_estimates
  from mne.viz.utils import _fake_click, _fake_keypress
label_desc: Use image node_id 2 for calling a global function with example usage: test_plot_volume_source_estimates_morph() without return types