Commit 257b5b19 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix for not finding trajectories due to 20ms alignment of signals

parent 9d12b137
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -158,8 +158,8 @@ def main(args):

        cfg.metadata_path = metadata

        # check for head tracking trajectories
        trajectories = check_trajectories(cfg.items_list)
        # check for head tracking trajectories in input path (items might be copied to 20ms aligned folder)
        trajectories = check_trajectories(cfg.items_list, cfg.input_path)
        if trajectories:
            cfg.trajectories = trajectories
            # print info about found and used trajectories
+7 −6
Original line number Diff line number Diff line
@@ -36,13 +36,17 @@ from typing import Tuple, Union


def trajectory_search(
    item_name: Union[str, Path],
    item_name: Path,
    search_folder: Path,
) -> Tuple:
    """Search for head tracking trajectories with item_name.wav.{pre,post}.csv"""

    if not item_name:
        raise ValueError("No item name provided, can't search for trajectories")

    if search_folder is not None:
        item_name = search_folder.joinpath(item_name.name)

    trj_file_pre = item_name.with_stem(f"{item_name.name}.pre").with_suffix(".csv")
    trj_file_post = item_name.with_stem(f"{item_name.name}.post").with_suffix(".csv")

@@ -52,12 +56,9 @@ def trajectory_search(
    return pre_trj, post_trj


def check_trajectories(item_names: list) -> list[Tuple]:
def check_trajectories(item_names: list, search_folder: Path) -> list[Tuple]:
    """Find head tracking trajectories"""

    list_trj = []

    for item in item_names:
        list_trj.append(trajectory_search(item))
    list_trj = [trajectory_search(Path(i), search_folder) for i in item_names]

    return list_trj