code: def _apply_dics(data, filters, info, tmin, tfr=False):
      """Apply DICS spatial filter to data for source reconstruction."""
      if isinstance(data, np.ndarray) and data.ndim == (2 + tfr):
          data = [data]
          one_epoch = True
      else:
          one_epoch = False
  
      Ws = filters["weights"]
      one_freq = len(Ws) == 1
  
      subject = filters["subject"]
      # compatibility with 0.16, add src_type as None if not present:
      filters, warn_text = _check_src_type(filters)
  
      for i, M in enumerate(data):
          if not one_epoch:
              logger.info("Processing epoch : %d" % (i + 1))
  
          # Apply SSPs
          if not tfr:  # save computation, only compute once
              M_w = _proj_whiten_data(M, info["projs"], filters)
  
          stcs = []
          for j, W in enumerate(Ws):
              if tfr:  # must compute for each frequency
                  M_w = _proj_whiten_data(
                      M[:, j], info["projs"], filters
                  )
  
              # project to source space using beamformer weights
              sol = np.dot(W, M_w)
  
              if (
                  filters["is_free_ori"]
                  and filters["pick_ori"] != "vector"
              ):
                  logger.info("combining the current components...")
                  sol = combine_xyz(sol)
  
              tstep = 1.0 / info["sfreq"]
  
              stcs.append(
                  _make_stc(
                      sol,
                      vertices=filters["vertices"],
                      src_type=filters["src_type"],
                      tmin=tmin,
                      tstep=tstep,
                      subject=subject,
                      vector=(filters["pick_ori"] == "vector"),
                      source_nn=filters["source_nn"],
                      warn_text=warn_text,
                  )
              )
          if one_freq:
              yield stcs[0]
          else:
              yield stcs
  
      logger.info("[done]")
  
file_path: mne-python/mne/beamformer/_dics.py
imports: import numpy
  from .._fiff.pick import pick_channels, pick_info
  from ..channels import equalize_channels
  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 ..time_frequency import EpochsTFR
  from ..time_frequency.tfr import _check_tfr_complex
  from ..utils import _check_channels_spatial_filter, _check_one_ch_type, _check_option, _check_rank, _validate_type, logger, verbose, warn
  from ._compute_beamformer import Beamformer, _check_src_type, _compute_beamformer, _compute_power, _prepare_beamformer_input, _proj_whiten_data
label_desc: Use image node_id 3 for calling a global function with example usage: _apply_dics(data, filters, info, tmin, tfr) without return types