code: def test_savgol_filter():
      """Test savgol filtering."""
      h_freq = 10.0
      evoked = read_evokeds(fname, 0)
      freqs = fftpack.fftfreq(
          len(evoked.times), 1.0 / evoked.info["sfreq"]
      )
      data = np.abs(fftpack.fft(evoked.data))
      match_mask = np.logical_and(freqs >= 0, freqs <= h_freq / 2.0)
      mismatch_mask = np.logical_and(freqs >= h_freq * 2, freqs < 50.0)
      pytest.raises(
          ValueError, evoked.savgol_filter, evoked.info["sfreq"]
      )
      evoked_sg = evoked.copy().savgol_filter(h_freq)
      data_filt = np.abs(fftpack.fft(evoked_sg.data))
      # decent in pass-band
      assert_allclose(
          np.mean(data[:, match_mask], 0),
          np.mean(data_filt[:, match_mask], 0),
          rtol=1e-4,
          atol=1e-2,
      )
      # suppression in stop-band
      assert (
          np.mean(data[:, mismatch_mask])
          > np.mean(data_filt[:, mismatch_mask]) * 5
      )
      # original preserved
      assert_allclose(
          data, np.abs(fftpack.fft(evoked.data)), atol=1e-16
      )
  
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 3 for calling a global function with example usage: test_savgol_filter() without return types