code: def make_inverse_operator(
      info,
      forward,
      noise_cov,
      loose="auto",
      depth=0.8,
      fixed="auto",
      rank=None,
      use_cps=True,
      verbose=None,
  ):
      """Assemble inverse operator.
  
      Parameters
      ----------
      %(info_not_none)s
          Specifies the channels to include. Bad channels (in ``info['bads']``)
          are not used.
      forward : instance of Forward
          Forward operator. See :func:`~mne.make_forward_solution` to create the operator.
      noise_cov : instance of Covariance
          The noise covariance matrix. See :func:`~mne.compute_raw_covariance` and
          :func:`~mne.compute_covariance` to compute the noise covariance matrix on
          :class:`~mne.io.Raw` and :class:`~mne.Epochs` respectively.
      %(loose)s
      %(depth)s
      fixed : bool | 'auto'
          Use fixed source orientations normal to the cortical mantle. If True,
          the loose parameter must be ``"auto"`` or ``0``. If ``'auto'``, the loose value
          is used.
      %(rank_none)s
      %(use_cps)s
      %(verbose)s
  
      Returns
      -------
      inv : instance of InverseOperator
          Inverse operator.
  
      Notes
      -----
      For different sets of options (**loose**, **depth**, **fixed**) to work,
      the forward operator must have been loaded using a certain configuration
      (i.e., with **force_fixed** and **surf_ori** set appropriately). For
      example, given the desired inverse type (with representative choices
      of **loose** = 0.2 and **depth** = 0.8 shown in the table in various
      places, as these are the defaults for those parameters):
  
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
          | Inverse desired                             | Forward parameters allowed                 |
          +=====================+===========+===========+===========+=================+==============+
          |                     | **loose** | **depth** | **fixed** | **force_fixed** | **surf_ori** |
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
          | | Loose constraint, | 0.2       | 0.8       | False     | False           | True         |
          | | Depth weighted    |           |           |           |                 |              |
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
          | | Loose constraint  | 0.2       | None      | False     | False           | True         |
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
          | | Free orientation, | 1.0       | 0.8       | False     | False           | True         |
          | | Depth weighted    |           |           |           |                 |              |
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
          | | Free orientation  | 1.0       | None      | False     | False           | True | False |
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
          | | Fixed constraint, | 0.0       | 0.8       | True      | False           | True         |
          | | Depth weighted    |           |           |           |                 |              |
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
          | | Fixed constraint  | 0.0       | None      | True      | True            | True         |
          +---------------------+-----------+-----------+-----------+-----------------+--------------+
  
      Also note that, if the source space (as stored in the forward solution)
      has patch statistics computed, these are used to improve the depth
      weighting. Thus slightly different results are to be expected with
      and without this information.
  
      For depth weighting, 0.8 is generally good for MEG, and between 2 and 5
      is good for EEG, see :footcite:t:`LinEtAl2006a`.
  
      References
      ----------
      .. footbibliography::
      """  # noqa: E501
      # For now we always have pca='white'. It does not seem to affect
      # calculations and is also backward-compatible with MNE-C
      depth = _check_depth(depth, "depth_mne")
      (
          forward,
          gain_info,
          gain,
          depth_prior,
          orient_prior,
          source_std,
          trace_GRGT,
          noise_cov,
          _,
      ) = _prepare_forward(
          forward,
          info,
          noise_cov,
          fixed,
          loose,
          rank,
          pca="white",
          use_cps=use_cps,
          **depth,
      )
      # no need to copy any attributes of forward here because there is
      # a deepcopy in _prepare_forward
      inv = dict(
          projs=deepcopy(gain_info["projs"]),
          eigen_leads_weighted=False,
          source_ori=forward["source_ori"],
          mri_head_t=forward["mri_head_t"],
          nsource=forward["nsource"],
          units="Am",
          coord_frame=forward["coord_frame"],
          source_nn=forward["source_nn"],
          src=forward["src"],
          fmri_prior=None,
          info=deepcopy(forward["info"]),
      )
      inv["info"]["bads"] = [
          bad
          for bad in info["bads"]
          if bad in forward["info"]["ch_names"]
      ]
      inv["info"]._check_consistency()
      del fixed, loose, depth, use_cps, forward
  
      # Decompose the combined matrix
      logger.info(
          "Computing SVD of whitened and weighted lead field matrix."
      )
      eigen_fields, sing, eigen_leads = _safe_svd(
          gain, full_matrices=False
      )
      del gain
      logger.info("    largest singular value = %g" % np.max(sing))
      logger.info(
          f"    scaling factor to adjust the trace = {trace_GRGT:g} "
          f"(nchan = {eigen_fields.shape[0]} "
          f'nzero = {(noise_cov["eig"] <= 0).sum()})'
      )
  
      # MNE-ify everything for output
      eigen_fields = dict(
          data=eigen_fields.T,
          col_names=gain_info["ch_names"],
          row_names=[],
          nrow=eigen_fields.shape[1],
          ncol=eigen_fields.shape[0],
      )
      eigen_leads = dict(
          data=eigen_leads.T,
          nrow=eigen_leads.shape[1],
          ncol=eigen_leads.shape[0],
          row_names=[],
          col_names=[],
      )
      has_meg = False
      has_eeg = False
      for idx in range(gain_info["nchan"]):
          ch_type = channel_type(gain_info, idx)
          if ch_type == "eeg":
              has_eeg = True
          if (ch_type == "mag") or (ch_type == "grad"):
              has_meg = True
      if has_eeg and has_meg:
          methods = FIFF.FIFFV_MNE_MEG_EEG
      elif has_meg:
          methods = FIFF.FIFFV_MNE_MEG
      else:
          methods = FIFF.FIFFV_MNE_EEG
  
      if orient_prior is not None:
          orient_prior = dict(
              data=orient_prior,
              kind=FIFF.FIFFV_MNE_ORIENT_PRIOR_COV,
              bads=[],
              diag=True,
              names=[],
              eig=None,
              eigvec=None,
              dim=orient_prior.size,
              nfree=1,
              projs=[],
          )
      if depth_prior is not None:
          depth_prior = dict(
              data=depth_prior,
              kind=FIFF.FIFFV_MNE_DEPTH_PRIOR_COV,
              bads=[],
              diag=True,
              names=[],
              eig=None,
              eigvec=None,
              dim=depth_prior.size,
              nfree=1,
              projs=[],
          )
      source_cov = dict(
          data=source_std * source_std,
          dim=source_std.size,
          kind=FIFF.FIFFV_MNE_SOURCE_COV,
          diag=True,
          names=[],
          projs=[],
          eig=None,
          eigvec=None,
          nfree=1,
          bads=[],
      )
      inv.update(
          eigen_fields=eigen_fields,
          eigen_leads=eigen_leads,
          sing=sing,
          nave=1.0,
          depth_prior=depth_prior,
          source_cov=source_cov,
          noise_cov=noise_cov,
          orient_prior=orient_prior,
          methods=methods,
      )
      return InverseOperator(inv)
  
