(self, subject)
return sessions
return data for a single subject
return data for a single subject
return data for a single subject
def _get_single_subject_data(self, subject):
        """return data for a single subject"""
        fnames = self.data_path(subject)
        filelist = fs_get_file_list(self.figshare_id)
        fsn = fs_get_file_name(filelist)
        sessions = {}

        for fpath in fnames:
            fnamed = fsn[osp.basename(fpath)]
            if fnamed[4] == "x":
                continue
            session_name = "session_" + fnamed[4]
            if self.code == "SSVEP MAMEM3":
                # Since the data for each session is saved in 2 files,
                # it is being saved in 2 runs
                run_number = len(fnamed) - 10
                run_name = "run_" + str(run_number)
            else:
                run_name = "run_0"

            if self.code == "SSVEP MAMEM3":
                m = loadmat(fpath)
                ch_names = [e[0] for e in m["info"][0, 0][9][0]]
                sfreq = 128
                montage = make_standard_montage("standard_1020")
                eeg = m["eeg"]
            else:
                m = loadmat(fpath, squeeze_me=True)
                ch_names = ["E{}".format(i + 1) for i in range(0, 256)]
                ch_names.append("stim")
                # ch_names = ["{}-{}".format(s, i) if s == "EEG" else s
                #             for i, s in enumerate(record.sig_name)]
                sfreq = 250
                if self.code == "SSVEP MAMEM2":
                    labels = m["labels"]
                else:
                    labels = None
                eeg = mamem_event(m["eeg"], m["DIN_1"], labels=labels)
                montage = make_standard_montage("GSN-HydroCel-256")
            ch_types = ["eeg"] * (len(ch_names) - 1) + ["stim"]
            info = create_info(ch_names, sfreq, ch_types)
            raw = RawArray(eeg, info, verbose=False)
            raw.set_montage(montage)
            if session_name not in sessions.keys():
                sessions[session_name] = {}
            if len(sessions[session_name]) == 0:
                sessions[session_name] = {run_name: raw}
            else:
                sessions[session_name][run_name] = raw
        return sessions
def _get_single_subject_data ( self , subject ) : fnames = self . data_path ( subject ) filelist = fs_get_file_list ( self . figshare_id ) fsn = fs_get_file_name ( filelist ) sessions = { } for fpath in fnames : fnamed = fsn [ osp . basename ( fpath ) ] if fnamed [ 4 ] == "x" : continue session_name = "session_" + fnamed [ 4 ] if self . code == "SSVEP MAMEM3" : # Since the data for each session is saved in 2 files, # it is being saved in 2 runs run_number = len ( fnamed ) - 10 run_name = "run_" + str ( run_number ) else : run_name = "run_0" if self . code == "SSVEP MAMEM3" : m = loadmat ( fpath ) ch_names = [ e [ 0 ] for e in m [ "info" ] [ 0 , 0 ] [ 9 ] [ 0 ] ] sfreq = 128 montage = make_standard_montage ( "standard_1020" ) eeg = m [ "eeg" ] else : m = loadmat ( fpath , squeeze_me = True ) ch_names = [ "E{}" . format ( i + 1 ) for i in range ( 0 , 256 ) ] ch_names . append ( "stim" ) # ch_names = ["{}-{}".format(s, i) if s == "EEG" else s #             for i, s in enumerate(record.sig_name)] sfreq = 250 if self . code == "SSVEP MAMEM2" : labels = m [ "labels" ] else : labels = None eeg = mamem_event ( m [ "eeg" ] , m [ "DIN_1" ] , labels = labels ) montage = make_standard_montage ( "GSN-HydroCel-256" ) ch_types = [ "eeg" ] * ( len ( ch_names ) - 1 ) + [ "stim" ] info = create_info ( ch_names , sfreq , ch_types ) raw = RawArray ( eeg , info , verbose = False ) raw . set_montage ( montage ) if session_name not in sessions . keys ( ) : sessions [ session_name ] = { } if len ( sessions [ session_name ] ) == 0 : sessions [ session_name ] = { run_name : raw } else : sessions [ session_name ] [ run_name ] = raw return sessions