Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some X-ray lines are incorrect #100

Open
hexane360 opened this issue Dec 19, 2024 · 2 comments
Open

Some X-ray lines are incorrect #100

hexane360 opened this issue Dec 19, 2024 · 2 comments

Comments

@hexane360
Copy link

Describe the bug

Some of the x-ray lines in exspy appear to be incorrect.

To Reproduce

As an example, let's consider the Ce_Mb edge:

>>> import exspy
>>> f"Ce_Mb: {exspy.material.elements.Ce.Atomic_properties.Xray_lines.Mb['energy (keV)']} keV"
"Ce_Mb: 0.8154 keV"

Expected behavior

However, consulting multiple other sources (for instance Bearden, J.A., Rev. Mod. Phys. 39, 78-124 (1967)), I expect a line energy of 0.9023 keV, a difference of 10%. This value also matches my experimental data.

Python environment:

  • eXSpy version: 0.3.1
  • HyperSpy version: 2.2.0
  • Python version: 3.12

Additional context

The code in exspy._misc.elements cites the NIST FFast datablase (Chantler 2005). It appears to take X-ray edge energies from Bearden 1967, where I got the 0.9023 keV value above.

I ran a quick comparison with xraydb as well, to identify other edges which are different:

import xraydb
import exspy._misc.elements

_LINE_MAP = {
    "Ka": "Ka1",
    "Kb": "Kb1",
    "La": "La1",
    "Lb2": "Lb2,15",
}

for elem in exspy._misc.elements.elements.keys():
    lines = xraydb.xray_lines(elem)
    edges = xraydb.xray_edges(elem)

    try:
        hyperspy_lines = exspy._misc.elements.elements[elem]["Atomic_properties"]["Xray_lines"]
    except KeyError:
        continue

    for (line, d) in hyperspy_lines.items():
        hyperspy_energy = d['energy (keV)']

        # handle some edges specially
        if line in ("M3O4", "M3O5"):
            # not in xraydb
            continue
        elif line == "M2N4":
            energy = (edges["M2"].energy - edges["N4"].energy) / 1e3
        else:
            try:
                energy = lines[_LINE_MAP.get(line, line)].energy / 1e3
            except KeyError:
                continue

        error = (energy - hyperspy_energy) / energy
        if abs(error) > 0.005:
            print(f"Line {elem}_{line} differs by {error:.2%} from ref ({energy:.4g} keV vs. {hyperspy_energy:.4g} keV)")

And the result:

