code: def csd_compare(
      x,
      y,
      fs=1.0,
      window="hann",
      nperseg=None,
      noverlap=None,
      nfft=None,
      detrend="constant",
      return_onesided=True,
      scaling="density",
      axis=-1,
      average="mean",
  ):
      """Assert that the results from the existing `csd()` and `_csd_wrapper()`
      are close to each other."""
      kw = dict(
          x=x,
          y=y,
          fs=fs,
          window=window,
          nperseg=nperseg,
          noverlap=noverlap,
          nfft=nfft,
          detrend=detrend,
          return_onesided=return_onesided,
          scaling=scaling,
          axis=axis,
          average=average,
      )
      freqs0, Pxy0 = csd(**kw)
      freqs1, Pxy1 = _csd_wrapper(**kw)
  
      assert_allclose(freqs1, freqs0)
      assert_allclose(Pxy1, Pxy0)
      assert_allclose(freqs1, freqs0)
      return freqs0, Pxy0
  
file_path: scipy/scipy/signal/tests/_scipy_spectral_test_shim.py
imports: import platform
  from typing import cast, Literal
  import numpy
  from numpy.testing import assert_allclose
  from scipy.signal import ShortTimeFFT
  from scipy.signal import csd, get_window, stft, istft
  from scipy.signal._arraytools import const_ext, even_ext, odd_ext, zero_ext
  from scipy.signal._short_time_fft import FFT_MODE_TYPE
  from scipy.signal._spectral_py import _spectral_helper, _triage_segments, _median_bias
label_desc: Use image node_id 8 for calling a global function with example usage: csd_compare(x, y, fs, window, nperseg, noverlap, nfft, detrend, return_onesided, scaling, axis, average) and returns: freqs0,  Pxy0