From 9794d08f0a62f051f9dcb8ab7aeb3fd8bc709bb8 Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 27 Sep 2023 11:46:52 +0200 Subject: [PATCH] fix: online changes same sample name --- bec_plugins/utils/saxs_params_start_stop.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bec_plugins/utils/saxs_params_start_stop.py b/bec_plugins/utils/saxs_params_start_stop.py index 6cbc9ad..28ddcfd 100755 --- a/bec_plugins/utils/saxs_params_start_stop.py +++ b/bec_plugins/utils/saxs_params_start_stop.py @@ -27,8 +27,8 @@ class ScanItem: ) ) - if interval_x < 1 or interval_y < 1: - raise ValueError("Bugger off...") + # if interval_x < 1 or interval_y < 1: + # raise ValueError("Bugger off...") base_scan_params = { "start_x": float(self.entry["X [start]"]) + self.offset_xy()[0], @@ -68,6 +68,7 @@ class SAXSParams: def __init__(self, offset: Callable): self.offset_xy = offset self.data = defaultdict(lambda: ScanItem(offset)) + self.global_suffix = 0 def load_from_csv(self, file_path: str) -> None: """ @@ -82,7 +83,11 @@ class SAXSParams: with open(os.path.expanduser(file_path), "r") as file: csv_reader = csv.DictReader(file) for row in csv_reader: - self.data[row["sample name"]].entry = row + if self.data.get(row["sample name"], None) is None: + self.data[row["sample name"]].entry = row + else: + self.data[f'{row["sample name"]}_{self.global_suffix}'].entry = row + self.global_suffix += 1 if __name__ == "__main__":