(self, subject)
return {"session_0": {"run_0": raw}}
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"""
        fname = self.data_path(subject)

        data = loadmat(
            fname,
            squeeze_me=True,
            struct_as_record=False,
            verify_compressed_data_integrity=False,
        )["eeg"]

        # fmt: off
        eeg_ch_names = [
            "Fp1", "AF7", "AF3", "F1", "F3", "F5", "F7", "FT7", "FC5", "FC3", "FC1",
            "C1", "C3", "C5", "T7", "TP7", "CP5", "CP3", "CP1", "P1", "P3", "P5", "P7",
            "P9", "PO7", "PO3", "O1", "Iz", "Oz", "POz", "Pz", "CPz", "Fpz", "Fp2",
            "AF8", "AF4", "AFz", "Fz", "F2", "F4", "F6", "F8", "FT8", "FC6", "FC4",
            "FC2", "FCz", "Cz", "C2", "C4", "C6", "T8", "TP8", "CP6", "CP4", "CP2",
            "P2", "P4", "P6", "P8", "P10", "PO8", "PO4", "O2",
        ]
        # fmt: on
        emg_ch_names = ["EMG1", "EMG2", "EMG3", "EMG4"]
        ch_names = eeg_ch_names + emg_ch_names + ["Stim"]
        ch_types = ["eeg"] * 64 + ["emg"] * 4 + ["stim"]
        montage = make_standard_montage("standard_1005")
        imagery_left = data.imagery_left - data.imagery_left.mean(axis=1, keepdims=True)
        imagery_right = data.imagery_right - data.imagery_right.mean(
            axis=1, keepdims=True
        )

        eeg_data_l = np.vstack([imagery_left * 1e-6, data.imagery_event])
        eeg_data_r = np.vstack([imagery_right * 1e-6, data.imagery_event * 2])

        # trials are already non continuous. edge artifact can appears but
        # are likely to be present during rest / inter-trial activity
        eeg_data = np.hstack(
            [eeg_data_l, np.zeros((eeg_data_l.shape[0], 500)), eeg_data_r]
        )
        log.warning(
            "Trials demeaned and stacked with zero buffer to create "
            "continuous data -- edge effects present"
        )

        info = create_info(ch_names=ch_names, ch_types=ch_types, sfreq=data.srate)
        raw = RawArray(data=eeg_data, info=info, verbose=False)
        raw.set_montage(montage)

        return {"session_0": {"run_0": raw}}
def _get_single_subject_data ( self , subject ) : fname = self . data_path ( subject ) data = loadmat ( fname , squeeze_me = True , struct_as_record = False , verify_compressed_data_integrity = False , ) [ "eeg" ] # fmt: off eeg_ch_names = [ "Fp1" , "AF7" , "AF3" , "F1" , "F3" , "F5" , "F7" , "FT7" , "FC5" , "FC3" , "FC1" , "C1" , "C3" , "C5" , "T7" , "TP7" , "CP5" , "CP3" , "CP1" , "P1" , "P3" , "P5" , "P7" , "P9" , "PO7" , "PO3" , "O1" , "Iz" , "Oz" , "POz" , "Pz" , "CPz" , "Fpz" , "Fp2" , "AF8" , "AF4" , "AFz" , "Fz" , "F2" , "F4" , "F6" , "F8" , "FT8" , "FC6" , "FC4" , "FC2" , "FCz" , "Cz" , "C2" , "C4" , "C6" , "T8" , "TP8" , "CP6" , "CP4" , "CP2" , "P2" , "P4" , "P6" , "P8" , "P10" , "PO8" , "PO4" , "O2" , ] # fmt: on emg_ch_names = [ "EMG1" , "EMG2" , "EMG3" , "EMG4" ] ch_names = eeg_ch_names + emg_ch_names + [ "Stim" ] ch_types = [ "eeg" ] * 64 + [ "emg" ] * 4 + [ "stim" ] montage = make_standard_montage ( "standard_1005" ) imagery_left = data . imagery_left - data . imagery_left . mean ( axis = 1 , keepdims = True ) imagery_right = data . imagery_right - data . imagery_right . mean ( axis = 1 , keepdims = True ) eeg_data_l = np . vstack ( [ imagery_left * 1e-6 , data . imagery_event ] ) eeg_data_r = np . vstack ( [ imagery_right * 1e-6 , data . imagery_event * 2 ] ) # trials are already non continuous. edge artifact can appears but # are likely to be present during rest / inter-trial activity eeg_data = np . hstack ( [ eeg_data_l , np . zeros ( ( eeg_data_l . shape [ 0 ] , 500 ) ) , eeg_data_r ] ) log . warning ( "Trials demeaned and stacked with zero buffer to create " "continuous data -- edge effects present" ) info = create_info ( ch_names = ch_names , ch_types = ch_types , sfreq = data . srate ) raw = RawArray ( data = eeg_data , info = info , verbose = False ) raw . set_montage ( montage ) return { "session_0" : { "run_0" : raw } }