Skip to content
Commits on Source (4)
......@@ -113,13 +113,14 @@ After the processing is finished, the outputs will be present in the respective
```batch
python collection-scripts\characterization\p800_categorized_samples.py
python collection-scripts\characterization\p800_preliminaries.py
python collection-scripts\characterization\bs1534.py
```
- For MUSHRA tests, the outputs may be used directly, or in case of multi-input format experiments again need to be manually assembled.
- These scripts collect items from each experiments `proc_output*` folder(s) and puts the needed files for the listening test into a `proc_final` folder. This folder needs to be uploaded for the dry run and the final delivery of the listening items to the labs.
### Hash generation
The hashes for the `proc_final` (or `proc_output` for BS.1534 experiments) can be generated using the [get_md5.py](other/get_md5.py) script:
The hashes for the `proc_final` can be generated using the [get_md5.py](other/get_md5.py) script:
```shell
> python other/get_md5.py --help
......@@ -190,6 +191,13 @@ python other/get_md5.py experiments/characterization/P800-1/proc_final p800-1_ha
│ ├── <item_name.wav>
│ ├── <item_name.wav.{0,1,2,3}.csv> for ISM metadata
│ └── <item_name.wav.met> for MASA metadata
├── proc_final
│ ├── c01
│ └── <item_name.c01.wav>
│ ├── c02...
│ ├── ...c08
│ └── preliminaries
│ └── <item_name.c01.wav>
└── proc_output[_FMT] # for multiple input formats, suffix is present
├── c01
│ └── <item_name.c01.wav>
......@@ -200,7 +208,7 @@ python other/get_md5.py experiments/characterization/P800-1/proc_final p800-1_ha
# Quick guide: How to set up a listening test
This section describes step by step how to set up a listening test according to the Processing Plan (IVAS-7) and Test Plan (IVAS-8).
In the following sections the only purpose of the curly brackets is to mark the variables that thave to be replaced with the actual values.
In the following sections the only purpose of the curly brackets is to mark the variables that have to be replaced with the actual values.
## P800
......
import argparse
import glob
import shutil
import re
from pathlib import Path
PRELIMINARY_SUBSTRINGS = ["s13", "s14", "s15", "s16"]
PRELIMINARY_PATTERN = re.compile(r"dm[0-9]*a[1-9](s[0-9]*)\.c[0-1][0-9]\.wav")
def repo_root_dir() -> Path:
this_dir = Path(__file__).parent
return this_dir.parent.parent
def copy_final_items(verbose: bool = False):
files_copied = 0
for exp_dir in map(
Path, glob.glob(str(repo_root_dir() / "experiments/characterization/BS1534-*/"))
):
exp_dir = Path(exp_dir)
final_dir = exp_dir / "proc_final"
prelim_dir = final_dir / "preliminaries"
prelim_dir.mkdir(parents=True, exist_ok=True)
files_copied = 0
for proc_output in exp_dir.glob("proc_output*"):
condition_dirs = proc_output.glob("c0?")
for condition_dir in condition_dirs:
target_dir = final_dir / condition_dir.name
target_dir.mkdir(parents=True, exist_ok=True)
for item in condition_dir.glob("*.wav"):
item_target = target_dir / item.name
m = re.search(PRELIMINARY_PATTERN, item.name)
assert m is not None
item_number_substr = m.groups()[0]
if item_number_substr in PRELIMINARY_SUBSTRINGS:
item_target = prelim_dir / item.name
print(
f"Copying {item.relative_to(Path.cwd())} to {item_target.relative_to(Path.cwd())}"
)
if item_target.is_file():
print(
f"WARNING: item {item_target.name} already exists in target dir, overwriting"
)
shutil.copy(item, item_target)
files_copied += 1
print(f"Done. {files_copied} files copied.")
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Copy samples into proc_final/cXX directories for BS1534 experiments."
)
parser.add_argument("-v", "--verbose", action="store_true")
parsed = parser.parse_args()
copy_final_items(verbose=parsed.verbose)