@@ -465,14 +465,21 @@ def test_1020_selection():
465
465
@testing .requires_testing_data
466
466
def test_find_ch_adjacency ():
467
467
"""Test computing the adjacency matrix."""
468
- raw = read_raw_fif (raw_fname , preload = True )
468
+ raw = read_raw_fif (raw_fname )
469
469
sizes = {"mag" : 828 , "grad" : 1700 , "eeg" : 384 }
470
470
nchans = {"mag" : 102 , "grad" : 204 , "eeg" : 60 }
471
471
for ch_type in ["mag" , "grad" , "eeg" ]:
472
472
conn , ch_names = find_ch_adjacency (raw .info , ch_type )
473
473
# Silly test for checking the number of neighbors.
474
474
assert_equal (conn .getnnz (), sizes [ch_type ])
475
475
assert_equal (len (ch_names ), nchans [ch_type ])
476
+ kwargs = dict (exclude = ())
477
+ if ch_type in ("mag" , "grad" ):
478
+ kwargs ["meg" ] = ch_type
479
+ else :
480
+ kwargs [ch_type ] = True
481
+ want_names = [raw .ch_names [pick ] for pick in pick_types (raw .info , ** kwargs )]
482
+ assert ch_names == want_names
476
483
pytest .raises (ValueError , find_ch_adjacency , raw .info , None )
477
484
478
485
# Test computing the conn matrix with gradiometers.
@@ -506,7 +513,7 @@ def test_find_ch_adjacency():
506
513
def test_neuromag122_adjacency ():
507
514
"""Test computing the adjacency matrix of Neuromag122-Data."""
508
515
nm122_fname = testing_path / "misc" / "neuromag122_test_file-raw.fif"
509
- raw = read_raw_fif (nm122_fname , preload = True )
516
+ raw = read_raw_fif (nm122_fname )
510
517
conn , ch_names = find_ch_adjacency (raw .info , "grad" )
511
518
assert conn .getnnz () == 1564
512
519
assert len (ch_names ) == 122
@@ -515,7 +522,7 @@ def test_neuromag122_adjacency():
515
522
516
523
def test_drop_channels ():
517
524
"""Test if dropping channels works with various arguments."""
518
- raw = read_raw_fif (raw_fname , preload = True ).crop (0 , 0.1 )
525
+ raw = read_raw_fif (raw_fname ).crop (0 , 0.1 )
519
526
raw .drop_channels (["MEG 0111" ]) # list argument
520
527
raw .drop_channels ("MEG 0112" ) # str argument
521
528
raw .drop_channels ({"MEG 0132" , "MEG 0133" }) # set argument
@@ -535,7 +542,7 @@ def test_drop_channels():
535
542
536
543
def test_pick_channels ():
537
544
"""Test if picking channels works with various arguments."""
538
- raw = read_raw_fif (raw_fname , preload = True ).crop (0 , 0.1 )
545
+ raw = read_raw_fif (raw_fname ).crop (0 , 0.1 )
539
546
540
547
# selected correctly 3 channels
541
548
raw .pick (["MEG 0113" , "MEG 0112" , "MEG 0111" ])
0 commit comments