@@ -549,7 +549,7 @@ def test_mxne_inverse_sure_synthetic(
549
549
550
550
@pytest .mark .slowtest # slow on Azure
551
551
@testing .requires_testing_data
552
- def test_mxne_inverse_sure ():
552
+ def test_mxne_inverse_sure_meg ():
553
553
"""Tests SURE criterion for automatic alpha selection on MEG data."""
554
554
555
555
def data_fun (times ):
@@ -558,10 +558,10 @@ def data_fun(times):
558
558
return data
559
559
560
560
n_dipoles = 2
561
- raw = mne .io .read_raw_fif (fname_raw )
562
- info = mne . io . read_info ( fname_data )
563
- with info . _unlock ():
564
- info [ "projs" ] = []
561
+ raw = mne .io .read_raw_fif (fname_raw ). pick_types ( "grad" , exclude = "bads" )
562
+ raw . del_proj ( )
563
+ info = raw . info
564
+ del raw
565
565
noise_cov = mne .make_ad_hoc_cov (info )
566
566
label_names = ["Aud-lh" , "Aud-rh" ]
567
567
labels = [
@@ -572,10 +572,8 @@ def data_fun(times):
572
572
data_path / "MEG" / "sample" / "sample_audvis_trunc-meg-eeg-oct-4-fwd.fif"
573
573
)
574
574
forward = mne .read_forward_solution (fname_fwd )
575
- forward = mne .pick_types_forward (
576
- forward , meg = "grad" , eeg = False , exclude = raw .info ["bads" ]
577
- )
578
- times = np .arange (100 , dtype = np .float64 ) / raw .info ["sfreq" ] - 0.1
575
+ forward = mne .pick_channels_forward (forward , info ["ch_names" ])
576
+ times = np .arange (100 , dtype = np .float64 ) / info ["sfreq" ] - 0.1
579
577
stc = simulate_sparse_stc (
580
578
forward ["src" ],
581
579
n_dipoles = n_dipoles ,
@@ -584,13 +582,16 @@ def data_fun(times):
584
582
labels = labels ,
585
583
data_fun = data_fun ,
586
584
)
585
+ assert len (stc .vertices ) == 2
586
+ assert_array_equal (stc .vertices [0 ], [89259 ])
587
+ assert_array_equal (stc .vertices [1 ], [70279 ])
587
588
nave = 30
588
589
evoked = simulate_evoked (
589
590
forward , stc , info , noise_cov , nave = nave , use_cps = False , iir_filter = None
590
591
)
591
592
evoked = evoked .crop (tmin = 0 , tmax = 10e-3 )
592
593
stc_ = mixed_norm (
593
- evoked , forward , noise_cov , loose = 0.9 , n_mxne_iter = 5 , depth = 0.9 , random_state = 0
594
+ evoked , forward , noise_cov , loose = 0.9 , n_mxne_iter = 5 , depth = 0.9 , random_state = 1
594
595
)
595
596
assert len (stc_ .vertices ) == len (stc .vertices ) == 2
596
597
for si in range (len (stc_ .vertices )):
0 commit comments