@requires_version('scipy', '0.14')
def test_savgol_filter():
    'Test savgol filtering\n    '
    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))
    assert_raises(ValueError, evoked.savgol_filter, evoked.info['sfreq'])
    evoked.savgol_filter(h_freq)
    data_filt = np.abs(fftpack.fft(evoked.data))
    assert_allclose(np.mean(data[:, match_mask], 0), np.mean(data_filt[:, match_mask], 0), rtol=0.0001, atol=0.01)
    assert_true((np.mean(data[:, mismatch_mask]) > (np.mean(data_filt[:, mismatch_mask]) * 5)))
Test savgol filtering
@requires_version('scipy', '0.14')
def test_savgol_filter():
    '\n    '
    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))
    assert_raises(ValueError, evoked.savgol_filter, evoked.info['sfreq'])
    evoked.savgol_filter(h_freq)
    data_filt = np.abs(fftpack.fft(evoked.data))
    assert_allclose(np.mean(data[:, match_mask], 0), np.mean(data_filt[:, match_mask], 0), rtol=0.0001, atol=0.01)
    assert_true((np.mean(data[:, mismatch_mask]) > (np.mean(data_filt[:, mismatch_mask]) * 5)))