fix: online changes same sample name

This commit is contained in:
2023-09-27 11:46:52 +02:00
parent 25d5bf6c40
commit 9794d08f0a
+8 -3
View File
@@ -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__":