code: def test_hilbert():
      """Test hilbert on raw, epochs, and evoked."""
      raw = read_raw_fif(raw_fname).load_data()
      raw.del_proj()
      raw.pick(raw.ch_names[:2])
      events = read_events(event_name)
      epochs = Epochs(raw, events)
      with pytest.raises(
          RuntimeError, match="requires epochs data to be load"
      ):
          epochs.apply_hilbert()
      epochs.load_data()
      evoked = epochs.average()
      raw_hilb = raw.apply_hilbert()
      epochs_hilb = epochs.apply_hilbert()
      evoked_hilb = evoked.copy().apply_hilbert()
      evoked_hilb_2_data = epochs_hilb.get_data(copy=False).mean(0)
      assert_allclose(evoked_hilb.data, evoked_hilb_2_data)
      # This one is only approximate because of edge artifacts
      evoked_hilb_3 = Epochs(raw_hilb, events).average()
      corr = np.corrcoef(
          np.abs(evoked_hilb_3.data.ravel()),
          np.abs(evoked_hilb.data.ravel()),
      )[0, 1]
      assert 0.96 < corr < 0.98
      # envelope=True mode
      evoked_hilb_env = evoked.apply_hilbert(envelope=True)
      assert_allclose(evoked_hilb_env.data, np.abs(evoked_hilb.data))
  
imports: import pickle
  from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import fftpack
  from mne import Epochs, EpochsArray, combine_evoked, create_info, equalize_channels, pick_types, read_events, read_evokeds, write_evokeds
  from mne._fiff.constants import FIFF
  from mne.evoked import Evoked, EvokedArray, _get_peak
  from mne.io import read_raw_fif
  from mne.utils import grand_average
label_desc: Use image node_id 26 for calling a global function with example usage: test_hilbert() without return types