def read_reject_parameters(fname):
 try:
  with open(fname, 'r') as f:
   lines = f.readlines()
 except:
  raise ValueError(('Error while reading %s' % fname))
 reject_names = ['gradReject', 'magReject', 'eegReject', 'eogReject', 'ecgReject']
 reject_pynames = ['grad', 'mag', 'eeg', 'eog', 'ecg']
 reject = dict()
 for line in lines:
  words = line.split()
  if (words[0] in reject_names):
   reject[reject_pynames[reject_names.index(words[0])]] = float(words[1])
 return reject

def read_reject_parameters ( fname ) : try : with open ( fname , 'r' ) as f : lines = f . readlines ( ) except : raise ValueError ( ( 'Error while reading %s' % fname ) ) reject_names = [ 'gradReject' , 'magReject' , 'eegReject' , 'eogReject' , 'ecgReject' ] reject_pynames = [ 'grad' , 'mag' , 'eeg' , 'eog' , 'ecg' ] reject = dict ( ) for line in lines : words = line . split ( ) if ( words [ 0 ] in reject_names ) : reject [ reject_pynames [ reject_names . index ( words [ 0 ] ) ] ] = float ( words [ 1 ] ) return reject
read rejection parameters from .