From 8b48734989c2fddcb6c3c3bab04b89cb716c528d Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 25 Aug 2026 09:14:29 +0100 Subject: [PATCH 1/2] Updated feasible_point to search over scan points --- process/core/io/in_dat/create.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/process/core/io/in_dat/create.py b/process/core/io/in_dat/create.py index 153f698630..9e26d94e24 100644 --- a/process/core/io/in_dat/create.py +++ b/process/core/io/in_dat/create.py @@ -47,14 +47,12 @@ def feasible_point(filename, position: int): check_point = 1 - for value in mfile_data.data: - # Look for feasible scan points (with ifail = 1) - if "ifail" in value and "vmcon_error_flag_(ifail)" not in value: - if mfile_data.get(value, scan=check_point) == 1: - scan_point = check_point - if check_point == position: - break - check_point += 1 + for scan in range(1, num_scans + 1): + if mfile_data.get("ifail", scan=scan) == 1: + scan_point = scan + if check_point == position: + break + check_point += 1 else: raise ValueError("No feasible point found") return scan_point From c18a291c66c3f03580d9acdd467d4e1e3f11287a Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 8 Sep 2026 10:26:29 +0100 Subject: [PATCH 2/2] Updated feasible_point to work for scan points other that 1 --- process/core/io/in_dat/create.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/process/core/io/in_dat/create.py b/process/core/io/in_dat/create.py index 9e26d94e24..2873945e09 100644 --- a/process/core/io/in_dat/create.py +++ b/process/core/io/in_dat/create.py @@ -38,23 +38,20 @@ def feasible_point(filename, position: int): if position == -1: position = num_scans - - position = max(1, position) - - if position > num_scans: - position = num_scans - print(f"Only {num_scans} in mfile selecting last feasible_point") - - check_point = 1 - - for scan in range(1, num_scans + 1): - if mfile_data.get("ifail", scan=scan) == 1: - scan_point = scan - if check_point == position: - break - check_point += 1 + elif position not in range(1, num_scans + 1): + raise ValueError( + "Invalid value given. " + f"Select value in range 1-{num_scans} or -1 for last scan point." + ) + + if mfile_data.get("ifail", scan=position) == 1: + scan_point = position else: - raise ValueError("No feasible point found") + raise ValueError( + f"Scan point {position} is not feasible. " + f"Please select a different scan point." + ) + return scan_point