MCPcopy
hub / github.com/mne-tools/mne-python / test_decimate

Function test_decimate

mne/utils/tests/test_mixin.py:16–46  ·  view source on GitHub ↗

Test that resampling and filter + decimate are similar.

()

Source from the content-addressed store, hash-verified

14
15@testing.requires_testing_data
16def test_decimate():
17 """Test that resampling and filter + decimate are similar."""
18 raw = mne.io.read_raw_fif(ms_fname, allow_maxshield="yes")
19 raw.pick("eeg").load_data()
20 assert raw.info["sfreq"] == 1200
21 with pytest.warns(RuntimeWarning, match="indicates a low-pass"):
22 mne.make_fixed_length_epochs(raw).decimate(6)
23 raw.filter(None, 40.0)
24 epo = mne.make_fixed_length_epochs(raw, preload=True).decimate(6)
25 assert not hasattr(epo, "first") # only Evoked should have this
26 others = dict(
27 epo_1=mne.make_fixed_length_epochs(raw, preload=False).decimate(6),
28 epo_2=mne.make_fixed_length_epochs(raw, preload=True).decimate(2).decimate(3),
29 epo_3=mne.make_fixed_length_epochs(raw, preload=False).decimate(2).decimate(3),
30 )
31 for key, other in others.items():
32 assert_allclose(
33 epo.get_data(copy=False),
34 other.get_data(copy=False),
35 err_msg=key,
36 )
37 assert_allclose(epo.times, other.times, err_msg=key)
38 evo = epo.average()
39 epo_full = mne.make_fixed_length_epochs(raw, preload=True)
40 others = dict(
41 evo_1=epo_full.average().decimate(6),
42 evo_2=epo_full.average().decimate(2).decimate(3),
43 )
44 for key, other in others.items():
45 assert_allclose(evo.data, other.data, err_msg=key)
46 assert_allclose(evo.times, other.times, err_msg=key)

Callers

nothing calls this directly

Calls 6

decimateMethod · 0.80
load_dataMethod · 0.45
pickMethod · 0.45
filterMethod · 0.45
get_dataMethod · 0.45
averageMethod · 0.45

Tested by

no test coverage detected