#NEWLINE# def load_raw_data( subject , test = False ) : #NEWLINE# #INDENT# 'Load Raw data from files.\n\n    For a given subject, csv files are loaded, converted to MNE raw instance\n    and concatenated.\n    If test is True, training data are composed of series 1 to 8 and test data\n    of series 9 and test. Otherwise, training data are series 1 to 6 and test\n    data series 7 and 8.\n    ' #NEWLINE# fnames_train = glob ( ( '../data/train/subj%d_series*_data.csv' % subject ) ) #NEWLINE# fnames_train . sort ( ) #NEWLINE# if test : #NEWLINE# #INDENT# fnames_test = glob ( ( '../data/test/subj%d_series*_data.csv' % subject ) ) #NEWLINE# fnames_test . sort ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fnames_test = fnames_train [ ( - 2 ) : ] #NEWLINE# fnames_train = fnames_train [ : ( - 2 ) ] #NEWLINE# #UNINDENT# raw_train = [ creat_mne_raw_object ( fname ) for fname in fnames_train ] #NEWLINE# raw_train = concatenate_raws ( raw_train ) #NEWLINE# picks = pick_types ( raw_train . info , eeg = True ) #NEWLINE# data_train = raw_train . _data [ picks ] . T #NEWLINE# labels_train = raw_train . _data [ 32 : ] . T #NEWLINE# raw_test = [ creat_mne_raw_object ( fname , read_events = ( not test ) ) for fname in fnames_test ] #NEWLINE# raw_test = concatenate_raws ( raw_test ) #NEWLINE# data_test = raw_test . _data [ picks ] . T #NEWLINE# labels_test = None #NEWLINE# if ( not test ) : #NEWLINE# #INDENT# labels_test = raw_test . _data [ 32 : ] . T #NEWLINE# #UNINDENT# return ( data_train , labels_train , data_test , labels_test )