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

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