diff --git a/umbra/controller.py b/umbra/controller.py index 4efc42158f9935b641550890931cc47a2b13111d..7d2086256a502ff240754059a52567debf8671f4 100644 --- a/umbra/controller.py +++ b/umbra/controller.py @@ -174,11 +174,11 @@ class Controller: source_data = self._filereader.read(file_path, "source") shadows = np.array([]) for shadow_candidate in non_matched_shadows: - task = ut.shadow_regex(shadow_candidate,1, video) #TODO assuming 1 for now, needs to be dynamic later. + participant, task = ut.shadow_regex(shadow_candidate, video) if task is not None: shadow_data = self._filereader.read(shadow_candidate, "shadow") - self._model.add_task(1, video, task, source_data, + self._model.add_task(participant, video, task, source_data, shadow_data) np.append(shadows, shadow_candidate) non_matched_shadows = np.delete(non_matched_shadows, shadows) diff --git a/umbra/model.py b/umbra/model.py index 685347fa0e8004a6ffb9b42a7b22282c1ebbd48b..288ba80128a4086d17422e28c1f7bb0590a09e14 100644 --- a/umbra/model.py +++ b/umbra/model.py @@ -36,8 +36,6 @@ class Model: for trial in self._shadow_tasks: self._stats.analyze(trial) self._analysed = True - self.create_output_frame() - def add_task(self, pnr, vnr, condition, source, shadow): """ Add a task specifying all the necessary information diff --git a/umbra/utils.py b/umbra/utils.py index 0ccae68f352781885e205d9c40e2a0ee74702dae..c53b3583b77481d3a5e8dc15217cfc56690045fe 100644 --- a/umbra/utils.py +++ b/umbra/utils.py @@ -47,22 +47,23 @@ class Utils: return "%02i:%02i:%02i.%03i" % (h, m, s, ms) @staticmethod - def shadow_regex(path, participant, video): + def shadow_regex(path, video): """Find the reduced path based on the participant and video numbers Args: path: the shadow path to check - participant: the participant number video: the video number Returns: the reduced path """ - match = re.search(f"{participant}_(\D+){video}+\.T", path) + match = re.search(f"(\d+)_(\D+){video}+\.T", path) task = None + participant = None if match: - task = match.group(1) - return task + participant = match.group(1) + task = match.group(2) + return participant, task @staticmethod def id_regex(path):