code: def test_lcmv_fieldtrip(
      _get_bf_data, bf_type, weight_norm, pick_ori, pwr
  ):
      """Test LCMV vs fieldtrip output."""
      pymatreader = pytest.importorskip("pymatreader")
  
      evoked, data_cov, fwd = _get_bf_data
  
      # run the MNE-Python beamformer
      filters = make_lcmv(
          evoked.info,
          fwd,
          data_cov=data_cov,
          noise_cov=None,
          pick_ori=pick_ori,
          reg=0.05,
          weight_norm=weight_norm,
      )
      if pwr:
          stc_mne = apply_lcmv_cov(data_cov, filters)
      else:
          stc_mne = apply_lcmv(evoked, filters)
  
      # load the FieldTrip output
      ft_fname = ft_data_path / ("ft_source_" + bf_type + "-vol.mat")
      stc_ft_data = pymatreader.read_mat(ft_fname)["stc"]
      if stc_ft_data.ndim == 1:
          stc_ft_data.shape = (stc_ft_data.size, 1)
  
      if stc_mne.data.ndim == 2:
          signs = np.sign(
              (stc_mne.data * stc_ft_data).sum(-1, keepdims=True)
          )
          if pwr:
              assert_array_equal(signs, 1.0)
          stc_mne.data *= signs
      assert stc_ft_data.shape == stc_mne.data.shape
      if pick_ori == "vector":
          # compare norms first
          assert_allclose(
              np.linalg.norm(stc_mne.data, axis=1),
              np.linalg.norm(stc_ft_data, axis=1),
              rtol=1e-6,
          )
      assert_allclose(stc_mne.data, stc_ft_data, rtol=1e-6)
  
file_path: mne-python/mne/beamformer/tests/test_external.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from scipy.io import savemat
  import mne
  from mne.beamformer import apply_lcmv, apply_lcmv_cov, make_lcmv
  from mne.beamformer.tests.test_lcmv import _get_data
  from mne.datasets import testing
label_desc: Use image node_id 2 for calling a global function with example usage: test_lcmv_fieldtrip(_get_bf_data, bf_type, weight_norm, pick_ori, pwr) without return types