Esempio n. 1
0
def batch_process(rootdir, pid, processor, sid_list="all", pool=1):
    """
    Processes the given participants' sessions. If sid_list is not provided,
    all sessions are processed.

    Parameters
    ----------
    rootdir : str
        The path to the root of the data file structure.
    pid : str
        The participant ID for which to process the files (e.g. 'p0').
    sid_list : list of strings, optional
        List of session IDs to process (e.g. ['arm1', 'arm2']). The default is
        'all', which means the function will search for all of the given
        participant's sessions and process them.
    pool : int, default 1
        The number of processes to start for processing. Default is 1, which
        means the function will not use the multiprocessing module.
    """
    if sid_list == "all":
        sid_list = filestruct.get_session_list(rootdir, pid)

    if pool > 1:
        pool = Pool(processes=pool)
        pool.map(_process_session, [(rootdir, pid, sid, processor) for sid in sid_list])
        pool.close()
    else:
        for sid in sid_list:
            _process_session((rootdir, pid, sid, processor))
Esempio n. 2
0
    def init_base_session(self):
        if self.simulation is None and self.isVisible():
            self.init_simulation()

        self.pid = self.base_session.pid
        self.ui.trainingList.clear()
        self.sid_list = filestruct.get_session_list(
            self.cfg.data_path, self.pid)
        for sid in self.sid_list:
            item = QtWidgets.QListWidgetItem(sid, self.ui.trainingList)
            item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
            item.setCheckState(QtCore.Qt.Unchecked)

        self.lefty = True if self.base_session.hand == 'left' else False
Esempio n. 3
0
    def on_participant_selection(self, text):
        pid = str(text)
        if pid == '':
            return

        self.pid = pid

        self.sid_list = filestruct.get_session_list(self.data_path, self.pid)

        self.ui.sessionList.clear()
        for sid in self.sid_list:
            QtWidgets.QListWidgetItem(sid, self.ui.sessionList)

        self.participant_selected.emit(pid)
Esempio n. 4
0
    def on_participant_selection(self, text):
        pid = str(text)
        if pid == '':
            return

        self.pid = pid

        self.sid_list = filestruct.get_session_list(self.data_path,
                                                    self.pid,
                                                    search=self.session_filter)

        self.ui.sessionList.clear()
        for sid in self.sid_list:
            QtWidgets.QListWidgetItem(sid, self.ui.sessionList)

        self.participant_selected.emit(pid)
Esempio n. 5
0
    def init_base_session(self):
        if self.simulation is None and self.isVisible():
            self.init_simulation()

        self.pid = self.base_session.pid
        self.ui.trainingList.clear()
        self.sid_list = filestruct.get_session_list(self.cfg.data_path,
                                                    self.pid,
                                                    search="train")
        for sid in self.sid_list:
            item = QtWidgets.QListWidgetItem(sid, self.ui.trainingList)
            item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
            item.setCheckState(QtCore.Qt.Unchecked)
            try:
                filestruct.find_feature_file(self.cfg.data_path, self.pid, sid)
            except:
                item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEnabled)

        self.lefty = True if self.base_session.hand == 'left' else False