(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)
        # TODO: add 1s 0 buffer between trials and make continuous
        data = loadmat(
            fname,
            squeeze_me=True,
            struct_as_record=False,
            verify_compressed_data_integrity=False,
        )
        montage = mne.channels.make_standard_montage("standard_1005")

        # fmt: off
        ch_names = [
            "Fp1", "Fpz", "Fp2", "AF3", "AF4", "F7", "F5", "F3", "F1", "Fz", "F2", "F4", "F6",
            "F8", "FT7", "FC5", "FC3", "FC1", "FCz", "FC2", "FC4", "FC6", "FT8", "T7", "C5",
            "C3", "C1", "Cz", "C2", "C4", "C6", "T8", "TP7", "CP5", "CP3", "CP1", "CPz", "CP2",
            "CP4", "CP6", "TP8", "P7", "P5", "P3", "P1", "Pz", "P2", "P4", "P6", "P8", "PO7",
            "PO5", "PO3", "POz", "PO4", "PO6", "PO8", "CB1", "O1", "Oz", "O2", "CB2", "VEO", "HEO",
        ]
        # fmt: on

        ch_types = ["eeg"] * 62 + ["eog"] * 2
        # FIXME not sure what are those CB1 / CB2
        ch_types[57] = "misc"
        ch_types[61] = "misc"
        info = mne.create_info(
            ch_names=ch_names + ["STIM014"], ch_types=ch_types + ["stim"], sfreq=200
        )
        # until we get the channel names montage is None
        event_ids = data["label"].ravel()
        raw_data = np.transpose(data["data"], axes=[2, 0, 1])
        # de-mean each trial
        raw_data = raw_data - np.mean(raw_data, axis=2, keepdims=True)
        raw_events = np.zeros((raw_data.shape[0], 1, raw_data.shape[2]))
        raw_events[:, 0, 0] = event_ids
        data = np.concatenate([1e-6 * raw_data, raw_events], axis=1)
        # add buffer in between trials
        log.warning(
            "Trial data de-meaned and concatenated with a buffer to create " "cont data"
        )
        zeroshape = (data.shape[0], data.shape[1], 50)
        data = np.concatenate([np.zeros(zeroshape), data, np.zeros(zeroshape)], axis=2)
        raw = mne.io.RawArray(
            data=np.concatenate(list(data), axis=1), 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 ) # TODO: add 1s 0 buffer between trials and make continuous data = loadmat ( fname , squeeze_me = True , struct_as_record = False , verify_compressed_data_integrity = False , ) montage = mne . channels . make_standard_montage ( "standard_1005" ) # fmt: off ch_names = [ "Fp1" , "Fpz" , "Fp2" , "AF3" , "AF4" , "F7" , "F5" , "F3" , "F1" , "Fz" , "F2" , "F4" , "F6" , "F8" , "FT7" , "FC5" , "FC3" , "FC1" , "FCz" , "FC2" , "FC4" , "FC6" , "FT8" , "T7" , "C5" , "C3" , "C1" , "Cz" , "C2" , "C4" , "C6" , "T8" , "TP7" , "CP5" , "CP3" , "CP1" , "CPz" , "CP2" , "CP4" , "CP6" , "TP8" , "P7" , "P5" , "P3" , "P1" , "Pz" , "P2" , "P4" , "P6" , "P8" , "PO7" , "PO5" , "PO3" , "POz" , "PO4" , "PO6" , "PO8" , "CB1" , "O1" , "Oz" , "O2" , "CB2" , "VEO" , "HEO" , ] # fmt: on ch_types = [ "eeg" ] * 62 + [ "eog" ] * 2 # FIXME not sure what are those CB1 / CB2 ch_types [ 57 ] = "misc" ch_types [ 61 ] = "misc" info = mne . create_info ( ch_names = ch_names + [ "STIM014" ] , ch_types = ch_types + [ "stim" ] , sfreq = 200 ) # until we get the channel names montage is None event_ids = data [ "label" ] . ravel ( ) raw_data = np . transpose ( data [ "data" ] , axes = [ 2 , 0 , 1 ] ) # de-mean each trial raw_data = raw_data - np . mean ( raw_data , axis = 2 , keepdims = True ) raw_events = np . zeros ( ( raw_data . shape [ 0 ] , 1 , raw_data . shape [ 2 ] ) ) raw_events [ : , 0 , 0 ] = event_ids data = np . concatenate ( [ 1e-6 * raw_data , raw_events ] , axis = 1 ) # add buffer in between trials log . warning ( "Trial data de-meaned and concatenated with a buffer to create " "cont data" ) zeroshape = ( data . shape [ 0 ] , data . shape [ 1 ] , 50 ) data = np . concatenate ( [ np . zeros ( zeroshape ) , data , np . zeros ( zeroshape ) ] , axis = 2 ) raw = mne . io . RawArray ( data = np . concatenate ( list ( data ) , axis = 1 ) , info = info , verbose = False ) raw . set_montage ( montage ) return { "session_0" : { "run_0" : raw } }