diff --git a/README.md b/README.md index d66299ef3f389a6a907124fc5582beed0bded56d..fad86d005c863f5fb2eaab32e36505a641e9d043 100755 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. ## Requirements -- Python >= 3.9 +- Python 3.13.7 (may work with lower python versions, not guaranteed) - numpy, scipy and pyyaml ([see requirements.txt](./requirements.txt)) --- diff --git a/collection-scripts/characterization/p800_categorized_samples.py b/collection-scripts/characterization/p800_categorized_samples.py index 4bec5f0c5b370352f60c90fe08baa066e244c4fd..f889bf3ee9e2d4cd33307d79e24aae8dbdae39c8 100644 --- a/collection-scripts/characterization/p800_categorized_samples.py +++ b/collection-scripts/characterization/p800_categorized_samples.py @@ -4,7 +4,6 @@ import re import shutil from pathlib import Path - # table 5 from IVAS-8b TABLE_5 = { "s01": { @@ -66,7 +65,9 @@ def repo_root_dir() -> Path: def copy_final_items(verbose: bool = False): files_copied = 0 - for exp_dir in map(Path, glob.glob(str(repo_root_dir() / "experiments/characterization/P800-*/"))): + for exp_dir in map( + Path, glob.glob(str(repo_root_dir() / "experiments/characterization/P800-*/")) + ): exp_dir = Path(exp_dir) final_dir = exp_dir / "proc_final" @@ -76,28 +77,43 @@ def copy_final_items(verbose: bool = False): for sample, categories_map in TABLE_5.items(): for category, loudness in categories_map.items(): - item_dir_pattern = proc_output / glob.escape(category) / f"out_{glob.escape(str(loudness))}LKFS" / "c*" + item_dir_pattern = ( + proc_output + / glob.escape(category) + / f"out_{glob.escape(str(loudness))}LKFS" + / "c*" + ) item_filename_pattern = f"*{glob.escape(sample)}.c*.wav" - items_to_copy = list(map(Path, glob.glob(str(item_dir_pattern / item_filename_pattern)))) + items_to_copy = list( + map(Path, glob.glob(str(item_dir_pattern / item_filename_pattern))) + ) if not items_to_copy: if verbose: - print(f"Could not find processed item for {sample}, {category}, {loudness}LKFS, skipping") + print( + f"Could not find processed item for {sample}, {category}, {loudness}LKFS, skipping" + ) continue for item_to_copy in items_to_copy: - match = re.match(r".*/c(\d+)/[^/]*s\d+\.c\d+\.wav$", str(item_to_copy.as_posix())) + match = re.match( + r".*/c(\d+)/[^/]*s\d+\.c\d+\.wav$", str(item_to_copy.as_posix()) + ) assert match, item_to_copy condition = match.group(1) item_target_dir = final_dir / f"c{condition}" item_target_dir.mkdir(parents=True, exist_ok=True) - print(f"Copying {item_to_copy.relative_to(Path.cwd())} to {item_target_dir.relative_to(Path.cwd())}") + print( + f"Copying {item_to_copy.relative_to(Path.cwd())} to {item_target_dir.relative_to(Path.cwd())}" + ) if (item_target_dir / item_to_copy.name).is_file(): - print(f"WARNING: item {item_to_copy.name} already exists in target dir, overwriting") + print( + f"WARNING: item {item_to_copy.name} already exists in target dir, overwriting" + ) shutil.copy(item_to_copy, item_target_dir) @@ -107,7 +123,9 @@ def copy_final_items(verbose: bool = False): if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Copy samples into proc_final/cXX directories for P.800 experiments.") + parser = argparse.ArgumentParser( + description="Copy samples into proc_final/cXX directories for P.800 experiments." + ) parser.add_argument("-v", "--verbose", action="store_true") parsed = parser.parse_args() diff --git a/collection-scripts/characterization/p800_preliminaries.py b/collection-scripts/characterization/p800_preliminaries.py index 9decfa1b75cf7d3ef0d1eee46fbfd760fea757fb..ca2aa963210cecc397f365c536bcd023e038333e 100644 --- a/collection-scripts/characterization/p800_preliminaries.py +++ b/collection-scripts/characterization/p800_preliminaries.py @@ -65,7 +65,9 @@ def copy_preliminaries(root_dir, config_yaml): print(f" Copying {file} -> {out_dir}") if (out_dir / Path(file).name).is_file(): - raise FileExistsError(f"File {file} already exists in {out_dir}") + raise FileExistsError( + f"File {file} already exists in {out_dir}" + ) shutil.copy(file, out_dir) @@ -73,8 +75,13 @@ def copy_preliminaries(root_dir, config_yaml): if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Copy preliminaries into proc_final/preliminaries directory for P.800 experiments.") + parser = argparse.ArgumentParser( + description="Copy preliminaries into proc_final/preliminaries directory for P.800 experiments." + ) parsed = parser.parse_args() - copy_preliminaries(repo_root_dir() / "experiments" / "characterization", this_dir() / "p800_preliminaries.yml") + copy_preliminaries( + repo_root_dir() / "experiments" / "characterization", + this_dir() / "p800_preliminaries.yml", + ) diff --git a/other/get_md5.py b/other/get_md5.py index a5e9c9ed462ab63b674d412dc17b29fe9a88be37..9ad4ed2f5649bc3c0daf5ff0393e205dff2d8e8b 100644 --- a/other/get_md5.py +++ b/other/get_md5.py @@ -28,9 +28,9 @@ # the United Nations Convention on Contracts on the International Sales of Goods. import argparse -from pathlib import Path -from hashlib import md5 from collections import Counter +from hashlib import md5 +from pathlib import Path def get_hash_line_for_file(file: Path, output_dir: Path): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..97a189ee9cfbfde37c2d0de50fb60b43551b201f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[project] +name = "ivas-processing-scripts" +version = "2025.09" +dependencies = ["numpy>=2.0.2,<3", "pyyaml>=6.0.2,<7", "scipy>=1.13.1,<2"] +requires-python = "==3.13.7" +maintainers = [ + { name = "Archit Tamarapu", email = "archit.tamarapu@iis.fraunhofer.de" }, +] +description = "Scripts to setup and run the IVAS characterization and selection listening tests" +readme = "README.md" +license-files = ["LICENSE.md"] diff --git a/requirements.txt b/requirements.txt index 74279e75274374d26604bf90d14e3b6c8514a20b..9863e16dc63d8bdf8571311a009ca454d3f8b60d 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -numpy -pyyaml -scipy +numpy>=2.0.2,<3 +pyyaml>=6.0.2,<7 +scipy>=1.13.1,<2 \ No newline at end of file