(self, subject)
return sessions
return data for a single subejct
return data for a single subejct
return data for a single subejct
def _get_single_subject_data(self, subject):
        """return data for a single subejct"""

        sessions = {}
        file_path_list = self.data_path(subject)

        for session in self.sessions:
            if self.train_run or self.test_run:
                mat = loadmat(file_path_list[self.sessions.index(session)])

            session_name = "session_{}".format(session)
            sessions[session_name] = {}
            if self.train_run:
                sessions[session_name]["train"] = self._get_single_run(
                    mat["EEG_{}_train".format(self.code_suffix)][0, 0]
                )
            if self.test_run:
                sessions[session_name]["test"] = self._get_single_run(
                    mat["EEG_{}_test".format(self.code_suffix)][0, 0]
                )
            if self.resting_state:
                prefix = "pre"
                sessions[session_name][
                    "test_{}_rest".format(prefix)
                ] = self._get_single_rest_run(
                    mat["EEG_{}_test".format(self.code_suffix)][0, 0], prefix
                )
                sessions[session_name][
                    "train_{}_rest".format(prefix)
                ] = self._get_single_rest_run(
                    mat["EEG_{}_train".format(self.code_suffix)][0, 0], prefix
                )
                prefix = "post"
                sessions[session_name][
                    "test_{}_rest".format(prefix)
                ] = self._get_single_rest_run(
                    mat["EEG_{}_test".format(self.code_suffix)][0, 0], prefix
                )
                sessions[session_name][
                    "train_{}_rest".format(prefix)
                ] = self._get_single_rest_run(
                    mat["EEG_{}_train".format(self.code_suffix)][0, 0], prefix
                )

        return sessions
def _get_single_subject_data ( self , subject ) : sessions = { } file_path_list = self . data_path ( subject ) for session in self . sessions : if self . train_run or self . test_run : mat = loadmat ( file_path_list [ self . sessions . index ( session ) ] ) session_name = "session_{}" . format ( session ) sessions [ session_name ] = { } if self . train_run : sessions [ session_name ] [ "train" ] = self . _get_single_run ( mat [ "EEG_{}_train" . format ( self . code_suffix ) ] [ 0 , 0 ] ) if self . test_run : sessions [ session_name ] [ "test" ] = self . _get_single_run ( mat [ "EEG_{}_test" . format ( self . code_suffix ) ] [ 0 , 0 ] ) if self . resting_state : prefix = "pre" sessions [ session_name ] [ "test_{}_rest" . format ( prefix ) ] = self . _get_single_rest_run ( mat [ "EEG_{}_test" . format ( self . code_suffix ) ] [ 0 , 0 ] , prefix ) sessions [ session_name ] [ "train_{}_rest" . format ( prefix ) ] = self . _get_single_rest_run ( mat [ "EEG_{}_train" . format ( self . code_suffix ) ] [ 0 , 0 ] , prefix ) prefix = "post" sessions [ session_name ] [ "test_{}_rest" . format ( prefix ) ] = self . _get_single_rest_run ( mat [ "EEG_{}_test" . format ( self . code_suffix ) ] [ 0 , 0 ] , prefix ) sessions [ session_name ] [ "train_{}_rest" . format ( prefix ) ] = self . _get_single_rest_run ( mat [ "EEG_{}_train" . format ( self . code_suffix ) ] [ 0 , 0 ] , prefix ) return sessions