Skip to content

Commit 4cac974

Browse files
committed
Update input file pattern retrieval routine.
1 parent 9d95c16 commit 4cac974

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/ess/nmx/executables.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,23 @@
3333
from .workflows import NMXWorkflow, compute_lookup_table, select_detector_names
3434

3535

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:
3737
"""Temporary helper to retrieve a single input file from the list
3838
Until multiple input file support is implemented.
3939
"""
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]
4653
else:
4754
input_file_path = input_file
4855

@@ -132,9 +139,7 @@ def reduction(
132139
133140
"""
134141
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()
138143
display(f"Input file: {input_file_path}")
139144

140145
output_file_path = pathlib.Path(config.output.output_file).resolve()

0 commit comments

Comments
 (0)