code: def _apply_lcmv(data, filters, info, tmin):
      """Apply LCMV spatial filter to data for source reconstruction."""
      if isinstance(data, np.ndarray) and data.ndim == 2:
          data = [data]
          return_single = True
      else:
          return_single = False
  
      W = filters["weights"]
  
      for i, M in enumerate(data):
          if len(M) != len(filters["ch_names"]):
              raise ValueError(
                  "data and picks must have the same length"
              )
  
          if not return_single:
              logger.info("Processing epoch : %d" % (i + 1))
  
          M = _proj_whiten_data(M, info["projs"], filters)
  
          # project to source space using beamformer weights
          vector = False
          if filters["is_free_ori"]:
              sol = np.dot(W, M)
              if filters["pick_ori"] == "vector":
                  vector = True
              else:
                  logger.info("combining the current components...")
                  sol = combine_xyz(sol)
          else:
              # Linear inverse: do computation here or delayed
              if (
                  M.shape[0] < W.shape[0]
                  and filters["pick_ori"] != "max-power"
              ):
                  sol = (W, M)
              else:
                  sol = np.dot(W, M)
  
          tstep = 1.0 / info["sfreq"]
  
          # compatibility with 0.16, add src_type as None if not present:
          filters, warn_text = _check_src_type(filters)
  
          yield _make_stc(
              sol,
              vertices=filters["vertices"],
              tmin=tmin,
              tstep=tstep,
              subject=filters["subject"],
              vector=vector,
              source_nn=filters["source_nn"],
              src_type=filters["src_type"],
              warn_text=warn_text,
          )
  
      logger.info("[done]")
  
file_path: mne-python/mne/beamformer/_lcmv.py
imports: import numpy
  from .._fiff.meas_info import _simplify_info
  from .._fiff.pick import pick_channels_cov, pick_info
  from ..forward import _subject_from_forward
  from ..minimum_norm.inverse import _check_depth, _check_reference, combine_xyz
  from ..rank import compute_rank
  from ..source_estimate import _get_src_type, _make_stc
  from ..utils import _check_channels_spatial_filter, _check_info_inv, _check_one_ch_type, logger, verbose
  from ._compute_beamformer import Beamformer, _check_src_type, _compute_beamformer, _compute_power, _prepare_beamformer_input, _proj_whiten_data
label_desc: Use image node_id 2 for calling a global function with example usage: _apply_lcmv(data, filters, info, tmin) without return types