diff --git a/collection-scripts/characterization/p800_preliminaries.py b/collection-scripts/characterization/p800_preliminaries.py index 2055be3e2e36e5cf72f10a8c23df2b4d2fe24fa2..1671d68d85e9901236d0abdd078b324f4081886c 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.")