code: def test_morlet(sfreq, freq, n_cycles):
      """Test morlet with and without zero mean."""
      Wz = morlet(sfreq, freq, n_cycles, zero_mean=True)
      W = morlet(sfreq, freq, n_cycles, zero_mean=False)
  
      assert np.abs(np.mean(np.real(Wz))) < 1e-5
      if n_cycles == 2:
          assert np.abs(np.mean(np.real(W))) > 1e-3
      else:
          assert np.abs(np.mean(np.real(W))) < 1e-5
  
      assert_allclose(np.linalg.norm(W), np.sqrt(2), atol=1e-6)
  
      # Convert to SciPy nomenclature and compare
      M = len(W)
      w = n_cycles
      s = w * sfreq / (2 * freq * np.pi)  # from SciPy docs
      Ws = morlet2(M, s, w) * np.sqrt(2)
      assert_allclose(W, Ws)
  
      # Check FWHM
      fwhm_formula = fwhm(freq, n_cycles)
      half_max = np.abs(W).max() / 2.0
      fwhm_empirical = (np.abs(W) >= half_max).sum() / sfreq
      # Could be off by a few samples
      assert_allclose(fwhm_formula, fwhm_empirical, atol=3 / sfreq)
  
imports: import datetime
  import re
  from itertools import product
  from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_equal
  from scipy.signal import morlet2
  import mne
  from mne import Epochs, EpochsArray, Info, Transform, create_info, pick_types, read_events
  from mne.io import read_raw_fif
  from mne.tests.test_epochs import assert_metadata_equal
  from mne.time_frequency import tfr_array_morlet, tfr_array_multitaper
  from mne.time_frequency.tfr import AverageTFR, EpochsTFR, _compute_tfr, _make_dpss, combine_tfr, cwt, fwhm, morlet, read_tfrs, tfr_morlet, tfr_multitaper, write_tfrs
  from mne.utils import catch_logging, grand_average
  from mne.viz.utils import _fake_click, _fake_keypress, _fake_scroll
label_desc: Use image node_id 2 for calling a global function with example usage: test_morlet(sfreq, freq, n_cycles) without return types