code: def _relative_amplitude(resmat, src, function, metric):
      """Compute relative amplitude metrics for resolution matrix.
  
      Parameters
      ----------
      resmat : array, shape (n_orient * n_dipoles, n_dipoles)
          The resolution matrix.
          If not a square matrix and if the number of rows is a multiple of
          number of columns (i.e. n_orient>1), then the Euclidean length per
          source location is computed (e.g. if inverse operator with free
          orientations was applied to forward solution with fixed orientations).
      src : Source Space
          Source space object from forward or inverse operator.
      function : 'psf' | 'ctf'
          Whether to compute metrics for columns (PSFs) or rows (CTFs).
      metric : str
          Which amplitudes to use.
  
          - 'peak_amp': Ratio between absolute maximum amplitudes of peaks per
            location and maximum peak across locations.
          - 'sum_amp': Ratio between sums of absolute amplitudes.
  
      Returns
      -------
      relamp : array, shape (n_dipoles,)
          Relative amplitude metric per location.
      """
      # The code below will operate on columns, so transpose if you want CTFs
      if function == "ctf":
          resmat = resmat.T
  
      # Ratio between amplitude at peak and global peak maximum
      if metric == "peak_amp":
          # maximum amplitudes per column
          maxamps = np.array([abs(col).max() for col in resmat.T])
          maxmaxamps = maxamps.max()  # global absolute maximum
          relamp = maxamps / maxmaxamps
  
      # ratio between sums of absolute amplitudes
      elif metric == "sum_amp":
          # sum of amplitudes per column
          sumamps = np.array([abs(col).sum() for col in resmat.T])
          sumampsmax = sumamps.max()  # maximum of summed amplitudes
          relamp = sumamps / sumampsmax
  
      return relamp
  
file_path: mne-python/mne/minimum_norm/spatial_resolution.py
imports: import numpy
  from ..source_estimate import SourceEstimate
  from ..utils import _check_option, logger, verbose
label_desc: Use image node_id 4 for calling a global function with example usage: _relative_amplitude(resmat, src, function, metric) and returns: relamp