|
33 | 33 | from .workflows import NMXWorkflow, compute_lookup_table, select_detector_names |
34 | 34 |
|
35 | 35 |
|
36 | | -def _retrieve_input_file(input_file: list[pathlib.Path] | pathlib.Path) -> pathlib.Path: |
| 36 | +def _retrieve_input_file(input_file: list[str]) -> pathlib.Path: |
37 | 37 | """Temporary helper to retrieve a single input file from the list |
38 | 38 | Until multiple input file support is implemented. |
39 | 39 | """ |
40 | | - if isinstance(input_file, list) and len(input_file) != 1: |
41 | | - raise NotImplementedError( |
42 | | - "Currently, only a single input file is supported for reduction." |
43 | | - ) |
44 | | - elif isinstance(input_file, list): |
45 | | - input_file_path = input_file[0] |
| 40 | + if isinstance(input_file, list): |
| 41 | + input_files = collect_matching_input_files(*input_file) |
| 42 | + if len(input_files) == 0: |
| 43 | + raise ValueError( |
| 44 | + "No input files found for reduction." |
| 45 | + "Check if the file paths are correct.", |
| 46 | + input_file, |
| 47 | + ) |
| 48 | + elif len(input_files) > 1: |
| 49 | + raise NotImplementedError( |
| 50 | + "Currently, only a single input file is supported for reduction." |
| 51 | + ) |
| 52 | + input_file_path = input_files[0] |
46 | 53 | else: |
47 | 54 | input_file_path = input_file |
48 | 55 |
|
@@ -132,9 +139,7 @@ def reduction( |
132 | 139 |
|
133 | 140 | """ |
134 | 141 | display = _retrieve_display(logger, display) |
135 | | - input_file_path = _retrieve_input_file( |
136 | | - collect_matching_input_files(*config.inputs.input_file) |
137 | | - ).resolve() |
| 142 | + input_file_path = _retrieve_input_file(config.inputs.input_file).resolve() |
138 | 143 | display(f"Input file: {input_file_path}") |
139 | 144 |
|
140 | 145 | output_file_path = pathlib.Path(config.output.output_file).resolve() |
|
0 commit comments