Commit 3564eb74 authored by Jan Kiene's avatar Jan Kiene
Browse files

handle concatenation order in test by patching

parent fb9da90f
Loading
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ def setup_input_files_for_config(config):
    dummy_md_files = FORMAT_TO_METADATA_FILES.get(input_fmt, list())

    # copy input files
    files_copied = list()
    for f in dummy_input_files:
        f_out = input_path.joinpath(f.name).resolve().absolute()
        # need at least 2s of input files for gen-patt to be happy (can not keep the tolerance for 50 frames only)
@@ -86,6 +87,8 @@ def setup_input_files_for_config(config):
            md_f_out = ".".join([str(f_out), suffix])
            shutil.copy(md_f, md_f_out)

        files_copied.append(f_out.name)

    # create background noise files with white noise
    if "background_noise" in config.preprocessing_2:
        # always set the same seed to have reproducible test noises
@@ -98,6 +101,8 @@ def setup_input_files_for_config(config):
        ).absolute()
        write(bg_noise_path, noise)

    return files_copied


def all_lengths_equal(cfg):
    output_folder = cfg.output_path
@@ -132,7 +137,11 @@ def test_generate_test_items(exp_lab_pair):
    args = Arguments(str(cfg))
    config = TestConfig(cfg)

    setup_input_files_for_config(config)
    input_filenames = setup_input_files_for_config(config)
    # patch concatenation order
    if config.preprocessing_2.get("concatenate_input", None) is not None:
        config.preprocessing_2["concatenation_order"] = sorted(input_filenames)

    generate_test(args)

    if not all_lengths_equal(config):