Skip to content

Commit

Permalink
Merge pull request #2681 from k8macarthur/CL_quant
Browse files Browse the repository at this point in the history
Fix CL Quant Error
  • Loading branch information
ericpre committed Mar 17, 2021
2 parents 19a0a7a + 0d0ee4c commit d4d3dcb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
9 changes: 4 additions & 5 deletions doc/user_guide/eds.rst
Expand Up @@ -684,11 +684,10 @@ must be determined experimentally using standards.

Zeta-factors should be provided in units of kg/m^2. The method is described
further in :ref:`[Watanabe1996] <Watanabe1996>`
and :ref:`[Watanabe2006] <Watanabe2006>`. K-factors are unitless but are based
on the assumption of weight percent. Cross sections should be provided in units
of barns (b). Further details on the cross section method can be found in
:ref:`[MacArthur2016] <MacArthur2016>`. Conversion between zeta-factors and
cross sections is possible using
and :ref:`[Watanabe2006] <Watanabe2006>`. Cross sections should be
provided in units of barns (b). Further details on the cross section method can
be found in :ref:`[MacArthur2016] <MacArthur2016>`. Conversion between
zeta-factors and cross sections is possible using
:py:func:`~.misc.eds.utils.edx_cross_section_to_zeta` or
:py:func:`~.misc.eds.utils.zeta_to_edx_cross_section`.

Expand Down
5 changes: 3 additions & 2 deletions hyperspy/misc/eds/utils.py
Expand Up @@ -498,8 +498,9 @@ def _quantification_cliff_lorimer(intensities,
other_index = list(range(len(kfactors)))
other_index.pop(ref_index)
for i in other_index:
ab[i] = intensities[ref_index] * kfactors[ref_index] \
/ (intensities[i] * absorption_correction[i]) / kfactors[i]
ab[i] = (intensities[ref_index] * absorption_correction[ref_index]) \
/ (intensities[i] * absorption_correction[i]) \
*( kfactors[ref_index] / kfactors[i])
# Ca = ab /(1 + ab + ab/ac + ab/ad + ...)
ab = ab
for i in other_index:
Expand Down
11 changes: 9 additions & 2 deletions hyperspy/tests/signal/test_eds_tem.py
Expand Up @@ -261,9 +261,16 @@ def test_quant_lorimer_ac(self):
composition_units,
absorption_correction=True,
thickness=0.0001)
np.testing.assert_allclose(res2[0][0].data, np.ones((2, 2)) * 22.70779,
list.reverse(intensities)
list.reverse(kfactors)
res5 = s.quantification(intensities, method, kfactors,
composition_units,
absorption_correction=True,
thickness=300.)
np.testing.assert_allclose(res5[0][0].data, res3[0][1].data, atol=1e-5)
np.testing.assert_allclose(res2[0][0].data, np.ones((2, 2)) * 22.743013,
atol=1e-3)
np.testing.assert_allclose(res3[0][0].data, np.ones((2, 2)) * 22.587251,
np.testing.assert_allclose(res3[0][0].data, np.ones((2, 2)) * 31.816908,
atol=1e-3)
np.testing.assert_allclose(res[0].data, res4[0][0].data, atol=1e-5)

Expand Down

0 comments on commit d4d3dcb

Please sign in to comment.