(self, dataset, subjects=None, return_epochs=False)
return X, labels, metadata
Return the data for a list of subject.

        return the data, labels and a dataframe with metadata. the dataframe
        will contain at least the following columns

        - subject : the subject indice
        - session : the session indice
        - run : the run indice

        parameters
        ----------
        dataset:
            A dataset instance.
        subjects: List of int
            List of subject number
        return_epochs: boolean
            This flag specifies whether to return only the data array or the
            complete processed mne.Epochs

        returns
        -------
        X : Union[np.ndarray, mne.Epochs]
            the data that will be used as features for the model
            Note: if return_epochs=True,  this is mne.Epochs
            if return_epochs=False, this is np.ndarray
        labels: np.ndarray
            the labels for training / evaluating the model
        metadata: pd.DataFrame
            A dataframe containing the metadata.
Return the data for a list of subject.
Return the data for a list of subject .
def get_data(self, dataset, subjects=None, return_epochs=False):
        """
        Return the data for a list of subject.

        return the data, labels and a dataframe with metadata. the dataframe
        will contain at least the following columns

        - subject : the subject indice
        - session : the session indice
        - run : the run indice

        parameters
        ----------
        dataset:
            A dataset instance.
        subjects: List of int
            List of subject number
        return_epochs: boolean
            This flag specifies whether to return only the data array or the
            complete processed mne.Epochs

        returns
        -------
        X : Union[np.ndarray, mne.Epochs]
            the data that will be used as features for the model
            Note: if return_epochs=True,  this is mne.Epochs
            if return_epochs=False, this is np.ndarray
        labels: np.ndarray
            the labels for training / evaluating the model
        metadata: pd.DataFrame
            A dataframe containing the metadata.
        """

        if not self.is_valid(dataset):
            message = "Dataset {} is not valid for paradigm".format(dataset.code)
            raise AssertionError(message)

        data = dataset.get_data(subjects)
        self.prepare_process(dataset)

        X = [] if return_epochs else np.array([])
        labels = []
        metadata = []
        for subject, sessions in data.items():
            for session, runs in sessions.items():
                for run, raw in runs.items():
                    proc = self.process_raw(raw, dataset, return_epochs=return_epochs)

                    if proc is None:
                        # this mean the run did not contain any selected event
                        # go to next
                        continue

                    x, lbs, met = proc
                    met["subject"] = subject
                    met["session"] = session
                    met["run"] = run
                    metadata.append(met)

                    # grow X and labels in a memory efficient way. can be slow
                    if return_epochs:
                        X.append(x)
                    else:
                        X = np.append(X, x, axis=0) if len(X) else x
                    labels = np.append(labels, lbs, axis=0)

        metadata = pd.concat(metadata, ignore_index=True)
        if return_epochs:
            X = mne.concatenate_epochs(X)
        return X, labels, metadata
def get_data ( self , dataset , subjects = None , return_epochs = False ) : if not self . is_valid ( dataset ) : message = "Dataset {} is not valid for paradigm" . format ( dataset . code ) raise AssertionError ( message ) data = dataset . get_data ( subjects ) self . prepare_process ( dataset ) X = [ ] if return_epochs else np . array ( [ ] ) labels = [ ] metadata = [ ] for subject , sessions in data . items ( ) : for session , runs in sessions . items ( ) : for run , raw in runs . items ( ) : proc = self . process_raw ( raw , dataset , return_epochs = return_epochs ) if proc is None : # this mean the run did not contain any selected event # go to next continue x , lbs , met = proc met [ "subject" ] = subject met [ "session" ] = session met [ "run" ] = run metadata . append ( met ) # grow X and labels in a memory efficient way. can be slow if return_epochs : X . append ( x ) else : X = np . append ( X , x , axis = 0 ) if len ( X ) else x labels = np . append ( labels , lbs , axis = 0 ) metadata = pd . concat ( metadata , ignore_index = True ) if return_epochs : X = mne . concatenate_epochs ( X ) return X , labels , metadata