#NEWLINE# def _get_nicolet_info( fname , ch_type , eog , ecg , emg , misc ) : #NEWLINE# #INDENT# 'Function for extracting info from Nicolet header files.' #NEWLINE# fname = path . splitext ( fname ) [ 0 ] #NEWLINE# header = ( fname + '.head' ) #NEWLINE# logger . info ( 'Reading header...' ) #NEWLINE# header_info = dict ( ) #NEWLINE# with open ( header , 'r' ) as fid : #NEWLINE# #INDENT# for line in fid : #NEWLINE# #INDENT# ( var , value ) = line . split ( '=' ) #NEWLINE# if ( var == 'elec_names' ) : #NEWLINE# #INDENT# value = value [ 1 : ( - 2 ) ] . split ( ',' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( var == 'conversion_factor' ) : #NEWLINE# #INDENT# value = float ( value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( var != 'start_ts' ) : #NEWLINE# #INDENT# value = int ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# header_info [ var ] = value #NEWLINE# #UNINDENT# #UNINDENT# ch_names = header_info [ 'elec_names' ] #NEWLINE# if ( eog == 'auto' ) : #NEWLINE# #INDENT# eog = _find_channels ( ch_names , 'EOG' ) #NEWLINE# #UNINDENT# if ( ecg == 'auto' ) : #NEWLINE# #INDENT# ecg = _find_channels ( ch_names , 'ECG' ) #NEWLINE# #UNINDENT# if ( emg == 'auto' ) : #NEWLINE# #INDENT# emg = _find_channels ( ch_names , 'EMG' ) #NEWLINE# #UNINDENT# ( date , time ) = header_info [ 'start_ts' ] . split ( ) #NEWLINE# date = date . split ( '-' ) #NEWLINE# time = time . split ( ':' ) #NEWLINE# ( sec , msec ) = time [ 2 ] . split ( '.' ) #NEWLINE# date = datetime . datetime ( int ( date [ 0 ] ) , int ( date [ 1 ] ) , int ( date [ 2 ] ) , int ( time [ 0 ] ) , int ( time [ 1 ] ) , int ( sec ) , int ( msec ) ) #NEWLINE# info = _empty_info ( header_info [ 'sample_freq' ] ) #NEWLINE# info . update ( { #NEWLINE# #INDENT# 'filename' : fname , #NEWLINE# 'meas_date' : calendar . timegm ( date . utctimetuple ( ) ) , #NEWLINE# 'description' : None , #NEWLINE# 'buffer_size_sec' : 10.0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( ch_type == 'eeg' ) : #NEWLINE# #INDENT# ch_coil = FIFF . FIFFV_COIL_EEG #NEWLINE# ch_kind = FIFF . FIFFV_EEG_CH #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch_type == 'seeg' ) : #NEWLINE# #INDENT# ch_coil = FIFF . FIFFV_COIL_EEG #NEWLINE# ch_kind = FIFF . FIFFV_SEEG_CH #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( "Channel type not recognized. Available types are 'eeg' and 'seeg'." ) #NEWLINE# #UNINDENT# #UNINDENT# cals = np . repeat ( ( header_info [ 'conversion_factor' ] * 1e-06 ) , len ( ch_names ) ) #NEWLINE# info [ 'chs' ] = _create_chs ( ch_names , cals , ch_coil , ch_kind , eog , ecg , emg , misc ) #NEWLINE# info [ 'highpass' ] = 0.0 #NEWLINE# info [ 'lowpass' ] = ( info [ 'sfreq' ] / 2.0 ) #NEWLINE# info . _update_redundant ( ) #NEWLINE# return ( info , header_info )