From ea1cfdd89004e50cb47bfe442c5dbb5b83bababe Mon Sep 17 00:00:00 2001 From: Lukas Pielsticker <50139597+lukaspie@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:54:57 +0100 Subject: [PATCH] handle datetime writing in XPS reader --- pynxtools/dataconverter/readers/xps/reader.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pynxtools/dataconverter/readers/xps/reader.py b/pynxtools/dataconverter/readers/xps/reader.py index 513b3f80a..746f4d884 100644 --- a/pynxtools/dataconverter/readers/xps/reader.py +++ b/pynxtools/dataconverter/readers/xps/reader.py @@ -23,6 +23,7 @@ from typing import Tuple import sys import json +import datetime import yaml import numpy as np @@ -57,9 +58,11 @@ "Energydispersion": "ENERGYDISPERSION[energydispersion]", "Detector": "DETECTOR[detector]", "Manipulator": "MANIPULATOR[manipulator]", + "PID": "PID[pid]", "Process": "PROCESS[process]", "Sample": "SAMPLE[sample]", - "Data": "DATA[data]", + "Substance": "SUBSTANCE[substance]", + # "Data": "DATA[data]", } REPLACE_NESTED: Dict[str, str] = {} @@ -275,7 +278,10 @@ def fill_atom_types(key): for entry in entry_set: modified_key = key.replace("[entry]", f"[{entry}]") + if isinstance(field_value, datetime.datetime): + field_value = field_value.isoformat() template[modified_key] = field_value + if atom_types: modified_key = modified_key.replace("chemical_formula", "atom_types") template[modified_key] = ", ".join(atom_types)