Skip to content

Commit

Permalink
handle datetime writing in XPS reader
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Jan 17, 2024
1 parent be523d0 commit ea1cfdd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pynxtools/dataconverter/readers/xps/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from typing import Tuple
import sys
import json
import datetime

import yaml
import numpy as np
Expand Down Expand Up @@ -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] = {}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ea1cfdd

Please sign in to comment.