diff --git a/tests/conftest.py b/tests/conftest.py index f431cb9..80a1df9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -83,20 +83,8 @@ def gen_mne_data_raw(): meg_path = data_path / 'MEG' / 'sample' raw_fname = meg_path / 'sample_audvis_raw.fif' - - raw = mne.io.read_raw_fif(raw_fname) - picks = mne.pick_types(raw.info, meg='mag', eeg=False, stim=False, eog=False, exclude='bads') - raw.pick(picks) - - yield raw - - -@pytest.fixture(scope='session') -def gen_mne_data_epoched(): - data_path = sample.data_path() - - meg_path = data_path / 'MEG' / 'sample' - raw_fname = meg_path / 'sample_audvis_raw.fif' + event_fname = meg_path / 'sample_audvis_filt-0-40_raw-eve.fif' + events = mne.read_events(event_fname) raw = mne.io.read_raw_fif(raw_fname) picks = mne.pick_types(raw.info, meg='mag', eeg=False, stim=False, eog=False, exclude='bads') @@ -113,19 +101,15 @@ def gen_mne_data_epoched(): tmax = 0.5 # Load real data as the template - event_fname = meg_path / 'sample_audvis_filt-0-40_raw-eve.fif' - events = mne.read_events(event_fname) - epochs = mne.Epochs( raw, events, event_id, tmin, tmax, - # picks=picks, baseline=None, preload=True, verbose=False, ) - yield epochs + yield raw, epochs diff --git a/tests/test_mne.py b/tests/test_mne.py index d8508da..aad426c 100644 --- a/tests/test_mne.py +++ b/tests/test_mne.py @@ -8,21 +8,17 @@ @pytest.mark.filterwarnings('ignore:RuntimeWarning') @pytest.mark.filterwarnings('ignore:UserWarning') -def test_mne_raw(gen_mne_data_raw): +def test_mne(gen_mne_data_raw): + mne_data, epochs = gen_mne_data_raw + + # test raw aperiodic_mne, periodic_mne = irasa_raw( - gen_mne_data_raw, band=(0.25, 50), duration=2, hset_info=(1.0, 2.0, 0.05), as_array=False + mne_data, band=(0.25, 50), duration=2, hset_info=(1.0, 2.0, 0.05), as_array=False ) aperiodic_mne.get_slopes(fit_func='fixed') - # aperiodic_mne.get_slopes(fit_func='knee', scale=True) periodic_mne.get_peaks(smoothing_window=2) - -@pytest.mark.filterwarnings('ignore:RuntimeWarning') -@pytest.mark.filterwarnings('ignore:UserWarning') -def test_mne_epoched(gen_mne_data_epoched): - aperiodic, periodic = irasa_epochs(gen_mne_data_epoched, band=(0.5, 50), hset_info=(1.0, 2.0, 0.05), as_array=False) - - # aperiodic.get_slopes(fit_func='knee', scale=True) + # test epochs + aperiodic, periodic = irasa_epochs(epochs, band=(0.5, 50), hset_info=(1.0, 2.0, 0.05), as_array=False) aperiodic.get_slopes(fit_func='fixed', scale=True) - periodic.get_peaks(smoothing_window=2)