imports: from copy import deepcopy
  from math import sqrt
  import numpy
  from scipy import linalg
  from scipy.stats import chi2
  from .._fiff.constants import FIFF
  from .._fiff.matrix import _read_named_matrix, _transpose_named_matrix, write_named_matrix
  from .._fiff.open import fiff_open
  from .._fiff.pick import channel_type, pick_channels, pick_info, pick_types
  from .._fiff.proj import _electrode_types, _needs_eeg_average_ref_proj, _read_proj, _write_proj, make_projector
  from .._fiff.tag import find_tag
  from .._fiff.tree import dir_tree_find
  from .._fiff.write import end_block, start_and_end_file, start_block, write_coord_trans, write_float, write_float_matrix, write_int, write_string
  from ..cov import Covariance, _read_cov, _write_cov, compute_whitener, prepare_noise_cov
  from ..epochs import BaseEpochs, EpochsArray
  from ..evoked import Evoked, EvokedArray
  from ..fixes import _safe_svd
  from ..forward import _read_forward_meas_info, _select_orient_forward, compute_depth_prior, compute_orient_prior, convert_forward_solution, is_fixed_orient
  from ..forward.forward import _triage_loose, write_forward_meas_info
  from ..html_templates import _get_html_template
  from ..io import BaseRaw
  from ..source_estimate import _get_src_type, _make_stc
  from ..source_space._source_space import _get_src_nn, _get_vertno, _read_source_spaces_from_tree, _write_source_spaces_to_fid, find_source_space_hemi, label_src_vertno_sel
  from ..surface import _normal_orth
  from ..time_frequency.tfr import _check_tfr_complex
  from ..transforms import _ensure_trans, transform_surface_to
  from ..utils import _check_compensation_grade, _check_depth, _check_fname, _check_option, _check_src_normal, _validate_type, _verbose_safe_false, check_fname, logger, repr_html, verbose, warn
  from ._eloreta import _compute_eloreta
label_desc: Use image node_id 23 for calling a global function with example usage: make_inverse_operator(info, forward, noise_cov, loose, depth, fixed, rank, use_cps, verbose) and returns: InverseOperator