Commit 60cb7f30 authored by kinuthia's avatar kinuthia
Browse files

Merge branch 'main' into ericsson/test-linux-runner

parents f29aaf76 dabab8c0
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -11,9 +11,11 @@ venv/
*.bs
*.192
mc.double
experiments/selection/*/proc_input/*.wav
experiments/selection/*/proc_input/*.pcm
experiments/selection/*/proc_input/cat*/*.wav
experiments/selection/*/proc_input/cat*/*.csv
experiments/selection/*/proc_input/cat*/*.pcm
experiments/selection/*/proc_output/
experiments/selection/*/config/*cat*-lab_*.yml
*~
tests/temp_output_*
tests/cut
+4 −3
Original line number Diff line number Diff line
@@ -37,9 +37,10 @@ stages:
  # NOTE: CODEC_DIR has to be in PATH
  - cd $CODEC_DIR
  # make sure that we are at latest main
  # TODO: temporarily use the RC1a tag
  # TODO: temporarily use the RC1b tag
  - git restore .
  - git checkout 20230511-RC1a-listening-tests
  - git fetch
  - git checkout 20230516-RC1b-listening-tests
  - echo "--------------------------------------------"
  - echo "Building codec on commit $(git rev-parse HEAD --short)"
  - echo "--------------------------------------------"
@@ -81,7 +82,7 @@ experiments:
  script:
    - *print-common-info
    - *get-codec-binaries
    - python3 -m pytest tests/test_experiments.py -n auto | tee log.txt
    - python3 -m pytest tests/test_experiments.py::test_generate_test_items -n auto | tee log.txt
  artifacts:
    paths:
      - experiments/selection/*/proc_output/*.log
+30 −3
Original line number Diff line number Diff line
@@ -690,8 +690,35 @@ ISM

Please refer to [the notebook](./examples/audiotools.ipynb) for an overview.

# Selection test experiments
# How to generate the configs and process items for the selection test experiments

The folder `experiments/selection` contains a directory skeleton for processing items for the various selection test experiments including the config files. E.g. for processing the items for BS1534-1a, the input files need to be put into `experiments/selection/BS1534-1a/proc_input`, then execute `python3 -m ivas_processing_scripts experiments/selection/BS1534-1a/config/BS1534-1a.yml`. The output files will be in `experiments/selection/BS1534-1a/proc_output`, in subfolders per conditions.
The script `generate_test.py` is used to generate config files and process items for the selection test experiments:
```
usage: generate_test.py [-h] [--no_parallel] [--create_cfg_only] exp_lab_pairs [exp_lab_pairs ...]

Generate config files and process files for selecton experiments. Experiment names and lab ids must be given as comma-separated pairs (e.g. 'P800-5,b BS1534-4a,d ...')

positional arguments:
  exp_lab_pairs      The combinations of experiment/lab-id that you want to generate, separated by whitespace. Experiment and lab id need to be separated by a comma.

Note that for P800 experiments, there are separate configs per category as different background noises need to be specified. Thus, there are several config files with `-catX` suffix available. The background noise files need to be put into `experiments/selection/P800-X/background_noise`. To generate all categories, there is a convenience script `create_items_p800.py` in the repository root folder.
 No newline at end of file
options:
  -h, --help         show this help message and exit
  --no_parallel      If given, configs will not be run in parallel
  --create_cfg_only  If given, only create the configs and folder structure without processing items
```
Before running the script, one needs to put the input files in the respective input folder (including the background noise files, see below). If input files are missing, the script will complain ad stop. For example, for processing tests P800-3 and BS1534-4a for labs b and d, respectively, command line would look like this (no whitespace between the commas!):
```
python3 generate_test.py P800-3,b BS1534-4a,d
```

Tests are processed separately per category and per lab (as some values in the configs are dependent on category and lab). For each experiment, a static base config is stored from which the actual configs are generated (identfied by the suffix `catX-lab_Y.yml`). For P800 tests, there are 6 categories each. The BS1534 experiments do not define categories, except for the MASA ones (BAS534-7a/b) - there one might mix FOA and HOA2 input material, so ther eare 2 categories for those in the scripts (category 1 for FOA, category 2 for HOA2). In `experiments/selection/` there is a folder structure prepared for all selection experiments, in which you have to put the input files for your test. For example, for P800-1: 
```
experiments/selection/P800-1/
├── background_noise    <--- put your background files in here and name them as background_noisecatX.wav. Not all experiments use background noise
├── config              <--- contains base config, generated configs will be stored here, too
│   ├── P800-1.yml
├── proc_input
│   ├── catX            <--- put your input files for cat X in here
└── proc_output         <--- collect your output from here, example subfolder below
│   ├── catX-lab_Y      <--- NOTE: this is only generated by the script and not checked in in the repository
```
 No newline at end of file

create_items_p800.py

deleted100644 → 0
+0 −33
Original line number Diff line number Diff line
#! /usr/bin/env python3
import argparse
from pathlib import Path

from ivas_processing_scripts import main as generate_test
from ivas_processing_scripts.utils import apply_func_parallel

P800_TESTS = [f"P800-{i}" for i in range(1, 8)]


class Arguments:
    def __init__(self, config):
        self.config = config
        self.debug = False
        # used to overwrite the multiprocessing key in the configs to rather parallelize on category level
        self.multiprocessing = False


def create_items(testname):
    p800_path = Path(f"experiments/selection/{testname}")
    p800_cfgs = p800_path.joinpath("config").glob("P800*cat*.yml")

    args = [Arguments(str(cfg)) for cfg in p800_cfgs]
    apply_func_parallel(generate_test, zip(args), type="mp")


# if is necessary here so that multiprocessing does not crash
if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("testname", choices=P800_TESTS)
    args = parser.parse_args()

    create_items(args.testname)
+11 −0
Original line number Diff line number Diff line
@@ -65,6 +65,13 @@ input:
    fmt: "HOA3"
    ### Input sampling rate in Hz needed for headerless audio files; default = 48000
    # fs: 32000
    ### Enable check for input files being aligned to a integer multiple of a given length in ms.
    ### If a file is not aligned, a warning will be issued. If the input format has metadata or force is true, an error is raised instead.
    # aligned_to:
    ### alignment length in ms, is needed if aligned_to is used
    #     len: 20
    ### default: false
    #     force: true

################################################
### Pre-processing on individual items
@@ -112,6 +119,10 @@ input:
    # preamble: 10000
    ### Flag wheter to use noise (amplitude +-4) for the preamble or silence; default = false (silence)
    # preamble_noise: true
    ### Specify postamble duration in ms. Postamble is added after concatenation and possible signal repetition. defaut = 0
    # postamble: 20
    ### Flag wheter to use noise (amplitude +-4) for the postamble or silence; default = false (silence)
    # postamble_noise: true
    ### Additive background noise
    # background_noise:
        ### SNR for background noise in dB; REQUIRED for prerecorded background noise and ignored for low level noise
Loading