Skip to content

Commit

Permalink
further kludges for missing element edge
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtitus committed Nov 11, 2024
1 parent 0ea3740 commit 74ba945
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion export_to_xdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ def get_xdi_run_header(run):
metadata["Element.edge"] = run.start.get("edge", "")
# This is just a kludge for re-export of old data where we used edge, not element in run.start
if metadata["Element.symbol"] == "" and metadata["Element.edge"] != "":
metadata["Element.symbol"] = metadata["Element.edge"]
element = metadata["Element.edge"]
metadata["Element.symbol"] = element
metadata["Element.edge"] = "" # Because it was really the element symbol
if element.lower() in ["c", "n", "o", "f", "na", "mg", "al", "si"]:
metadata["Element.edge"] = "K"
elif element.lower() in ["ca", "sc", "ti", "v", "cr", "mn", "fe", "co", "ni", "cu", "zn"]:
metadata["Element.edge"] = "L"
elif element.lower() in ["ce"]:
metadata["Element.edge"] = "M"

proposal = run.start.get("proposal", {})
metadata["Proposal.id"] = proposal.get("proposal_id", "")
Expand Down

0 comments on commit 74ba945

Please sign in to comment.