code: def test_compares_psd():
      """Test PSD estimation on raw for plt.psd and scipy.signal.welch."""
      data, sfreq, _ = _make_psd_data()
      n_fft = 2048
      fmin, fmax = 2, 70
      # Compute PSD with psd_array_welch
      psds_mne, freqs_mne = psd_array_welch(
          data, sfreq, fmin=fmin, fmax=fmax, n_fft=n_fft
      )
      # Compute psds with scipy.signal.welch
      freqs_scipy, psds_scipy = welch(
          data, fs=sfreq, nperseg=n_fft, noverlap=0, window="hamming"
      )
      # restrict to the relevant frequencies
      mask = (freqs_scipy >= fmin) & (freqs_scipy <= fmax)
      freqs_scipy = freqs_scipy[mask]
      psds_scipy = psds_scipy[:, mask]
      # make sure they match
      assert_array_almost_equal(psds_mne, psds_scipy)
      assert_array_equal(freqs_mne, freqs_scipy)
      assert psds_mne.shape == (data.shape[0], len(freqs_mne))
      assert psds_scipy.shape == (data.shape[0], len(freqs_scipy))
      assert np.sum(freqs_mne < 0) == 0
      assert np.sum(freqs_scipy < 0) == 0
      assert np.sum(psds_mne < 0) == 0
      assert np.sum(psds_scipy < 0) == 0
  
file_path: mne-python/mne/time_frequency/tests/test_psd.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from scipy.signal import welch
  from mne.time_frequency import psd_array_multitaper, psd_array_welch
  from mne.time_frequency.multitaper import _psd_from_mt
  from mne.time_frequency.psd import _median_biases
  from mne.utils import catch_logging
label_desc: Use image node_id 9 for calling a global function with example usage: test_compares_psd() without return types