Line Re_Mz differs by -0.57% from ref (1.43 keV vs. 1.438 keV)
Line Ra_Mz differs by -1.63% from ref (2.19 keV vs. 2.226 keV)
Line Rb_Lg3 differs by -0.75% from ref (2.05 keV vs. 2.065 keV)
Line Rn_Mb differs by -0.64% from ref (2.784 keV vs. 2.802 keV)
Line Rn_Mz differs by -1.50% from ref (2.093 keV vs. 2.124 keV)
Line Be_Ka differs by 5.46% from ref (0.1085 keV vs. 0.1026 keV)
Line Bi_Mz differs by -0.95% from ref (1.883 keV vs. 1.901 keV)
Line Os_Mz differs by -0.67% from ref (1.482 keV vs. 1.492 keV)
Line Gd_Mz differs by 2.31% from ref (0.9359 keV vs. 0.9143 keV)
Line Pr_Ma differs by 3.58% from ref (0.9268 keV vs. 0.8936 keV)
Line Pt_Mz differs by -0.61% from ref (1.593 keV vs. 1.603 keV)
Line Pb_Mz differs by -0.84% from ref (1.824 keV vs. 1.839 keV)
Line Pa_Mz differs by -2.02% from ref (2.387 keV vs. 2.435 keV)
Line Po_Mz differs by -1.59% from ref (1.947 keV vs. 1.978 keV)
Line Pm_Ma differs by 3.28% from ref (1.023 keV vs. 0.9894 keV)
Line Pm_Mz differs by 2.36% from ref (0.81 keV vs. 0.7909 keV)
Line Hg_Mz differs by -1.12% from ref (1.705 keV vs. 1.724 keV)
Line Mn_La differs by 0.56% from ref (0.6367 keV vs. 0.6332 keV)
Line Eu_Ma differs by 2.00% from ref (1.121 keV vs. 1.099 keV)
Line Er_M2N4 differs by 0.51% from ref (1.838 keV vs. 1.829 keV)
Line Nd_Ma differs by 3.95% from ref (0.9789 keV vs. 0.9402 keV)
Line Nd_Mb differs by 0.53% from ref (1.002 keV vs. 0.9965 keV)
Line Nd_Mz differs by 0.91% from ref (0.76 keV vs. 0.7531 keV)
Line Fr_Mb differs by -0.76% from ref (2.868 keV vs. 2.89 keV)
Line Fr_Mz differs by -1.56% from ref (2.156 keV vs. 2.19 keV)
Line Kr_Lg3 differs by -0.74% from ref (1.907 keV vs. 1.921 keV)
Line Sm_Ma differs by 3.28% from ref (1.078 keV vs. 1.043 keV)
Line Sm_Mz differs by 1.48% from ref (0.8453 keV vs. 0.8328 keV)
Line V_La differs by -0.55% from ref (0.5101 keV vs. 0.5129 keV)
Line Ce_Ma differs by 4.32% from ref (0.8837 keV vs. 0.8455 keV)
Line Ce_Mb differs by 9.63% from ref (0.9023 keV vs. 0.8154 keV)
Line La_Ma differs by 2.24% from ref (0.836 keV vs. 0.8173 keV)
Line La_Mb differs by 4.31% from ref (0.853 keV vs. 0.8162 keV)
Line La_Mz differs by 1.07% from ref (0.6472 keV vs. 0.6403 keV)
Line Tl_Mz differs by -0.90% from ref (1.764 keV vs. 1.78 keV)
Line Th_Mz differs by -1.80% from ref (2.323 keV vs. 2.365 keV)
Line Ti_La differs by -0.82% from ref (0.4518 keV vs. 0.4555 keV)
Line Dy_Ma differs by -0.52% from ref (1.284 keV vs. 1.291 keV)
Line U_Mz differs by -2.03% from ref (2.457 keV vs. 2.507 keV)
Line Ac_Ma differs by -0.83% from ref (2.9 keV vs. 2.924 keV)
Line Ac_Mb differs by -0.50% from ref (3.051 keV vs. 3.066 keV)
Line Ac_Mz differs by -1.70% from ref (2.29 keV vs. 2.329 keV)
Line Ir_Mz differs by -0.51% from ref (1.538 keV vs. 1.546 keV)
Line Au_Mz differs by -0.73% from ref (1.648 keV vs. 1.66 keV)
Line At_Mg differs by -1.08% from ref (2.919 keV vs. 2.951 keV)
Line At_Mz differs by -1.17% from ref (2.023 keV vs. 2.047 keV)

Most of these are pretty minor, but there's several large enough to matter.

We may want to investigate which database is the most complete, and use values from that. There's a couple of edges not present in xraydb, so it may not be enough on its own. Alternately, these errors could just be data entry errors, in which case they can be corrected if we know the exact source of the values to begin with.

@ericpre
Copy link
Member

ericpre commented Dec 19, 2024

Thanks @hexane360, what you are saying makes sense. Is it something that would be interested to investigate further and contribute?

Off the top of my head, the database was setup about 10 years ago with very little changes since then (for example, small changes to improve handling of EELS edges). I think that you already found the most relevant information above the database itself - I can dig in the git/github history to see if there are more information but I would not hold my breath for significantly more information! 😅

@hexane360
Copy link
Author

Sure, I'll investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants