From 73322c76982fa2c540810c6fef4256955ad050bb Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sun, 16 Jun 2024 11:55:24 +0100 Subject: [PATCH] Rename `edx_cross_section_to_zeta` to `cross_section_to_zeta` and `zeta_to_edx_cross_section` to `zeta_to_cross_section` --- doc/reference/utils.eds.rst | 4 ++-- doc/user_guide/eds.rst | 4 ++-- exspy/_misc/eds/utils.py | 8 ++++---- exspy/tests/signals/test_eds_tem.py | 14 ++++++-------- exspy/utils/eds.py | 8 ++++---- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/doc/reference/utils.eds.rst b/doc/reference/utils.eds.rst index 7abea2216..24165f596 100644 --- a/doc/reference/utils.eds.rst +++ b/doc/reference/utils.eds.rst @@ -5,12 +5,12 @@ .. autosummary:: - edx_cross_section_to_zeta + cross_section_to_zeta electron_range get_xray_lines_near_energy take_off_angle xray_range - zeta_to_edx_cross_section + zeta_to_cross_section .. automodule:: exspy.utils.eds diff --git a/doc/user_guide/eds.rst b/doc/user_guide/eds.rst index d10688e65..fab1c7870 100644 --- a/doc/user_guide/eds.rst +++ b/doc/user_guide/eds.rst @@ -691,8 +691,8 @@ and :ref:`[Watanabe2006] `. Cross sections should be provided in units of barns (b). Further details on the cross section method can be found in :ref:`[MacArthur2016] `. Conversion between zeta-factors and cross sections is possible using -:py:func:`~.utils.eds.edx_cross_section_to_zeta` or -:py:func:`~.utils.eds.zeta_to_edx_cross_section`. +:py:func:`~.utils.eds.cross_section_to_zeta` or +:py:func:`~.utils.eds.zeta_to_cross_section`. Using the Cliff-Lorimer method as an example, quantification can be carried out as follows: diff --git a/exspy/_misc/eds/utils.py b/exspy/_misc/eds/utils.py index 01070b1e0..24f6dd188 100644 --- a/exspy/_misc/eds/utils.py +++ b/exspy/_misc/eds/utils.py @@ -708,7 +708,7 @@ def get_abs_corr_cross_section( return acf -def edx_cross_section_to_zeta(cross_sections, elements): +def cross_section_to_zeta(cross_sections, elements): """Convert a list of cross_sections in barns (b) to zeta-factors (kg/m^2). Parameters @@ -726,7 +726,7 @@ def edx_cross_section_to_zeta(cross_sections, elements): See Also -------- - exspy.utils.eds.zeta_to_edx_cross_section + exspy.utils.eds.zeta_to_cross_section """ if len(elements) != len(cross_sections): @@ -741,7 +741,7 @@ def edx_cross_section_to_zeta(cross_sections, elements): return zeta_factors -def zeta_to_edx_cross_section(zfactors, elements): +def zeta_to_cross_section(zfactors, elements): """Convert a list of zeta-factors (kg/m^2) to cross_sections in barns (b). Parameters @@ -759,7 +759,7 @@ def zeta_to_edx_cross_section(zfactors, elements): See Also -------- - exspy.utils.eds.edx_cross_section_to_zeta + exspy.utils.eds.cross_section_to_zeta """ if len(elements) != len(zfactors): diff --git a/exspy/tests/signals/test_eds_tem.py b/exspy/tests/signals/test_eds_tem.py index b747200d5..2771008b0 100644 --- a/exspy/tests/signals/test_eds_tem.py +++ b/exspy/tests/signals/test_eds_tem.py @@ -420,16 +420,14 @@ def test_zeta_vs_cross_section(self): factors = [3, 5] method = "zeta" intensities = s.get_lines_intensity() - zfactors = utils_eds.edx_cross_section_to_zeta([3, 5], ["Al", "Zn"]) - factors2 = utils_eds.zeta_to_edx_cross_section(zfactors, ["Al", "Zn"]) + zfactors = utils_eds.cross_section_to_zeta([3, 5], ["Al", "Zn"]) + factors2 = utils_eds.zeta_to_cross_section(zfactors, ["Al", "Zn"]) np.testing.assert_allclose(factors, factors2, atol=1e-3) res = s.quantification( intensities, method, - factors=utils_eds.edx_cross_section_to_zeta( - [22.402, 21.7132], ["Al", "Zn"] - ), + factors=utils_eds.cross_section_to_zeta([22.402, 21.7132], ["Al", "Zn"]), ) res2 = s.quantification( intensities, method="cross_section", factors=[22.402, 21.7132] @@ -465,7 +463,7 @@ def test_quant_cross_section_ac(self): s = self.signal method = "cross_section" zfactors = [20, 50] - factors = utils_eds.zeta_to_edx_cross_section(zfactors, ["Al", "Zn"]) + factors = utils_eds.zeta_to_cross_section(zfactors, ["Al", "Zn"]) intensities = s.get_lines_intensity() res = s.quantification(intensities, method, factors, absorption_correction=True) res2 = s.quantification( @@ -507,13 +505,13 @@ def test_quant_zeros(self): def test_edx_cross_section_to_zeta(self): cs = [3, 6] elements = ["Pt", "Ni"] - res = utils_eds.edx_cross_section_to_zeta(cs, elements) + res = utils_eds.cross_section_to_zeta(cs, elements) np.testing.assert_allclose(res, [1079.815272, 162.4378035], atol=1e-3) def test_zeta_to_edx_cross_section(self): factors = [1079.815272, 162.4378035] elements = ["Pt", "Ni"] - res = utils_eds.zeta_to_edx_cross_section(factors, elements) + res = utils_eds.zeta_to_cross_section(factors, elements) np.testing.assert_allclose(res, [3, 6], atol=1e-3) def test_quant_element_order(self): diff --git a/exspy/utils/eds.py b/exspy/utils/eds.py index cb0fd0893..757ed70b3 100644 --- a/exspy/utils/eds.py +++ b/exspy/utils/eds.py @@ -18,22 +18,22 @@ from exspy._misc.eds.utils import ( - edx_cross_section_to_zeta, + cross_section_to_zeta, electron_range, get_xray_lines_near_energy, take_off_angle, xray_range, - zeta_to_edx_cross_section, + zeta_to_cross_section, ) __all__ = [ - "edx_cross_section_to_zeta", + "cross_section_to_zeta", "electron_range", "get_xray_lines_near_energy", "take_off_angle", "xray_range", - "zeta_to_edx_cross_section", + "zeta_to_cross_section", ]