code: def test_getitem_epochsTFR():
      """Test GetEpochsMixin in the context of EpochsTFR."""
      pd = pytest.importorskip("pandas")
  
      # Setup for reading the raw data and select a few trials
      raw = read_raw_fif(raw_fname)
      events = read_events(event_fname)
      # create fake data, test with and without dropping epochs
      for n_drop_epochs in [0, 2]:
          n_events = 12
          # create fake metadata
          rng = np.random.RandomState(42)
          rt = rng.uniform(size=(n_events,))
          trialtypes = np.array(["face", "place"])
          trial = trialtypes[
              (rng.uniform(size=(n_events,)) > 0.5).astype(int)
          ]
          meta = pd.DataFrame(dict(RT=rt, Trial=trial))
          event_id = dict(a=1, b=2, c=3, d=4)
          epochs = Epochs(
              raw,
              events[:n_events],
              event_id=event_id,
              metadata=meta,
              decim=1,
          )
          epochs.drop(np.arange(n_drop_epochs))
          n_events -= n_drop_epochs
  
          freqs = np.arange(
              12.0, 17.0, 2.0
          )  # define frequencies of interest
          n_cycles = (
              freqs / 2.0
          )  # 0.5 second time windows for all frequencies
  
          # Choose time x (full) bandwidth product
          time_bandwidth = 4.0
          # With 0.5 s time windows, this gives 8 Hz smoothing
          kwargs = dict(
              freqs=freqs,
              n_cycles=n_cycles,
              use_fft=True,
              time_bandwidth=time_bandwidth,
              return_itc=False,
              average=False,
              n_jobs=None,
          )
          power = tfr_multitaper(epochs, **kwargs)
  
          # Check that power and epochs metadata is the same
          assert_metadata_equal(epochs.metadata, power.metadata)
          assert_metadata_equal(
              epochs[::2].metadata, power[::2].metadata
          )
          assert_metadata_equal(
              epochs["RT < .5"].metadata, power["RT < .5"].metadata
          )
          assert_array_equal(epochs.selection, power.selection)
          assert epochs.drop_log == power.drop_log
  
          # Check that get power is functioning
          assert_array_equal(power[3:6].data, power.data[3:6])
          assert_array_equal(power[3:6].events, power.events[3:6])
          assert_array_equal(
              epochs.selection[3:6], power.selection[3:6]
          )
  
          indx_check = power.metadata["Trial"] == "face"
          try:
              indx_check = indx_check.to_numpy()
          except Exception:
              pass  # older Pandas
          indx_check = indx_check.nonzero()
          assert_array_equal(
              power['Trial == "face"'].events, power.events[indx_check]
          )
          assert_array_equal(
              power['Trial == "face"'].data, power.data[indx_check]
          )
  
          # Check that the wrong Key generates a Key Error for Metadata search
          with pytest.raises(KeyError):
              power['Trialz == "place"']
  
          # Test length function
          assert len(power) == n_events
          assert len(power[3:6]) == 3
  
          # Test iteration function
          for ind, power_ep in enumerate(power):
              assert_array_equal(power_ep, power.data[ind])
              if ind == 5:
                  break
  
          # Test that current state is maintained
          assert_array_equal(power.next(), power.data[ind + 1])
  
      # Check decim affects sfreq
      power_decim = tfr_multitaper(epochs, decim=2, **kwargs)
      assert power.info["sfreq"] / 2.0 == power_decim.info["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 18 for calling a global function with example usage: test_getitem_epochsTFR() without return types