code: def _merge_ch_data(data, ch_type, names, method="rms"):
      """Merge data from channel pairs.
  
      Parameters
      ----------
      data : array, shape = (n_channels, ..., n_times)
          Data for channels, ordered in pairs.
      ch_type : str
          Channel type.
      names : list
          List of channel names.
      method : str
          Can be 'rms' or 'mean'.
  
      Returns
      -------
      data : array, shape = (n_channels / 2, ..., n_times)
          The root mean square or mean for each pair.
      names : list
          List of channel names.
      """
      if ch_type == "grad":
          data = _merge_grad_data(data, method)
      else:
          assert ch_type in _FNIRS_CH_TYPES_SPLIT
          data, names = _merge_nirs_data(data, names)
      return data, names
  
imports: import logging
  from collections import defaultdict
  from itertools import combinations
  from pathlib import Path
  import numpy
  from scipy.spatial.distance import pdist, squareform
  from .._fiff.constants import FIFF
  from .._fiff.meas_info import Info
  from .._fiff.pick import _FNIRS_CH_TYPES_SPLIT, _picks_to_idx, pick_types
  from ..transforms import _cart_to_sph, _pol_to_cart
  from ..utils import _check_ch_locs, _check_fname, _check_option, _check_sphere, _clean_names, fill_doc, logger, warn
  from ..viz.topomap import plot_layout
  from .channels import _get_ch_info
label_desc: Use image node_id 15 for calling a global function with example usage: _merge_ch_data(data, ch_type, names, method) and returns: data,  names