Loading ivas_processing_scripts/__init__.py +9 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,11 @@ from ivas_processing_scripts.processing.processing import ( process_item, reorder_items_list, ) from ivas_processing_scripts.utils import DirManager, apply_func_parallel from ivas_processing_scripts.utils import ( DirManager, apply_func_parallel, get_binary_paths, ) def logging_init(args, cfg): Loading Loading @@ -94,6 +98,10 @@ def main(args): # set up logging logger = logging_init(args, cfg) # updating binary paths if cfg.binary_paths is not None: get_binary_paths(cfg, cfg.binary_paths) # Re-ordering items based on concatenation order if cfg.concatenate_input and cfg.concatenation_order is not None: cfg.items_list = reorder_items_list(cfg.items_list, cfg.concatenation_order) Loading ivas_processing_scripts/constants.py +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ DEFAULT_CONFIG = { "preamble": None, "pad_noise_preamble": False, "metadata_path": None, "binary_paths": None, # postprocessing "postprocessing": { "hp50": False, Loading ivas_processing_scripts/utils.py +15 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import logging import shutil import subprocess as sp import sys import yaml from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor from itertools import repeat, tee from os import devnull Loading Loading @@ -144,16 +145,20 @@ def find_binary( binary: str, raise_error: Optional[bool] = True, logger: Optional[logging.Logger] = None, binary_path: Optional[str] = None, ) -> Union[Path, None]: """Attempt to find and return the path to the given binary""" # prioritise binaries placed in the directory over $PATH if binary_path is not None: bin = which(binary, path=binary_path) else: bin = which(binary, path=BIN_DIR) if not bin: bin = which(binary) if not bin and raise_error: raise FileNotFoundError( f"Binary {binary} was not found in $PATH or in {BIN_DIR.absolute()}!" f"Binary {binary} was neither found in {binary_path.absolute()} nor in {BIN_DIR.absolute()} or in $PATH!" ) elif not bin: if logger: Loading Loading @@ -280,3 +285,11 @@ def progressbar(iter: Iterable, width=80): yield item update(i + 1) print("\n", flush=True, file=sys.stdout) def get_binary_paths(obj, binary_path): with open(binary_path, "r") as f: data = yaml.safe_load(f) for key, value in data.items(): p = Path(value) setattr(obj, key + "_binary_path", p) Loading
ivas_processing_scripts/__init__.py +9 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,11 @@ from ivas_processing_scripts.processing.processing import ( process_item, reorder_items_list, ) from ivas_processing_scripts.utils import DirManager, apply_func_parallel from ivas_processing_scripts.utils import ( DirManager, apply_func_parallel, get_binary_paths, ) def logging_init(args, cfg): Loading Loading @@ -94,6 +98,10 @@ def main(args): # set up logging logger = logging_init(args, cfg) # updating binary paths if cfg.binary_paths is not None: get_binary_paths(cfg, cfg.binary_paths) # Re-ordering items based on concatenation order if cfg.concatenate_input and cfg.concatenation_order is not None: cfg.items_list = reorder_items_list(cfg.items_list, cfg.concatenation_order) Loading
ivas_processing_scripts/constants.py +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ DEFAULT_CONFIG = { "preamble": None, "pad_noise_preamble": False, "metadata_path": None, "binary_paths": None, # postprocessing "postprocessing": { "hp50": False, Loading
ivas_processing_scripts/utils.py +15 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import logging import shutil import subprocess as sp import sys import yaml from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor from itertools import repeat, tee from os import devnull Loading Loading @@ -144,16 +145,20 @@ def find_binary( binary: str, raise_error: Optional[bool] = True, logger: Optional[logging.Logger] = None, binary_path: Optional[str] = None, ) -> Union[Path, None]: """Attempt to find and return the path to the given binary""" # prioritise binaries placed in the directory over $PATH if binary_path is not None: bin = which(binary, path=binary_path) else: bin = which(binary, path=BIN_DIR) if not bin: bin = which(binary) if not bin and raise_error: raise FileNotFoundError( f"Binary {binary} was not found in $PATH or in {BIN_DIR.absolute()}!" f"Binary {binary} was neither found in {binary_path.absolute()} nor in {BIN_DIR.absolute()} or in $PATH!" ) elif not bin: if logger: Loading Loading @@ -280,3 +285,11 @@ def progressbar(iter: Iterable, width=80): yield item update(i + 1) print("\n", flush=True, file=sys.stdout) def get_binary_paths(obj, binary_path): with open(binary_path, "r") as f: data = yaml.safe_load(f) for key, value in data.items(): p = Path(value) setattr(obj, key + "_binary_path", p)