(self, subject)
return {"session_0": {"run_0": raw}}
Return the data of a single subject
Return the data of a single subject
Return the data of a single subject
def _get_single_subject_data(self, subject):
        """Return the data of a single subject"""
        n_samples, n_channels, n_trials = 1500, 64, 6
        n_classes = len(self.event_id)

        fname = self.data_path(subject)
        mat = loadmat(fname[:-4])

        data = np.transpose(mat["data"], axes=(2, 3, 0, 1))
        data = np.reshape(data, newshape=(-1, n_channels, n_samples))
        data = data - data.mean(axis=2, keepdims=True)
        raw_events = np.zeros((data.shape[0], 1, n_samples))
        raw_events[:, 0, 0] = np.array(
            [n_trials * [i + 1] for i in range(n_classes)]
        ).flatten()
        data = np.concatenate([1e-6 * data, raw_events], axis=1)
        # add buffer in between trials
        log.warning(
            "Trial data de-meaned and concatenated with a buffer"
            " to create continuous data"
        )
        buff = (data.shape[0], n_channels + 1, 50)
        data = np.concatenate([np.zeros(buff), data, np.zeros(buff)], axis=2)

        ch_types = ["eeg"] * 59 + ["misc"] + 3 * ["eeg"] + ["misc", "stim"]
        sfreq = 250
        info = create_info(self._ch_names, sfreq, ch_types)
        raw = RawArray(data=np.concatenate(list(data), axis=1), info=info, verbose=False)
        montage = make_standard_montage("standard_1005")
        raw.set_montage(montage)
        return {"session_0": {"run_0": raw}}
def _get_single_subject_data ( self , subject ) : n_samples , n_channels , n_trials = 1500 , 64 , 6 n_classes = len ( self . event_id ) fname = self . data_path ( subject ) mat = loadmat ( fname [ : - 4 ] ) data = np . transpose ( mat [ "data" ] , axes = ( 2 , 3 , 0 , 1 ) ) data = np . reshape ( data , newshape = ( - 1 , n_channels , n_samples ) ) data = data - data . mean ( axis = 2 , keepdims = True ) raw_events = np . zeros ( ( data . shape [ 0 ] , 1 , n_samples ) ) raw_events [ : , 0 , 0 ] = np . array ( [ n_trials * [ i + 1 ] for i in range ( n_classes ) ] ) . flatten ( ) data = np . concatenate ( [ 1e-6 * data , raw_events ] , axis = 1 ) # add buffer in between trials log . warning ( "Trial data de-meaned and concatenated with a buffer" " to create continuous data" ) buff = ( data . shape [ 0 ] , n_channels + 1 , 50 ) data = np . concatenate ( [ np . zeros ( buff ) , data , np . zeros ( buff ) ] , axis = 2 ) ch_types = [ "eeg" ] * 59 + [ "misc" ] + 3 * [ "eeg" ] + [ "misc" , "stim" ] sfreq = 250 info = create_info ( self . _ch_names , sfreq , ch_types ) raw = RawArray ( data = np . concatenate ( list ( data ) , axis = 1 ) , info = info , verbose = False ) montage = make_standard_montage ( "standard_1005" ) raw . set_montage ( montage ) return { "session_0" : { "run_0" : raw } }