class_docstr: Mixin class for Raw, Evoked, Epochs, Spectrum, AverageTFR.
class_docstr_tok: ["Mixin","class","for","Raw",",","Evoked",",","Epochs",",","Spectrum",",","AverageTFR","."]
docstr: Append new channels to the instance.
  
  Parameters
  ----------
  add_list : list
      A list of objects to append to self. Must contain all the same
      type as the current object.
  force_update_info : bool
      If True, force the info for objects to be appended to match the
      values in ``self``. This should generally only be used when adding
      stim channels for which important metadata won't be overwritten.
  
      .. versionadded:: 0.12
  
  Returns
  -------
  inst : instance of Raw, Epochs, or Evoked
      The modified instance.
  
  See Also
  --------
  drop_channels
  
  Notes
  -----
  If ``self`` is a Raw instance that has been preloaded into a
  :obj:`numpy.memmap` instance, the memmap will be resized.
docstr_tok: ["Append","new","channels","to","the","instance",".","Parameters","--","--","--","--","--","add_list",":","list","A","list","of","objects","to","append","to","self",".","Must","contain","all","the","same","type","as","the","current","object",".","force_update_info",":","bool","If","True",",","force","the","info","for","objects","to","be","appended","to","match","the","values","in","``","self","``",".","This","should","generally","only","be","used","when","adding","stim","channels","for","which","important","metadata","wo","n't","be","overwritten",".","..","versionadded",":",":","0.12","Returns","--","--","--","-","inst",":","instance","of","Raw",",","Epochs",",","or","Evoked","The","modified","instance",".","See","Also","--","--","--","--","drop_channels","Notes","--","--","-","If","``","self","``","is","a","Raw","instance","that","has","been","preloaded","into","a",":","obj",":","`","numpy.memmap","`","instance",",","the","memmap","will","be","resized","."]
code: def add_channels(self, add_list, force_update_info=False):
      """Append new channels to the instance.
  
      Parameters
      ----------
      add_list : list
          A list of objects to append to self. Must contain all the same
          type as the current object.
      force_update_info : bool
          If True, force the info for objects to be appended to match the
          values in ``self``. This should generally only be used when adding
          stim channels for which important metadata won't be overwritten.
  
          .. versionadded:: 0.12
  
      Returns
      -------
      inst : instance of Raw, Epochs, or Evoked
          The modified instance.
  
      See Also
      --------
      drop_channels
  
      Notes
      -----
      If ``self`` is a Raw instance that has been preloaded into a
      :obj:`numpy.memmap` instance, the memmap will be resized.
      """
      # avoid circular imports
      from ..epochs import BaseEpochs
      from ..io import BaseRaw
  
      _validate_type(add_list, (list, tuple), "Input")
  
      # Object-specific checks
      for inst in add_list + [self]:
          _check_preload(inst, "adding channels")
      if isinstance(self, BaseRaw):
          con_axis = 0
          comp_class = BaseRaw
      elif isinstance(self, BaseEpochs):
          con_axis = 1
          comp_class = BaseEpochs
      else:
          con_axis = 0
          comp_class = type(self)
      for inst in add_list:
          _validate_type(inst, comp_class, "All input")
      data = [inst._data for inst in [self] + add_list]
  
      # Make sure that all dimensions other than channel axis are the same
      compare_axes = [i for i in range(data[0].ndim) if i != con_axis]
      shapes = np.array([dat.shape for dat in data])[:, compare_axes]
      for shape in shapes:
          if not ((shapes[0] - shape) == 0).all():
              raise ValueError(
                  "All data dimensions except channels must match, got "
                  f"{shapes[0]} != {shape}"
              )
      del shapes
  
      # Create final data / info objects
      infos = [self.info] + [inst.info for inst in add_list]
      new_info = _merge_info(
          infos, force_update_to_first=force_update_info
      )
  
      # Now update the attributes
      if (
          isinstance(self._data, np.memmap)
          and con_axis == 0
          and sys.platform != "darwin"
      ):  # resizing not available--no mremap
          # Use a resize and fill in other ones
          out_shape = (sum(d.shape[0] for d in data),) + data[0].shape[
              1:
          ]
          n_bytes = np.prod(out_shape) * self._data.dtype.itemsize
          self._data.flush()
          self._data.base.resize(n_bytes)
          self._data = np.memmap(
              self._data.filename,
              mode="r+",
              dtype=self._data.dtype,
              shape=out_shape,
          )
          assert self._data.shape == out_shape
          assert self._data.nbytes == n_bytes
          offset = len(data[0])
          for d in data[1:]:
              this_len = len(d)
              self._data[offset : offset + this_len] = d
              offset += this_len
      else:
          self._data = np.concatenate(data, axis=con_axis)
      self.info = new_info
      if isinstance(self, BaseRaw):
          self._cals = np.concatenate(
              [getattr(inst, "_cals") for inst in [self] + add_list]
          )
          # We should never use these since data are preloaded, let's just
          # set it to something large and likely to break (2 ** 31 - 1)
          extra_idx = [2147483647] * sum(
              info["nchan"] for info in infos[1:]
          )
          assert all(
              len(r) == infos[0]["nchan"] for r in self._read_picks
          )
          self._read_picks = [
              np.concatenate([r, extra_idx]) for r in self._read_picks
          ]
          assert all(
              len(r) == self.info["nchan"] for r in self._read_picks
          )
          for other in add_list:
              self._orig_units.update(other._orig_units)
      elif isinstance(self, BaseEpochs):
          self.picks = np.arange(self._data.shape[1])
          if hasattr(self, "_projector"):
              activate = False if self._do_delayed_proj else self.proj
              self._projector, self.info = setup_proj(
                  self.info, False, activate=activate
              )
  
      return self
  
imports: import os.path
  import string
  import sys
  from collections import OrderedDict
  from copy import deepcopy
  from dataclasses import dataclass
  from functools import partial
  from pathlib import Path
  from typing import Union
  import numpy
  from scipy.io import loadmat
  from scipy.sparse import csr_matrix, lil_matrix
  from scipy.spatial import Delaunay
  from scipy.stats import zscore
  from .._fiff.constants import FIFF
  from .._fiff.meas_info import Info, MontageMixin, _merge_info, _rename_comps, _unit2human, create_info
  from .._fiff.pick import _check_excludes_includes, _pick_data_channels, _picks_by_type, _picks_to_idx, _second_rules, channel_indices_by_type, channel_type, pick_channels, pick_info, pick_types
  from .._fiff.proj import setup_proj
  from .._fiff.reference import add_reference_channels, set_eeg_reference
  from .._fiff.tag import _rename_list
  from ..bem import _check_origin
  from ..defaults import HEAD_SIZE_DEFAULT, _handle_default
  from ..utils import _check_dict_keys, _check_fname, _check_option, _check_preload, _get_stim_channel, _on_missing, _validate_type, fill_doc, legacy, logger, verbose, warn
label_desc: Use image node_id 8 for calling the UpdateChannelsMixin obj's underlying member method code with example usage: obj.add_channels(add_list, force_update_info) and returns: self