From 750636573dee8b23ba45f46858158fd196649628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Mon, 15 Sep 2025 11:56:45 +0200 Subject: [PATCH] Copy missing reference files for P.800 preliminaries --- .../characterization/p800_preliminaries.py | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/collection-scripts/characterization/p800_preliminaries.py b/collection-scripts/characterization/p800_preliminaries.py index 2055be3e..1671d68d 100644 --- a/collection-scripts/characterization/p800_preliminaries.py +++ b/collection-scripts/characterization/p800_preliminaries.py @@ -55,21 +55,28 @@ def copy_preliminaries(root_dir, config_yaml): for item in exp_cfg["preliminaries"]: cat = item["category"] - cond = item["label"] + # need to copy the reference files for every condition as well + conds = ["c01", item["label"]] # Find the condition folder in proc_output for proc_out in proc_out_list: - src = proc_out / f"{cat}*" / f"out_{LOUDNESS_MAP[cat]}LKFS" / cond + for cond in conds: + src = proc_out / f"{cat}*" / f"out_{LOUDNESS_MAP[cat]}LKFS" / cond / "*s07.c*.wav" - for file in glob.glob(str(src / "*s07.c*.wav")): - print(f" Copying {file} -> {out_dir}") + for file in glob.glob(str(src), recursive=True): + print(f" Copying {file} -> {out_dir}") - if (out_dir / Path(file).name).is_file(): - raise FileExistsError( - f"File {file} already exists in {out_dir}" - ) + filename = Path(file).name - shutil.copy(file, out_dir) + if (out_dir / filename).is_file(): + if cond != "c01": + raise FileExistsError( + f"File {file} already exists in {out_dir}" + ) + else: + print(f" c01 condition already copied, skipping: {filename}") + + shutil.copy(file, out_dir) print("All done.") -- GitLab