Skip to content

Commit

Permalink
[ICAT] Added start and end time, fixed access to metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-oscarsson committed Jan 30, 2025
1 parent f90c46c commit a0a8102
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mxcubecore/HardwareObjects/ICATLIMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import pathlib
import shutil
from time import strftime
from datetime import (
datetime,
timedelta,
Expand Down Expand Up @@ -553,8 +554,8 @@ def add_beamline_configuration_metadata(self, metadata, beamline_config):
}

for config_key, metadata_key in key_mapping.items():
if config_key in beamline_config:
metadata[metadata_key] = beamline_config[config_key]
if hasattr(beamline_config, config_key):
metadata[metadata_key] = getattr(beamline_config,config_key)

def add_sample_metadata(self, metadata, collection_parameters):
"""
Expand Down Expand Up @@ -642,12 +643,16 @@ def finalize_data_collection(self, collection_parameters):
scanType = "datacollection"
else:
scanType = collection_parameters["experiment_type"]

workflow_params = collection_parameters.get("workflow_parameters", {})
workflow_type = workflow_params.get("workflow_type")

if workflow_type is None:
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"))

if collection_parameters["sample_reference"]["acronym"]:
sample_name = (
collection_parameters["sample_reference"]["acronym"]
Expand Down Expand Up @@ -702,6 +707,8 @@ def finalize_data_collection(self, collection_parameters):
),
"MX_position_id": workflow_params.get("workflow_position_id"),
"group_by": workflow_params.get("workflow_group_by"),
"startDate": start_time,
"endDate": strftime("%Y-%m-%d %H:%M:%S"),
}
# Store metadata on disk
self.add_sample_metadata(metadata, collection_parameters)
Expand Down

0 comments on commit a0a8102

Please sign in to comment.