code: def compute_source_psd(
      raw,
      inverse_operator,
      lambda2=1.0 / 9.0,
      method="dSPM",
      tmin=0.0,
      tmax=None,
      fmin=0.0,
      fmax=200.0,
      n_fft=2048,
      overlap=0.5,
      pick_ori=None,
      label=None,
      nave=1,
      pca=True,
      prepared=False,
      method_params=None,
      inv_split=None,
      bandwidth="hann",
      adaptive=False,
      low_bias=False,
      n_jobs=None,
      return_sensor=False,
      dB=False,
      *,
      verbose=None,
  ):
      """Compute source power spectral density (PSD).
  
      Parameters
      ----------
      raw : instance of Raw
          The raw data.
      inverse_operator : instance of InverseOperator
          The inverse operator.
      lambda2 : float
          The regularization parameter.
      method : "MNE" | "dSPM" | "sLORETA"
          Use minimum norm, dSPM (default), sLORETA, or eLORETA.
      tmin : float
          The beginning of the time interval of interest (in seconds).
          Use 0. for the beginning of the file.
      tmax : float | None
          The end of the time interval of interest (in seconds). If None
          stop at the end of the file.
      fmin : float
          The lower frequency of interest.
      fmax : float
          The upper frequency of interest.
      n_fft : int
          Window size for the FFT. Should be a power of 2.
      overlap : float
          The overlap fraction between windows. Should be between 0 and 1.
          0 means no overlap.
      pick_ori : None | "normal"
          If "normal", rather than pooling the orientations by taking the norm,
          only the radial component is kept. This is only implemented
          when working with loose orientations.
      label : Label
          Restricts the source estimates to a given label.
      nave : int
          The number of averages used to scale the noise covariance matrix.
      pca : bool
          If True, the true dimension of data is estimated before running
          the time-frequency transforms. It reduces the computation times
          e.g. with a dataset that was maxfiltered (true dim is 64).
      prepared : bool
          If True, do not call :func:`prepare_inverse_operator`.
      method_params : dict | None
          Additional options for eLORETA. See Notes of :func:`apply_inverse`.
  
          .. versionadded:: 0.16
      inv_split : int or None
          Split inverse operator into inv_split parts in order to save memory.
  
          .. versionadded:: 0.17
      bandwidth : float | str
          The bandwidth of the multi taper windowing function in Hz.
          Can also be a string (e.g., 'hann') to use a single window.
  
          For backward compatibility, the default is 'hann'.
  
          .. versionadded:: 0.17
      adaptive : bool
          Use adaptive weights to combine the tapered spectra into PSD
          (slow, use n_jobs >> 1 to speed up computation).
  
          .. versionadded:: 0.17
      low_bias : bool
          Only use tapers with more than 90%% spectral concentration within
          bandwidth.
  
          .. versionadded:: 0.17
      %(n_jobs)s
          It is only used if adaptive=True.
  
          .. versionadded:: 0.17
      return_sensor : bool
          If True, return the sensor PSDs as an EvokedArray.
  
          .. versionadded:: 0.17
      dB : bool
          If True (default False), return output it decibels.
  
          .. versionadded:: 0.17
      %(verbose)s
  
      Returns
      -------
      stc_psd : instance of SourceEstimate | VolSourceEstimate
          The PSD of each of the sources.
      sensor_psd : instance of EvokedArray
          The PSD of each sensor. Only returned if ``return_sensor`` is True.
  
      See Also
      --------
      compute_source_psd_epochs
  
      Notes
      -----
      Each window is multiplied by a window before processing, so
      using a non-zero overlap is recommended.
  
      This function is different from :func:`compute_source_psd_epochs` in that:
  
      1. ``bandwidth='hann'`` by default, skipping multitaper estimation
      2. For convenience it wraps
         :func:`mne.make_fixed_length_events` and :class:`mne.Epochs`.
  
      Otherwise the two should produce identical results.
      """
      tmin = 0.0 if tmin is None else float(tmin)
      overlap = float(overlap)
      if not 0 <= overlap < 1:
          raise ValueError(
              "Overlap must be at least 0 and less than 1, got %s"
              % (overlap,)
          )
      n_fft = int(n_fft)
      duration = ((1.0 - overlap) * n_fft) / raw.info["sfreq"]
      events = make_fixed_length_events(raw, 1, tmin, tmax, duration)
      epochs = Epochs(
          raw,
          events,
          1,
          0,
          (n_fft - 1) / raw.info["sfreq"],
          baseline=None,
      )
      out = compute_source_psd_epochs(
          epochs,
          inverse_operator,
          lambda2,
          method,
          fmin,
          fmax,
          pick_ori,
          label,
          nave,
          pca,
          inv_split,
          bandwidth,
          adaptive,
          low_bias,
          True,
          n_jobs,
          prepared,
          method_params,
          return_sensor=True,
      )
      source_data = 0.0
      sensor_data = 0.0
      count = 0
      for stc, evoked in out:
          source_data += stc.data
          sensor_data += evoked.data
          count += 1
      assert (
          count > 0
      )  # should be guaranteed by make_fixed_length_events
      sensor_data /= count
      source_data /= count
      if dB:
          np.log10(sensor_data, out=sensor_data)
          sensor_data *= 10.0
          np.log10(source_data, out=source_data)
          source_data *= 10.0
      evoked.data = sensor_data
      evoked.nave = count
      stc.data = source_data
      out = stc
      if return_sensor:
          out = (out, evoked)
      return out
  
imports: import numpy
  from .._fiff.constants import FIFF
  from .._fiff.pick import pick_info
  from ..baseline import _log_rescale, rescale
  from ..epochs import Epochs
  from ..event import make_fixed_length_events
  from ..evoked import EvokedArray
  from ..fixes import _safe_svd
  from ..label import BiHemiLabel, Label
  from ..parallel import parallel_func
  from ..source_estimate import _make_stc
  from ..time_frequency.multitaper import _compute_mt_params, _mt_spectra, _psd_from_mt, _psd_from_mt_adaptive
  from ..time_frequency.tfr import cwt, morlet
  from ..utils import ProgressBar, _check_option, _pl, _validate_type, logger, verbose
  from .inverse import INVERSE_METHODS, _assemble_kernel, _check_or_prepare, _check_ori, _pick_channels_inverse_operator, _subject_from_inverse, combine_xyz
label_desc: Use image node_id 10 for calling a global function with example usage: compute_source_psd(raw, inverse_operator, lambda2, method, tmin, tmax, fmin, fmax, n_fft, overlap, pick_ori, label, nave, pca, prepared, method_params, inv_split, bandwidth, adaptive, low_bias, n_jobs, return_sensor, dB) and returns: out