From 491bd560e8e1cb8a08427c66ffac556be0d1dadf Mon Sep 17 00:00:00 2001 From: Antonia Beteva Date: Thu, 23 Jan 2025 11:35:10 +0100 Subject: [PATCH] Add ISPyB sessin ID for XRF Spectrum and Energy Scan. --- mxcubecore/HardwareObjects/ESRFLIMS.py | 2 ++ mxcubecore/HardwareObjects/ICATLIMS.py | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mxcubecore/HardwareObjects/ESRFLIMS.py b/mxcubecore/HardwareObjects/ESRFLIMS.py index 2aeda5a7be..99caf0065d 100644 --- a/mxcubecore/HardwareObjects/ESRFLIMS.py +++ b/mxcubecore/HardwareObjects/ESRFLIMS.py @@ -211,9 +211,11 @@ def store_beamline_setup(self, session_id, bl_config): self.ispyb.store_beamline_setup(session_id, bl_config) def store_energy_scan(self, energyscan_dict): + energyscan_dict["sessionId"] = self.ispyb.get_session_id() return self.ispyb.store_energy_scan(energyscan_dict) def store_xfe_spectrum(self, xfespectrum_dict): + xfespectrum_dict["sessionId"] = self.ispyb.get_session_id() return self.ispyb.store_xfe_spectrum(xfespectrum_dict) def store_workflow(self, *args, **kwargs): diff --git a/mxcubecore/HardwareObjects/ICATLIMS.py b/mxcubecore/HardwareObjects/ICATLIMS.py index 7ee62f1e85..d4379f0731 100644 --- a/mxcubecore/HardwareObjects/ICATLIMS.py +++ b/mxcubecore/HardwareObjects/ICATLIMS.py @@ -2,11 +2,11 @@ import logging import pathlib import shutil -from time import strftime from datetime import ( datetime, timedelta, ) +from time import strftime from typing import ( List, Optional, @@ -555,7 +555,7 @@ def add_beamline_configuration_metadata(self, metadata, beamline_config): for config_key, metadata_key in key_mapping.items(): if hasattr(beamline_config, config_key): - metadata[metadata_key] = getattr(beamline_config,config_key) + metadata[metadata_key] = getattr(beamline_config, config_key) def add_sample_metadata(self, metadata, collection_parameters): """ @@ -651,7 +651,9 @@ def finalize_data_collection(self, collection_parameters): if not directory.name.startswith("run"): dataset_name = fileinfo["prefix"] - start_time = collection_parameters.get("collection_start_time", strftime("%Y-%m-%d %H:%M:%S")) + start_time = collection_parameters.get( + "collection_start_time", strftime("%Y-%m-%d %H:%M:%S") + ) if collection_parameters["sample_reference"]["acronym"]: sample_name = (