code: def test_multitaper_psd(n_times, adaptive, n_jobs):
      """Test multi-taper PSD computation."""
      ni = pytest.importorskip("nitime")
  
      n_channels = 5
      data = np.random.default_rng(0).random((n_channels, n_times))
      sfreq = 500
      with pytest.raises(
          ValueError, match="Invalid value for the 'normaliza"
      ):
          psd_array_multitaper(data, sfreq, normalization="foo")
      # compute with MNE
      psd, freqs = psd_array_multitaper(
          data,
          sfreq,
          adaptive=adaptive,
          n_jobs=n_jobs,
          normalization="full",
      )
      # compute with nitime
      freqs_ni, psd_ni, _ = ni.algorithms.spectral.multi_taper_psd(
          data, sfreq, adaptive=adaptive, jackknife=False
      )
      # compare
      assert_array_almost_equal(psd, psd_ni, decimal=4)
      # assert_array_equal(freqs, freqs_ni)
      # ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
      # this is commented out because nitime's freq calculations differ from ours
      # so there's no point checking (theirs are wrong; sometimes they return a
      # freq component at exactly sfreq/2 when they shouldn't)
      # nitime  →  np.linspace(0, sfreq / 2, n_times // 2 + 1)
      # mne     →  scipy.fft.rfftfreq(n_times, 1. / sfreq)
  
      # test with bad bandwidth
      with pytest.raises(ValueError, match="use a value of at least"):
          psd_array_multitaper(data, sfreq, bandwidth=4.9)
  
file_path: mne-python/mne/time_frequency/tests/test_multitaper.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from mne.time_frequency import psd_array_multitaper
  from mne.time_frequency.multitaper import dpss_windows
  from mne.utils import _record_warnings
label_desc: Use image node_id 2 for calling a global function with example usage: test_multitaper_psd(n_times, adaptive, n_jobs) without return types