Skip to content

Commit

Permalink
allow nxs-like structure in scienta h5 files
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Nov 18, 2024
1 parent 20df6a9 commit b000dfb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/pynxtools_xps/scienta/scienta_reader.py
Original file line number Diff line number Diff line change
@@ -111,7 +111,12 @@ def _update_xps_dict_with_spectrum(self, spectrum: Dict[str, Any]):
"""

entry_parts = []
for part in ["spectrum_type", "region_name", "acquisition/spectrum/name"]:
for part in [
"spectrum_type",
"region_name",
"acquisition/spectrum/name",
"title",
]:
val = spectrum.get(part, None)
if val:
entry_parts += [val]
@@ -120,6 +125,9 @@ def _update_xps_dict_with_spectrum(self, spectrum: Dict[str, Any]):
entry_parent = f"/ENTRY[{entry}]"

for key, value in spectrum.items():
if key.startswith("entry"):
entry_parent = f"/ENTRY[entry]"
key = key.replace("entry/", "", 1)
mpes_key = f"{entry_parent}/{key}"
self._xps_dict[mpes_key] = value

@@ -189,9 +197,9 @@ def _fill_with_data_hdf5(self, spectrum: Dict[str, Any], entry: str):
]

for key in data_keys:
value = spectrum[f"acquisition/spectrum/{key}"]

self._xps_dict["data"][entry][key] = value
value = spectrum.get(f"acquisition/spectrum/{key}")
if value is not None:
self._xps_dict["data"][entry][key] = value


class ScientaTxtParser:

0 comments on commit b000dfb

Please sign in to comment.