#NEWLINE# @ testing . requires_testing_data #NEWLINE# def test_pick_forward_seeg_ecog( ) : #NEWLINE# #INDENT# 'Test picking forward with SEEG and ECoG\n    ' #NEWLINE# fwd = read_forward_solution ( fname_meeg ) #NEWLINE# counts = channel_indices_by_type ( fwd [ 'info' ] ) #NEWLINE# for key in counts . keys ( ) : #NEWLINE# #INDENT# counts [ key ] = len ( counts [ key ] ) #NEWLINE# #UNINDENT# counts [ 'meg' ] = ( counts [ 'mag' ] + counts [ 'grad' ] ) #NEWLINE# fwd_ = pick_types_forward ( fwd , meg = True ) #NEWLINE# _check_fwd_n_chan_consistent ( fwd_ , counts [ 'meg' ] ) #NEWLINE# fwd_ = pick_types_forward ( fwd , meg = False , eeg = True ) #NEWLINE# _check_fwd_n_chan_consistent ( fwd_ , counts [ 'eeg' ] ) #NEWLINE# assert_raises ( ValueError , pick_types_forward , fwd , meg = False , seeg = True ) #NEWLINE# assert_raises ( ValueError , pick_types_forward , fwd , meg = False , ecog = True ) #NEWLINE# ecog_name = 'E1' #NEWLINE# seeg_name = 'OTp1' #NEWLINE# rename_channels ( fwd [ 'info' ] , { #NEWLINE# #INDENT# 'EEG 059' : ecog_name , #NEWLINE# #UNINDENT# } ) #NEWLINE# rename_channels ( fwd [ 'info' ] , { #NEWLINE# #INDENT# 'EEG 060' : seeg_name , #NEWLINE# #UNINDENT# } ) #NEWLINE# for ch in fwd [ 'info' ] [ 'chs' ] : #NEWLINE# #INDENT# if ( ch [ 'ch_name' ] == seeg_name ) : #NEWLINE# #INDENT# ch [ 'kind' ] = FIFF . FIFFV_SEEG_CH #NEWLINE# ch [ 'coil_type' ] = FIFF . FIFFV_COIL_EEG #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch [ 'ch_name' ] == ecog_name ) : #NEWLINE# #INDENT# ch [ 'kind' ] = FIFF . FIFFV_ECOG_CH #NEWLINE# ch [ 'coil_type' ] = FIFF . FIFFV_COIL_EEG #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# fwd [ 'sol' ] [ 'row_names' ] [ ( - 1 ) ] = fwd [ 'info' ] [ 'chs' ] [ ( - 1 ) ] [ 'ch_name' ] #NEWLINE# fwd [ 'sol' ] [ 'row_names' ] [ ( - 2 ) ] = fwd [ 'info' ] [ 'chs' ] [ ( - 2 ) ] [ 'ch_name' ] #NEWLINE# counts [ 'eeg' ] -= 2 #NEWLINE# counts [ 'seeg' ] += 1 #NEWLINE# counts [ 'ecog' ] += 1 #NEWLINE# fwd_seeg = pick_types_forward ( fwd , meg = False , seeg = True ) #NEWLINE# assert_equal ( fwd_seeg [ 'sol' ] [ 'row_names' ] , [ seeg_name ] ) #NEWLINE# assert_equal ( fwd_seeg [ 'info' ] [ 'ch_names' ] , [ seeg_name ] ) #NEWLINE# fwd_ = pick_types_forward ( fwd , meg = True ) #NEWLINE# _check_fwd_n_chan_consistent ( fwd_ , counts [ 'meg' ] ) #NEWLINE# fwd_ = pick_types_forward ( fwd , meg = False , eeg = True ) #NEWLINE# _check_fwd_n_chan_consistent ( fwd_ , counts [ 'eeg' ] ) #NEWLINE# fwd_ = pick_types_forward ( fwd , meg = False , seeg = True ) #NEWLINE# _check_fwd_n_chan_consistent ( fwd_ , counts [ 'seeg' ] ) #NEWLINE# fwd_ = pick_types_forward ( fwd , meg = False , ecog = True ) #NEWLINE# _check_fwd_n_chan_consistent ( fwd_ , counts [ 'ecog' ] )