#NEWLINE# def test_clean_info_bads( ) : #NEWLINE# #INDENT# "Test cleaning info['bads'] when bad_channels are excluded " #NEWLINE# raw_file = op . join ( op . dirname ( __file__ ) , 'io' , 'tests' , 'data' , 'test_raw.fif' ) #NEWLINE# raw = Raw ( raw_file ) #NEWLINE# picks_eeg = pick_types ( raw . info , meg = False , eeg = True ) #NEWLINE# idx_eeg_bad_ch = picks_eeg [ [ 1 , 5 , 14 ] ] #NEWLINE# eeg_bad_ch = [ raw . info [ 'ch_names' ] [ k ] for k in idx_eeg_bad_ch ] #NEWLINE# picks_meg = pick_types ( raw . info , meg = True , eeg = False ) #NEWLINE# idx_meg_bad_ch = picks_meg [ [ 0 , 15 , 34 ] ] #NEWLINE# meg_bad_ch = [ raw . info [ 'ch_names' ] [ k ] for k in idx_meg_bad_ch ] #NEWLINE# raw . info [ 'bads' ] = ( eeg_bad_ch + meg_bad_ch ) #NEWLINE# info_eeg = pick_info ( raw . info , picks_eeg ) #NEWLINE# info_meg = pick_info ( raw . info , picks_meg ) #NEWLINE# assert_equal ( info_eeg [ 'bads' ] , eeg_bad_ch ) #NEWLINE# assert_equal ( info_meg [ 'bads' ] , meg_bad_ch ) #NEWLINE# info = pick_info ( info_meg . info , picks_meg ) #NEWLINE# info . _check_consistency ( ) #NEWLINE# info [ 'bads' ] += [ 'EEG 053' ] #NEWLINE# assert_raises ( RuntimeError , info . _check_consistency )