code: def _sym_mat_to_vector(mat):
      """Convert a symmetric matrix to a vector.
  
      The upper triangle of the matrix (including the diagonal) will be used
      as the values of the vector.
  
      Parameters
      ----------
      mat : 2d-array
          The symmetric matrix to convert to a vector
  
      Returns
      -------
      vec : 1d-array
          A vector consisting of the values of the upper triangle of the matrix.
  
      See Also
      --------
      _vector_to_sym_mat
      """
      return mat[np.triu_indices_from(mat)]
  
imports: import copy
  import numbers
  import numpy
  from scipy.fft import rfftfreq
  from .._fiff.pick import _picks_to_idx, pick_channels
  from ..parallel import parallel_func
  from ..time_frequency.multitaper import _compute_mt_params, _csd_from_mt, _mt_spectra, _psd_from_mt_adaptive
  from ..utils import ProgressBar, _check_fname, _import_h5io_funcs, _validate_type, copy_function_doc_to_method_doc, logger, verbose, warn
  from ..viz.misc import plot_csd
  from .tfr import EpochsTFR, _cwt_array, _get_nfft, morlet
label_desc: Use image node_id 4 for calling a global function with example usage: _sym_mat_to_vector(mat) and returns: mat