Skip to content

Commit

Permalink
change population of energy fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Jan 23, 2024
1 parent c6be6a4 commit 07fae5a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions pynxtools/dataconverter/readers/xps/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def fill_data_group(key, key_part, entries_values, config_dict, template):
data_group_key = data_field_key.rsplit("/data", 1)[0]

if key_part == "energy":
energy_field_key = f"{data_group_key}/energy"
# Here, we need to take here if the data/entry is
# written directly in the future.
energy_field_key = data_group_key
energy = np.array(xr_data.coords["energy"].values)
template[energy_field_key] = energy

Expand Down Expand Up @@ -253,8 +255,8 @@ def fill_template_with_value(key, value, template):
value = value.isoformat()

elif isinstance(value, dict) and LINK_TOKEN in value:
link_text = value[LINK_TOKEN]
link_text = link_text.replace("entry", f"{entry}")
initial_link_text = value[LINK_TOKEN]
link_text = initial_link_text.replace("entry", f"{entry}")
value = {LINK_TOKEN: link_text}

modified_key = key.replace("[entry]", f"[{entry}]")
Expand Down Expand Up @@ -282,6 +284,14 @@ def fill_template_with_value(key, value, template):
template[modified_key] = ", ".join(atom_types)


# =============================================================================
# # Reset link to original
# if isinstance(value, dict) and LINK_TOKEN in value:
# print(value, template[modified_key])
# value[LINK_TOKEN] = initial_link_text
# =============================================================================


def fill_template_with_xps_data(config_dict, xps_data_dict, template):
"""Collect the xps data from xps_data_dict
and store them into template. We use searching_keys
Expand Down Expand Up @@ -434,6 +444,10 @@ def read(
if ("/ENTRY[entry]" not in key) and (val is not None):
final_template[key] = val

for key, value in final_template.items():
if isinstance(value, dict) and LINK_TOKEN in value:
print(value)

return final_template


Expand Down

0 comments on commit 07fae5a

Please sign in to comment.