code: def test_shift_time_evoked(tmp_path):
      """Test for shifting of time scale."""
      # Shift backward
      ave = read_evokeds(fname, 0).shift_time(-0.1, relative=True)
      fname_temp = tmp_path / "evoked-ave.fif"
      write_evokeds(fname_temp, ave)
  
      # Shift forward twice the amount
      ave_bshift = read_evokeds(fname_temp, 0)
      ave_bshift.shift_time(0.2, relative=True)
      write_evokeds(fname_temp, ave_bshift, overwrite=True)
  
      # Shift backward again
      ave_fshift = read_evokeds(fname_temp, 0)
      ave_fshift.shift_time(-0.1, relative=True)
      write_evokeds(fname_temp, ave_fshift, overwrite=True)
  
      ave_normal = read_evokeds(fname, 0)
      ave_relative = read_evokeds(fname_temp, 0)
  
      assert_allclose(
          ave_normal.data, ave_relative.data, atol=1e-16, rtol=1e-3
      )
      assert_array_almost_equal(ave_normal.times, ave_relative.times, 8)
  
      assert_equal(ave_normal.last, ave_relative.last)
      assert_equal(ave_normal.first, ave_relative.first)
  
      # Absolute time shift
      ave = read_evokeds(fname, 0)
      ave.shift_time(-0.3, relative=False)
      write_evokeds(fname_temp, ave, overwrite=True)
  
      ave_absolute = read_evokeds(fname_temp, 0)
  
      assert_allclose(
          ave_normal.data, ave_absolute.data, atol=1e-16, rtol=1e-3
      )
      assert_equal(ave_absolute.first, int(-0.3 * ave.info["sfreq"]))
  
      # subsample shift
      shift = 1e-6  # 1 µs, should be well below 1/sfreq
      ave = read_evokeds(fname, 0)
      times = ave.times
      ave.shift_time(shift)
      assert_allclose(times + shift, ave.times, atol=1e-16, rtol=1e-12)
  
      # test handling of Evoked.first, Evoked.last
      ave = read_evokeds(fname, 0)
      first_last = np.array([ave.first, ave.last])
      # should shift by 0 samples
      ave.shift_time(1e-6)
      assert_array_equal(first_last, np.array([ave.first, ave.last]))
      write_evokeds(fname_temp, ave, overwrite=True)
      ave_loaded = read_evokeds(fname_temp, 0)
      assert_array_almost_equal(ave.times, ave_loaded.times, 8)
      # should shift by 57 samples
      ave.shift_time(57.0 / ave.info["sfreq"])
      assert_array_equal(
          first_last + 57, np.array([ave.first, ave.last])
      )
      write_evokeds(fname_temp, ave, overwrite=True)
      ave_loaded = read_evokeds(fname_temp, 0)
      assert_array_almost_equal(ave.times, ave_loaded.times, 8)
  
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 8 for calling a global function with example usage: test_shift_time_evoked(tmp_path) without return types