code: def _csd_fourier(X, sfreq, n_times, freq_mask, n_fft):
      """Compute cross spectral density (CSD) using short-time fourier transform.
  
      Computes the CSD for a single epoch of data.
  
      Parameters
      ----------
      X : ndarray, shape (n_channels, n_times)
          The time series data consisting of n_channels time-series of length
          n_times.
      sfreq : float
          The sampling frequency of the data in Hertz.
      n_times : int
          Number of time samples
      freq_mask : ndarray
          Which frequencies to use.
      n_fft : int
          Length of the FFT.
      """
      x_mt, _ = _mt_spectra(X, np.hanning(n_times), sfreq, n_fft)
  
      # Hack so we can sum over axis=-2
      weights = np.array([1.0])[:, np.newaxis, np.newaxis, np.newaxis]
  
      x_mt = x_mt[:, :, freq_mask]
  
      # Calculating CSD
      # Tiling x_mt so that we can easily use _csd_from_mt()
      x_mt = x_mt[:, np.newaxis, :, :]
      x_mt = np.tile(x_mt, [1, x_mt.shape[0], 1, 1])
      y_mt = np.transpose(x_mt, axes=[1, 0, 2, 3])
      weights_y = np.transpose(weights, axes=[1, 0, 2, 3])
      csds = _csd_from_mt(x_mt, y_mt, weights, weights_y)
  
      # FIXME: don't compute full matrix in the first place
      csds = np.array(
          [
              _sym_mat_to_vector(csds[:, :, i])
              for i in range(csds.shape[-1])
          ]
      ).T
  
      # Scaling by number of samples and compensating for loss of power
      # due to windowing (see section 11.5.2 in Bendat & Piersol).
      csds /= n_times
      csds *= 8 / 3.0
  
      # Scaling by sampling frequency for compatibility with Matlab
      csds /= sfreq
  
      return csds
  
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 15 for calling a global function with example usage: _csd_fourier(X, sfreq, n_times, freq_mask, n_fft) and returns: csds