code: def cross_spectrum(
      X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None
  ):
      """Compute the complex cross-spectral matrices of a real signal X.
  
      Parameters
      ----------
      X : ndarray, shape (n_channels, n_times)
          Multi-channel time-series, real-valued.
      window : int, default=128
          The length of the FFT window used for spectral estimation.
      overlap : float, default=0.75
          The percentage of overlap between window.
      fmin : float | None, default=None
          The minimal frequency to be returned.
      fmax : float | None, default=None
          The maximal frequency to be returned.
      fs : float | None, default=None
          The sampling frequency of the signal.
  
      Returns
      -------
      S : ndarray, shape (n_channels, n_channels, n_freqs)
          Cross-spectral matrices, for each frequency bin.
      freqs : ndarray, shape (n_freqs,)
          The frequencies associated to cross-spectra.
  
      References
      ----------
      .. [1] https://en.wikipedia.org/wiki/Cross-spectrum
      """
      if not is_real_type(X):
          raise ValueError("Input must be real-valued.")
      window = int(window)
      if window < 1:
          raise ValueError("Value window must be a positive integer")
      if not 0 < overlap < 1:
          raise ValueError(
              f"Value overlap must be included in (0, 1) (Got {overlap})"
          )
  
      n_channels, n_times = X.shape
      n_freqs = (
          int(window / 2) + 1
      )  # X real signal => compute half-spectrum
      step = int((1.0 - overlap) * window)
      n_windows = int((n_times - window) / step + 1)
      win = np.hanning(window)
  
      # FFT calculation on all windows
      shape = (n_channels, n_windows, window)
      strides = X.strides[:-1] + (step * X.strides[-1], X.strides[-1])
      Xs = np.lib.stride_tricks.as_strided(
          X, shape=shape, strides=strides
      )
      fdata = np.fft.rfft(Xs * win, n=window).transpose(1, 0, 2)
  
      # adjust frequency range to specified range
      if fs is not None:
          if fmin is None:
              fmin = 0
          if fmax is None:
              fmax = fs / 2
          if fmax <= fmin:
              raise ValueError(
                  "Parameter fmax must be superior to fmin"
              )
          if 2.0 * fmax > fs:  # check Nyquist-Shannon
              raise ValueError(
                  "Parameter fmax must be inferior to fs/2"
              )
          f = np.arange(0, n_freqs, dtype=int) * float(fs / window)
          fix = (f >= fmin) & (f <= fmax)
          fdata = fdata[:, :, fix]
          freqs = f[fix]
      else:
          if fmin is not None:
              warnings.warn(
                  "Parameter fmin not used because fs is None"
              )
          if fmax is not None:
              warnings.warn(
                  "Parameter fmax not used because fs is None"
              )
          freqs = None
  
      n_freqs = fdata.shape[2]
      S = np.zeros((n_channels, n_channels, n_freqs), dtype=complex)
      for i in range(n_freqs):
          S[:, :, i] = fdata[:, :, i].conj().T @ fdata[:, :, i]
      S /= n_windows * np.linalg.norm(win) ** 2
  
      # normalization to respect Parseval's theorem with the half-spectrum
      # excepted DC bin (always), and Nyquist bin (when window is even)
      if window % 2:
          S[..., 1:] *= 2
      else:
          S[..., 1:-1] *= 2
  
      return S, freqs
  
imports: import warnings
  from functools import wraps
  import numpy
  from scipy.linalg import block_diag
  from scipy.stats import chi2
  from sklearn.covariance import oas, ledoit_wolf, fast_mcd
  from .distance import distance_mahalanobis
  from .test import is_square, is_real_type
label_desc: Use image node_id 17 for calling a global function with example usage: cross_spectrum(X, window, overlap, fmin, fmax, fs) and returns: S,  freqs