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

Fix CL Quant Error #2681

Merged
merged 7 commits into from Mar 17, 2021
13 changes: 6 additions & 7 deletions doc/user_guide/eds.rst
Expand Up @@ -811,13 +811,13 @@ composition maps for each element.
>>> factors=factors, absorption_correction=True
>>> thickness = 100.)

At this stage absorption correction is only applicable for parallel-sided,
thin-film samples. Absorption correction is calculated on a pixel by pixel
At this stage absorption correction is only applicable for parallel-sided,
thin-film samples. Absorption correction is calculated on a pixel by pixel
basis after having determined a sample mass-thickness map. It therefore may
be a source of error in particularly inhomogeneous specimens.

Absorption correction can also only be applied to spectra from a single EDS
detector. For systems that consist of multiple detectors, such as the Thermo
detector. For systems that consist of multiple detectors, such as the Thermo
Fisher Super-X, it is therefore necessary to load the spectra from each
detector separately.

Expand Down Expand Up @@ -847,13 +847,13 @@ is available:
Electron and X-ray range
^^^^^^^^^^^^^^^^^^^^^^^^

The electron and X-ray range in a bulk material can be estimated with
The electron and X-ray range in a bulk material can be estimated with
:py:meth:`hs.eds.electron_range` and :py:meth:`hs.eds.xray_range`

To calculate the X-ray range of Cu Ka in pure Copper at 30 kV in micron:

.. code-block:: python

>>> hs.eds.xray_range('Cu_Ka', 30.)
1.9361716759499248

Expand All @@ -871,4 +871,3 @@ To calculate the electron range in pure Copper at 30 kV in micron

>>> hs.eds.electron_range('Cu', 30.)
2.8766744984001607

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 @@ -250,9 +250,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