code: def _make_surface_mapping(
      info,
      surf,
      ch_type="meg",
      trans=None,
      mode="fast",
      n_jobs=None,
      origin=(0.0, 0.0, 0.04),
      verbose=None,
  ):
      """Re-map M/EEG data to a surface.
  
      Parameters
      ----------
      %(info_not_none)s
      surf : dict
          The surface to map the data to. The required fields are `'rr'`,
          `'nn'`, and `'coord_frame'`. Must be in head coordinates.
      ch_type : str
          Must be either `'meg'` or `'eeg'`, determines the type of field.
      trans : None | dict
          If None, no transformation applied. Should be a Head<->MRI
          transformation.
      mode : str
          Either `'accurate'` or `'fast'`, determines the quality of the
          Legendre polynomial expansion used. `'fast'` should be sufficient
          for most applications.
      %(n_jobs)s
      origin : array-like, shape (3,) | str
          Origin of the sphere in the head coordinate frame and in meters.
          The default is ``'auto'``, which means a head-digitization-based
          origin fit.
      %(verbose)s
  
      Returns
      -------
      mapping : array
          A n_vertices x n_sensors array that remaps the MEG or EEG data,
          as `new_data = np.dot(mapping, data)`.
      """
      if not all(key in surf for key in ["rr", "nn"]):
          raise KeyError('surf must have both "rr" and "nn"')
      if "coord_frame" not in surf:
          raise KeyError(
              "The surface coordinate frame must be specified "
              'in surf["coord_frame"]'
          )
      _check_option("mode", mode, ["accurate", "fast"])
  
      # deal with coordinate frames here -- always go to "head" (easiest)
      orig_surf = surf
      surf = transform_surface_to(deepcopy(surf), "head", trans)
      origin = _check_origin(origin, info)
  
      #
      # Step 1. Prepare the coil definitions
      # Do the dot products, assume surf in head coords
      #
      _check_option("ch_type", ch_type, ["meg", "eeg"])
      if ch_type == "meg":
          picks = pick_types(info, meg=True, eeg=False, ref_meg=False)
          logger.info("Prepare MEG mapping...")
      else:
          picks = pick_types(info, meg=False, eeg=True, ref_meg=False)
          logger.info("Prepare EEG mapping...")
      if len(picks) == 0:
          raise RuntimeError("cannot map, no channels found")
      # XXX this code does not do any checking for compensation channels,
      # but it seems like this must be intentional from the ref_meg=False
      # (presumably from the C code)
      dev_head_t = info["dev_head_t"]
      info = pick_info(_simplify_info(info), picks)
      info["dev_head_t"] = dev_head_t
  
      # create coil defs in head coordinates
      if ch_type == "meg":
          # Put them in head coordinates
          coils = _create_meg_coils(
              info["chs"], "normal", info["dev_head_t"]
          )
          type_str = "coils"
          miss = 1e-4  # Smoothing criterion for MEG
      else:  # EEG
          coils = _create_eeg_els(info["chs"])
          type_str = "electrodes"
          miss = 1e-3  # Smoothing criterion for EEG
  
      #
      # Step 2. Calculate the dot products
      #
      int_rad, noise, lut_fun, n_fact = _setup_dots(
          mode, info, coils, ch_type
      )
      logger.info(
          "Computing dot products for %i %s..." % (len(coils), type_str)
      )
      self_dots = _do_self_dots(
          int_rad,
          False,
          coils,
          origin,
          ch_type,
          lut_fun,
          n_fact,
          n_jobs,
      )
      sel = np.arange(
          len(surf["rr"])
      )  # eventually we should do sub-selection
      logger.info(
          "Computing dot products for %i surface locations..."
          % len(sel)
      )
      surface_dots = _do_surface_dots(
          int_rad,
          False,
          coils,
          surf,
          sel,
          origin,
          ch_type,
          lut_fun,
          n_fact,
          n_jobs,
      )
  
      #
      # Step 4. Return the result
      #
      fmd = dict(
          kind=ch_type,
          surf=surf,
          ch_names=info["ch_names"],
          coils=coils,
          origin=origin,
          noise=noise,
          self_dots=self_dots,
          surface_dots=surface_dots,
          int_rad=int_rad,
          miss=miss,
      )
      logger.info("Field mapping data ready")
  
      fmd["data"] = _compute_mapping_matrix(fmd, info)
      # bring the original back, whatever coord frame it was in
      fmd["surf"] = orig_surf
  
      # Remove some unnecessary fields
      del fmd["self_dots"]
      del fmd["surface_dots"]
      del fmd["int_rad"]
      del fmd["miss"]
      return fmd
  
imports: import inspect
  from copy import deepcopy
  import numpy
  from scipy.interpolate import interp1d
  from .._fiff.constants import FIFF
  from .._fiff.meas_info import _simplify_info
  from .._fiff.pick import pick_info, pick_types
  from .._fiff.proj import _has_eeg_average_ref_proj, make_projector
  from ..bem import _check_origin
  from ..cov import make_ad_hoc_cov
  from ..epochs import BaseEpochs, EpochsArray
  from ..evoked import Evoked, EvokedArray
  from ..fixes import _safe_svd
  from ..surface import get_head_surf, get_meg_helmet_surf
  from ..transforms import _find_trans, _get_trans, transform_surface_to
  from ..utils import _check_fname, _check_option, _pl, _reg_pinv, logger, verbose
  from ._lead_dots import _do_cross_dots, _do_self_dots, _do_surface_dots, _get_legen_table
  from ._make_forward import _create_eeg_els, _create_meg_coils, _read_coil_defs
label_desc: Use image node_id 7 for calling a global function with example usage: _make_surface_mapping(info, surf, ch_type, trans, mode, n_jobs, origin, verbose) and returns: fmd