Skip to content
Snippets Groups Projects
Commit 97cee4cd authored by Haak, R. (Romeo)'s avatar Haak, R. (Romeo)
Browse files

Made matching of participant and videos dynamic.

parent 6b4e32c7
No related branches found
No related tags found
1 merge request!82Sc 129/wrapper
...@@ -174,11 +174,11 @@ class Controller: ...@@ -174,11 +174,11 @@ class Controller:
source_data = self._filereader.read(file_path, "source") source_data = self._filereader.read(file_path, "source")
shadows = np.array([]) shadows = np.array([])
for shadow_candidate in non_matched_shadows: 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: if task is not None:
shadow_data = self._filereader.read(shadow_candidate, shadow_data = self._filereader.read(shadow_candidate,
"shadow") "shadow")
self._model.add_task(1, video, task, source_data, self._model.add_task(participant, video, task, source_data,
shadow_data) shadow_data)
np.append(shadows, shadow_candidate) np.append(shadows, shadow_candidate)
non_matched_shadows = np.delete(non_matched_shadows, shadows) non_matched_shadows = np.delete(non_matched_shadows, shadows)
...@@ -36,8 +36,6 @@ class Model: ...@@ -36,8 +36,6 @@ class Model:
for trial in self._shadow_tasks: for trial in self._shadow_tasks:
self._stats.analyze(trial) self._stats.analyze(trial)
self._analysed = True self._analysed = True
self.create_output_frame()
def add_task(self, pnr, vnr, condition, source, shadow): def add_task(self, pnr, vnr, condition, source, shadow):
""" Add a task specifying all the necessary information """ Add a task specifying all the necessary information
......
...@@ -47,22 +47,23 @@ class Utils: ...@@ -47,22 +47,23 @@ class Utils:
return "%02i:%02i:%02i.%03i" % (h, m, s, ms) return "%02i:%02i:%02i.%03i" % (h, m, s, ms)
@staticmethod @staticmethod
def shadow_regex(path, participant, video): def shadow_regex(path, video):
"""Find the reduced path based on the participant and video numbers """Find the reduced path based on the participant and video numbers
Args: Args:
path: the shadow path to check path: the shadow path to check
participant: the participant number
video: the video number video: the video number
Returns: Returns:
the reduced path the reduced path
""" """
match = re.search(f"{participant}_(\D+){video}+\.T", path) match = re.search(f"(\d+)_(\D+){video}+\.T", path)
task = None task = None
participant = None
if match: if match:
task = match.group(1) participant = match.group(1)
return task task = match.group(2)
return participant, task
@staticmethod @staticmethod
def id_regex(path): def id_regex(path):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment