From de54bc09c63fbca61021ca9a49b62b1b28d70556 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 21 Apr 2023 14:42:47 +0200 Subject: [PATCH 1/8] allow relative paths at input --- ivas_processing_scripts/processing/chains.py | 2 +- ivas_processing_scripts/utils.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 7f54330d..bb109fdd 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -75,7 +75,7 @@ def init_processing_chains(cfg: TestConfig) -> None: # list items in input directory cfg.items_list = list_audio( - cfg.input_path, absolute=True, select_list=getattr(cfg, "input_select", None) + cfg.input_path, absolute=False, select_list=getattr(cfg, "input_select", None) ) if not cfg.items_list: raise SystemExit( diff --git a/ivas_processing_scripts/utils.py b/ivas_processing_scripts/utils.py index f271ec76..ac1ae9f6 100755 --- a/ivas_processing_scripts/utils.py +++ b/ivas_processing_scripts/utils.py @@ -115,8 +115,6 @@ def list_audio(path: str, absolute: bool = False, select_list: list = None) -> l f for f in path.iterdir() if f.suffix in ALLOWED_INPUT_EXT ] else: - if not absolute: - path = path.name ext = path.suffix if ext in ALLOWED_INPUT_EXT: audio_list.append(path) -- GitLab From bc8e76c9e4cbf1da5a15a6d89722d8d4ddbf48c0 Mon Sep 17 00:00:00 2001 From: Treffehn Date: Wed, 26 Apr 2023 17:28:14 +0200 Subject: [PATCH 2/8] relative path available for input, output, executables, background noise and error patterns --- ivas_processing_scripts/binary_paths.yml | 2 +- ivas_processing_scripts/processing/chains.py | 26 ++++++++++++++----- ivas_processing_scripts/processing/config.py | 4 +-- .../processing/processing.py | 6 ++--- ivas_processing_scripts/utils.py | 20 +++++--------- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/ivas_processing_scripts/binary_paths.yml b/ivas_processing_scripts/binary_paths.yml index a0ce4f5b..abd145b0 100644 --- a/ivas_processing_scripts/binary_paths.yml +++ b/ivas_processing_scripts/binary_paths.yml @@ -21,7 +21,7 @@ # ### Binary for frame error pattern application # eid-xor: "path/to/binary/eid-xor" # ### Binary for error pattern generation -# gen-patt: "path/to/binary/gen-patt" +gen-patt: ".\\ivas_processing_scripts\\bin\\bla\\gen-patt" # ### Binary for random offset/seed generation # random: "path/to/binary/random" # ### Binary for JBM network similulator diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 8a4389bf..c2d20aee 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -31,6 +31,7 @@ # from typing import Optional +from pathlib import Path from ivas_processing_scripts.processing.config import TestConfig from ivas_processing_scripts.processing.evs import EVS @@ -79,7 +80,7 @@ def init_processing_chains(cfg: TestConfig) -> None: # list items in input directory cfg.items_list = list_audio( - cfg.input_path, absolute=False, select_list=getattr(cfg, "input_select", None) + cfg.input_path, select_list=getattr(cfg, "input_select", None) ) if not cfg.items_list: raise SystemExit( @@ -133,9 +134,14 @@ def get_preprocessing_2(cfg: TestConfig) -> dict: pre2_cfg = cfg.preprocessing_2 background_cfg = pre2_cfg.get("background_noise", None) if background_cfg: + if background_cfg.get("background_noise_path", None) is not None: + background_noise = Path(background_cfg.get("background_noise_path", None)).resolve() + else: + background_noise = None + background = { "snr": background_cfg.get("snr", None), - "background_noise_path": background_cfg.get("background_noise_path", None), + "background_noise_path": background_noise, "seed_delay": background_cfg.get("seed_delay", 0), "master_seed": cfg.master_seed, "output_fmt": cfg.postprocessing["fmt"], @@ -246,11 +252,15 @@ def get_processing_chain( tx_cfg_tmp = cond_cfg["tx"] else: tx_cfg_tmp = cfg.tx + if tx_cfg_tmp.get("error_pattern", None) is not None: + error_pattern = Path(tx_cfg_tmp.get("error_pattern", None)).resolve() + else: + error_pattern = None if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_pattern": error_pattern, "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), @@ -258,7 +268,7 @@ def get_processing_chain( elif tx_cfg_tmp.get("type", None) == "JBM": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_pattern": error_pattern, "error_profile": tx_cfg_tmp.get("error_profile", None), "n_frames_per_packet": tx_cfg_tmp.get("n_frames_per_packet", None), } @@ -305,11 +315,15 @@ def get_processing_chain( tx_cfg_tmp = cond_cfg["tx"] else: tx_cfg_tmp = cfg.tx + if tx_cfg_tmp.get("error_pattern", None) is not None: + error_pattern = Path(tx_cfg_tmp.get("error_pattern", None)).resolve() + else: + error_pattern = None if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_pattern": error_pattern, "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), @@ -317,7 +331,7 @@ def get_processing_chain( elif tx_cfg_tmp.get("type", None) == "JBM": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_pattern": error_pattern, "error_profile": tx_cfg_tmp.get("error_profile", None), "n_frames_per_packet": tx_cfg_tmp.get("n_frames_per_packet", None), } diff --git a/ivas_processing_scripts/processing/config.py b/ivas_processing_scripts/processing/config.py index b281e2a3..9b5ef96d 100755 --- a/ivas_processing_scripts/processing/config.py +++ b/ivas_processing_scripts/processing/config.py @@ -90,8 +90,8 @@ class TestConfig: self._yaml_dump = self._dump_yaml(cfg) # convert to Path - self.input_path = Path(self.input_path) - self.output_path = Path(self.output_path) + self.input_path = Path(self.input_path).resolve() + self.output_path = Path(self.output_path).resolve() def _parse_yaml(self, filename): """parse configuration file""" diff --git a/ivas_processing_scripts/processing/processing.py b/ivas_processing_scripts/processing/processing.py index a4fcb2ff..0d2097fa 100755 --- a/ivas_processing_scripts/processing/processing.py +++ b/ivas_processing_scripts/processing/processing.py @@ -223,7 +223,7 @@ def preprocess(cfg, logger): # update the configuration to use preprocessing outputs as new inputs cfg.items_list = list_audio( - cfg.out_dirs[0], absolute=False, select_list=getattr(cfg, "input_select", None) + cfg.out_dirs[0], select_list=getattr(cfg, "input_select", None) ) # Re-ordering items based on concatenation order @@ -274,7 +274,7 @@ def preprocess_2(cfg, logger): # update the configuration to use preprocessing 2 outputs as new inputs cfg.items_list = list_audio( - cfg.out_dirs[0], absolute=False, select_list=getattr(cfg, "input_select", None) + cfg.out_dirs[0], select_list=getattr(cfg, "input_select", None) ) # Re-ordering items based on concatenation order @@ -313,7 +313,7 @@ def reverse_process_2(cfg, logger): # if no concatenation read files from folder out_paths_splits = [] for out_dir in cfg.out_dirs: - list_audio_dir = list_audio(out_dir, absolute=True) + list_audio_dir = list_audio(out_dir) out_paths_splits.append(list_audio_dir) if cfg.postprocessing["fmt"].startswith("ISM"): out_meta_splits = [] diff --git a/ivas_processing_scripts/utils.py b/ivas_processing_scripts/utils.py index f9bc9781..4f9c878b 100755 --- a/ivas_processing_scripts/utils.py +++ b/ivas_processing_scripts/utils.py @@ -93,7 +93,7 @@ class DirManager: ) -def list_audio(path: str, absolute: bool = False, select_list: list = None) -> list: +def list_audio(path: str, select_list: list = None) -> list: """ Return list with all files with ALLOWED_INPUT_EXT found under the given path. @@ -105,21 +105,13 @@ def list_audio(path: str, absolute: bool = False, select_list: list = None) -> l if path.exists(): if path.is_dir(): - if absolute: - [audio_list.extend(list(path.glob(ext))) for ext in ALLOWED_INPUT_EXT] - audio_list = [ - path.joinpath(f) - for f in path.iterdir() - if f.suffix in ALLOWED_INPUT_EXT - ] - else: - audio_list = [ - f for f in path.iterdir() if f.suffix in ALLOWED_INPUT_EXT - ] + audio_list = [ + f.resolve() for f in path.iterdir() if f.suffix in ALLOWED_INPUT_EXT + ] else: ext = path.suffix if ext in ALLOWED_INPUT_EXT: - audio_list.append(path) + audio_list.append(path.resolve()) # filter according to select list if select_list: @@ -166,7 +158,7 @@ def find_binary( else: if logger: logger.debug(f"Found binary {bin}") - return Path(bin) + return Path(bin).resolve() def get_devnull(): -- GitLab From 81d8e0c564c8985f2cbe3245e7198c75a2efb4c1 Mon Sep 17 00:00:00 2001 From: Treffehn Date: Wed, 26 Apr 2023 17:36:46 +0200 Subject: [PATCH 3/8] relative path supported for IVAS and EVS encoder and decoder and head rotation trajectory --- ivas_processing_scripts/processing/chains.py | 32 ++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index c2d20aee..25483763 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -283,6 +283,14 @@ def get_processing_chain( preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 + if cod_cfg.get("bin", None) is not None: + cod_bin = Path(cod_cfg.get("bin", None)).resolve() + else: + cod_bin = None + if dec_cfg.get("bin", None) is not None: + dec_bin = Path(dec_cfg.get("bin", None)).resolve() + else: + dec_bin = None chain["processes"].append( EVS( @@ -291,9 +299,9 @@ def get_processing_chain( "in_fs": tmp_in_fs, "out_fs": dec_cfg.get("fs", tmp_in_fs), "bitrate": bitrate, - "cod_bin": cod_cfg.get("bin"), + "cod_bin": cod_bin, "cod_opts": cod_cfg.get("opts"), - "dec_bin": dec_cfg.get("bin"), + "dec_bin": dec_bin, "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx": tx_cfg, @@ -346,7 +354,14 @@ def get_processing_chain( preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 - + if cod_cfg.get("bin", None) is not None: + cod_bin = Path(cod_cfg.get("bin", None)).resolve() + else: + cod_bin = None + if dec_cfg.get("bin", None) is not None: + dec_bin = Path(dec_cfg.get("bin", None)).resolve() + else: + dec_bin = None chain["processes"].append( IVAS( { @@ -355,9 +370,9 @@ def get_processing_chain( "out_fmt": dec_cfg.get("fmt", tmp_out_fmt), "out_fs": dec_cfg.get("fs", tmp_in_fs), "bitrate": bitrate, - "cod_bin": cod_cfg.get("bin"), + "cod_bin": cod_bin, "cod_opts": cod_cfg.get("opts"), - "dec_bin": dec_cfg.get("bin"), + "dec_bin": dec_bin, "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx": tx_cfg, @@ -373,6 +388,11 @@ def get_processing_chain( raise SystemExit(f"Unknown condition {condition}!") # add postprocessing step based on condition + if post_cfg.get("trajectory", None) is not None: + trajectory = Path(post_cfg.get("trajectory", None)).resolve() + else: + trajectory = None + chain["processes"].append( Postprocessing( { @@ -386,7 +406,7 @@ def get_processing_chain( "bin_dataset": post_cfg.get("bin_dataset"), "bin_lfe_gain": post_cfg.get("bin_lfe_gain"), "limit": post_cfg.get("limit", True), - "trajectory": post_cfg.get("trajectory"), + "trajectory": trajectory, "multiprocessing": cfg.multiprocessing, "mnru_q": tmp_mnru_q, "esdru_alpha": tmp_esdru_alpha, -- GitLab From a5b1a2f7cb068997ba24f7b680d0ed613492f2fa Mon Sep 17 00:00:00 2001 From: Treffehn Date: Thu, 27 Apr 2023 12:14:22 +0200 Subject: [PATCH 4/8] relative paths for metadata and additonal small function --- .../audiotools/metadata.py | 6 +- ivas_processing_scripts/processing/chains.py | 62 ++++++------------- 2 files changed, 23 insertions(+), 45 deletions(-) diff --git a/ivas_processing_scripts/audiotools/metadata.py b/ivas_processing_scripts/audiotools/metadata.py index d0d44502..6c6466ec 100755 --- a/ivas_processing_scripts/audiotools/metadata.py +++ b/ivas_processing_scripts/audiotools/metadata.py @@ -498,7 +498,9 @@ def check_ISM_metadata( elif len(current_item) == num_objects: # just read out - list_item = current_item + list_item = [] + for c_item in current_item: + list_item.append(Path(c_item).resolve()) else: raise ValueError("Number of objects and metadata does not match.") list_meta.append(list_item) @@ -528,7 +530,7 @@ def metadata_search( ) # check if file exists and add to list if file_name_meta.is_file(): - list_item.append(file_name_meta) + list_item.append(Path(file_name_meta).resolve()) else: raise ValueError(f"Metadata file {file_name_meta} not found.") if len(item_names) == 1: diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 25483763..8dfa55d5 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -134,14 +134,10 @@ def get_preprocessing_2(cfg: TestConfig) -> dict: pre2_cfg = cfg.preprocessing_2 background_cfg = pre2_cfg.get("background_noise", None) if background_cfg: - if background_cfg.get("background_noise_path", None) is not None: - background_noise = Path(background_cfg.get("background_noise_path", None)).resolve() - else: - background_noise = None background = { "snr": background_cfg.get("snr", None), - "background_noise_path": background_noise, + "background_noise_path": get_abs_path(background_cfg.get("background_noise_path", None)), "seed_delay": background_cfg.get("seed_delay", 0), "master_seed": cfg.master_seed, "output_fmt": cfg.postprocessing["fmt"], @@ -252,15 +248,11 @@ def get_processing_chain( tx_cfg_tmp = cond_cfg["tx"] else: tx_cfg_tmp = cfg.tx - if tx_cfg_tmp.get("error_pattern", None) is not None: - error_pattern = Path(tx_cfg_tmp.get("error_pattern", None)).resolve() - else: - error_pattern = None if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": error_pattern, + "error_pattern": get_abs_path(tx_cfg_tmp.get("error_pattern", None)), "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), @@ -268,7 +260,7 @@ def get_processing_chain( elif tx_cfg_tmp.get("type", None) == "JBM": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": error_pattern, + "error_pattern": get_abs_path(tx_cfg_tmp.get("error_pattern", None)), "error_profile": tx_cfg_tmp.get("error_profile", None), "n_frames_per_packet": tx_cfg_tmp.get("n_frames_per_packet", None), } @@ -283,14 +275,6 @@ def get_processing_chain( preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 - if cod_cfg.get("bin", None) is not None: - cod_bin = Path(cod_cfg.get("bin", None)).resolve() - else: - cod_bin = None - if dec_cfg.get("bin", None) is not None: - dec_bin = Path(dec_cfg.get("bin", None)).resolve() - else: - dec_bin = None chain["processes"].append( EVS( @@ -299,9 +283,9 @@ def get_processing_chain( "in_fs": tmp_in_fs, "out_fs": dec_cfg.get("fs", tmp_in_fs), "bitrate": bitrate, - "cod_bin": cod_bin, + "cod_bin": get_abs_path(cod_cfg.get("bin", None)), "cod_opts": cod_cfg.get("opts"), - "dec_bin": dec_bin, + "dec_bin": get_abs_path(dec_cfg.get("bin", None)), "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx": tx_cfg, @@ -323,15 +307,11 @@ def get_processing_chain( tx_cfg_tmp = cond_cfg["tx"] else: tx_cfg_tmp = cfg.tx - if tx_cfg_tmp.get("error_pattern", None) is not None: - error_pattern = Path(tx_cfg_tmp.get("error_pattern", None)).resolve() - else: - error_pattern = None if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": error_pattern, + "error_pattern": get_abs_path(tx_cfg_tmp.get("error_pattern", None)), "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), @@ -339,7 +319,7 @@ def get_processing_chain( elif tx_cfg_tmp.get("type", None) == "JBM": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": error_pattern, + "error_pattern": tx_cfg_tmp.get("error_rate", None), "error_profile": tx_cfg_tmp.get("error_profile", None), "n_frames_per_packet": tx_cfg_tmp.get("n_frames_per_packet", None), } @@ -354,14 +334,7 @@ def get_processing_chain( preamble = cfg.preprocessing_2.get("preamble", 0) else: preamble = 0 - if cod_cfg.get("bin", None) is not None: - cod_bin = Path(cod_cfg.get("bin", None)).resolve() - else: - cod_bin = None - if dec_cfg.get("bin", None) is not None: - dec_bin = Path(dec_cfg.get("bin", None)).resolve() - else: - dec_bin = None + chain["processes"].append( IVAS( { @@ -370,9 +343,9 @@ def get_processing_chain( "out_fmt": dec_cfg.get("fmt", tmp_out_fmt), "out_fs": dec_cfg.get("fs", tmp_in_fs), "bitrate": bitrate, - "cod_bin": cod_bin, + "cod_bin": get_abs_path(cod_cfg.get("bin", None)), "cod_opts": cod_cfg.get("opts"), - "dec_bin": dec_bin, + "dec_bin": get_abs_path(dec_cfg.get("bin", None)), "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx": tx_cfg, @@ -388,11 +361,6 @@ def get_processing_chain( raise SystemExit(f"Unknown condition {condition}!") # add postprocessing step based on condition - if post_cfg.get("trajectory", None) is not None: - trajectory = Path(post_cfg.get("trajectory", None)).resolve() - else: - trajectory = None - chain["processes"].append( Postprocessing( { @@ -406,7 +374,7 @@ def get_processing_chain( "bin_dataset": post_cfg.get("bin_dataset"), "bin_lfe_gain": post_cfg.get("bin_lfe_gain"), "limit": post_cfg.get("limit", True), - "trajectory": trajectory, + "trajectory": get_abs_path(post_cfg.get("trajectory", None)), "multiprocessing": cfg.multiprocessing, "mnru_q": tmp_mnru_q, "esdru_alpha": tmp_esdru_alpha, @@ -415,3 +383,11 @@ def get_processing_chain( ) return chain + + +def get_abs_path(rel_path): + if rel_path is not None: + abs_path = Path(rel_path).resolve() + else: + abs_path = None + return abs_path -- GitLab From af59a12e15e02ec33b8e789ddf79a3423edaa821 Mon Sep 17 00:00:00 2001 From: Treffehn Date: Thu, 27 Apr 2023 16:34:01 +0200 Subject: [PATCH 5/8] changed back yml --- ivas_processing_scripts/binary_paths.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivas_processing_scripts/binary_paths.yml b/ivas_processing_scripts/binary_paths.yml index abd145b0..a0ce4f5b 100644 --- a/ivas_processing_scripts/binary_paths.yml +++ b/ivas_processing_scripts/binary_paths.yml @@ -21,7 +21,7 @@ # ### Binary for frame error pattern application # eid-xor: "path/to/binary/eid-xor" # ### Binary for error pattern generation -gen-patt: ".\\ivas_processing_scripts\\bin\\bla\\gen-patt" +# gen-patt: "path/to/binary/gen-patt" # ### Binary for random offset/seed generation # random: "path/to/binary/random" # ### Binary for JBM network similulator -- GitLab From 76f97e33168a4f922f34fb0f7f493cf6071c2a4a Mon Sep 17 00:00:00 2001 From: Treffehn Date: Fri, 28 Apr 2023 14:34:09 +0200 Subject: [PATCH 6/8] added absolute since resolve does not always work as desired --- ivas_processing_scripts/processing/chains.py | 2 +- ivas_processing_scripts/processing/config.py | 4 ++-- ivas_processing_scripts/utils.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 8dfa55d5..7726bdcd 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -387,7 +387,7 @@ def get_processing_chain( def get_abs_path(rel_path): if rel_path is not None: - abs_path = Path(rel_path).resolve() + abs_path = Path(rel_path).resolve().absolute() else: abs_path = None return abs_path diff --git a/ivas_processing_scripts/processing/config.py b/ivas_processing_scripts/processing/config.py index 9b5ef96d..386f542e 100755 --- a/ivas_processing_scripts/processing/config.py +++ b/ivas_processing_scripts/processing/config.py @@ -90,8 +90,8 @@ class TestConfig: self._yaml_dump = self._dump_yaml(cfg) # convert to Path - self.input_path = Path(self.input_path).resolve() - self.output_path = Path(self.output_path).resolve() + self.input_path = Path(self.input_path).resolve().absolute() + self.output_path = Path(self.output_path).resolve().absolute() def _parse_yaml(self, filename): """parse configuration file""" diff --git a/ivas_processing_scripts/utils.py b/ivas_processing_scripts/utils.py index 4f9c878b..0049073f 100755 --- a/ivas_processing_scripts/utils.py +++ b/ivas_processing_scripts/utils.py @@ -106,12 +106,12 @@ def list_audio(path: str, select_list: list = None) -> list: if path.exists(): if path.is_dir(): audio_list = [ - f.resolve() for f in path.iterdir() if f.suffix in ALLOWED_INPUT_EXT + f.resolve().absolute() for f in path.iterdir() if f.suffix in ALLOWED_INPUT_EXT ] else: ext = path.suffix if ext in ALLOWED_INPUT_EXT: - audio_list.append(path.resolve()) + audio_list.append(path.resolve().absolute()) # filter according to select list if select_list: @@ -158,7 +158,7 @@ def find_binary( else: if logger: logger.debug(f"Found binary {bin}") - return Path(bin).resolve() + return Path(bin).resolve().absolute() def get_devnull(): -- GitLab From 21c6f5c5d04aef46acba0d917eb45c3b439bc54a Mon Sep 17 00:00:00 2001 From: Treffehn Date: Fri, 28 Apr 2023 15:19:33 +0200 Subject: [PATCH 7/8] formatting --- ivas_processing_scripts/processing/chains.py | 18 +++++++++++++----- ivas_processing_scripts/utils.py | 4 +++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 7726bdcd..402c5f01 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -30,8 +30,8 @@ # the United Nations Convention on Contracts on the International Sales of Goods. # -from typing import Optional from pathlib import Path +from typing import Optional from ivas_processing_scripts.processing.config import TestConfig from ivas_processing_scripts.processing.evs import EVS @@ -137,7 +137,9 @@ def get_preprocessing_2(cfg: TestConfig) -> dict: background = { "snr": background_cfg.get("snr", None), - "background_noise_path": get_abs_path(background_cfg.get("background_noise_path", None)), + "background_noise_path": get_abs_path( + background_cfg.get("background_noise_path", None) + ), "seed_delay": background_cfg.get("seed_delay", 0), "master_seed": cfg.master_seed, "output_fmt": cfg.postprocessing["fmt"], @@ -252,7 +254,9 @@ def get_processing_chain( if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": get_abs_path(tx_cfg_tmp.get("error_pattern", None)), + "error_pattern": get_abs_path( + tx_cfg_tmp.get("error_pattern", None) + ), "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), @@ -260,7 +264,9 @@ def get_processing_chain( elif tx_cfg_tmp.get("type", None) == "JBM": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": get_abs_path(tx_cfg_tmp.get("error_pattern", None)), + "error_pattern": get_abs_path( + tx_cfg_tmp.get("error_pattern", None) + ), "error_profile": tx_cfg_tmp.get("error_profile", None), "n_frames_per_packet": tx_cfg_tmp.get("n_frames_per_packet", None), } @@ -311,7 +317,9 @@ def get_processing_chain( if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { "type": tx_cfg_tmp.get("type", None), - "error_pattern": get_abs_path(tx_cfg_tmp.get("error_pattern", None)), + "error_pattern": get_abs_path( + tx_cfg_tmp.get("error_pattern", None) + ), "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), diff --git a/ivas_processing_scripts/utils.py b/ivas_processing_scripts/utils.py index 0049073f..355de5e9 100755 --- a/ivas_processing_scripts/utils.py +++ b/ivas_processing_scripts/utils.py @@ -106,7 +106,9 @@ def list_audio(path: str, select_list: list = None) -> list: if path.exists(): if path.is_dir(): audio_list = [ - f.resolve().absolute() for f in path.iterdir() if f.suffix in ALLOWED_INPUT_EXT + f.resolve().absolute() + for f in path.iterdir() + if f.suffix in ALLOWED_INPUT_EXT ] else: ext = path.suffix -- GitLab From bb507272722f052378d26704d2e7d56572f59bee Mon Sep 17 00:00:00 2001 From: Treffehn Date: Fri, 28 Apr 2023 15:23:45 +0200 Subject: [PATCH 8/8] format --- ivas_processing_scripts/processing/chains.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 402c5f01..027ac447 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -134,7 +134,6 @@ def get_preprocessing_2(cfg: TestConfig) -> dict: pre2_cfg = cfg.preprocessing_2 background_cfg = pre2_cfg.get("background_noise", None) if background_cfg: - background = { "snr": background_cfg.get("snr", None), "background_noise_path": get_abs_path( -- GitLab