Commit e7f0fb28 authored by Vinit Veera's avatar Vinit Veera
Browse files

Took care of ISM by reordering the items list before generating ISM metadata_path.

parent be07ae4e
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -47,6 +47,10 @@ output_path: "./tmp_output"

### Horizontally concatenate input items into one long file; default = false
# concatenate_input: true
### Specify the concatenation order in a list of strings. If not specified, the concatenation order would be
### as per the filesystem on the users' device
### Should only be used if concatenate_input = true
# concatenation_order: []
### Specify preamble duration in ms; default = 0
# preamble: 40
### Flag wheter to use noise (amplitude +-4) for the preamble or silence; default = false (silence)
+4 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ from ivas_processing_scripts.processing.processing import (
    concat_teardown,
    preprocess,
    process_item,
    reorder_items_list,
)
from ivas_processing_scripts.utils import DirManager, apply_func_parallel

@@ -92,6 +93,9 @@ def main(args):
        # set up logging
        logger = logging_init(args, cfg)

        # 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)
        # check for ISM metadata
        if cfg.input["fmt"].startswith("ISM"):
            metadata = check_ISM_metadata(
+1 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class Processing(ABC):
        pass


def reorder_files(items_list: list, concatenation_order: list) -> list:
def reorder_items_list(items_list: list, concatenation_order: list) -> list:
    name_to_full = {Path(full_file).name: full_file for full_file in items_list}
    ordered_full_files = [
        name_to_full[name] for name in concatenation_order if name in name_to_full
@@ -75,7 +75,6 @@ def concat_setup(cfg: TestConfig, logger: logging.Logger):
            warn(
                f"Warning: Mismatch in specified concatenation order and number of items to process!\nNumber of items specified in concatenation order: {n_concatenation_order}\nNumber of items in the directory: {n_items_list}\nConcatenation will use the following order:\n{cfg.concatenation_order}"
            )
        cfg.items_list = reorder_files(cfg.items_list, cfg.concatenation_order)
    if any([i for i in cfg.items_list if i.suffix == ".txt"]):
        raise SystemExit("Concatenation for text files is unsupported")