Skip to content

Commit 2342892

Browse files
authored
Merge pull request #246 from pycroscopy/plotly-support
Plotly support
2 parents ff27a13 + 2716aa0 commit 2342892

File tree

5 files changed

+18
-26
lines changed

5 files changed

+18
-26
lines changed

.github/workflows/actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
max-parallel: 5
2222
matrix:
2323

24-
python-version: ['3.10', '3.11', '3.12', '3.13']
24+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
2525

2626
steps:
2727
- uses: actions/checkout@v3

pyTEMlib/eds_tools/eds_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
import pyTEMlib
3131
import pyTEMlib.file_reader
32-
from .utilities import elements as elements_list
32+
from ..utilities import elements as elements_list
3333
from .eds_xsections import quantify_cross_section, quantification_k_factors
3434

3535

@@ -294,7 +294,7 @@ def get_x_ray_lines(spectrum, element_list):
294294
x_sections = pyTEMlib.xrpa_x_sections.x_sections
295295
energy_scale = spectrum.get_spectral_dims(return_axis=True)[0].values
296296
for element in element_list:
297-
atomic_number = pyTEMlib.eds_tools.elements_list.index(element)
297+
atomic_number = elements_list.index(element)
298298
out_tags[element] ={'Z': atomic_number}
299299
lines = pyTEMlib.xrpa_x_sections.x_sections.get(str(atomic_number), {}).get('lines', {})
300300
if not lines:

pyTEMlib/eds_tools/eds_xsections.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
"""
2-
Module for calculating electron ionization cross sections for EDS quantification.
3-
Based on the Bote & Salvat (2008, 2009) cross sections for inner shell ionization
4-
by electron impact.
5-
Also includes cascade corrections for Coster-Kronig, Auger, and fluorescence
6-
emission.
7-
Values from xraylib package are used for fluorescence yields, radiative rates,
8-
Coster-Kronig probabilities, and Auger yields/rates.
9-
References:
10-
- D. Bote and F. Salvat, "Calculations of inner-shell ionization by electron
11-
impact with the distorted-wave and plane-wave Born approximations","
12-
- Bote, David, et al. "Cross sections for ionization of K, L and M shells of
13-
atoms by impact of electrons and positrons with energies up to 1 GeV:
14-
Analytical formulas."
15-
Atomic Data and Nuclear Data Tables 95.6 (2009): 871-909.
16-
- Browning, N. D., et al. "A model for calculating cross sections for electron
17-
impact ionization of atoms from threshold to 10 MeV."
18-
Journal of Applied Physics 83.11 (1998): 5736-5744.
2+
Cross-Sections and k-factor file reading and writing
3+
Use em_tables or manufactorers k-factor data for quantification.
4+
5+
part of pyTEMlib
6+
7+
Author: Gerd Duscher
8+
9+
collected in directory 12/2025
1910
"""
11+
2012
import os
2113
import json
2214
import numpy as np
2315
import scipy
2416
import csv
2517
import xml
2618

27-
from .config_dir import config_path
28-
from .utilities import elements as elements_list
29-
from .utilities import get_z
19+
from ..config_dir import config_path
20+
from ..utilities import elements as elements_list
21+
from ..utilities import get_z
3022

3123
import pyTEMlib
3224

pyTEMlib/eels_tools/low_loss_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def kroeger_core(e_data, a_data, eps_data, acceleration_voltage_kev, thickness,
426426
return P, P*scale*1e2,p_vol*1e2, p_simple*1e2
427427
428428
429-
$d^2P/(dEd\\Omega) = \\frac{1}{\\pi^2 a_0 m_0 v^2} \\Im \left[ \\frac{t\\mu^2}{\\varepsilon \\phi^2 } \right]
429+
$d^2P/(dEd\\Omega) = \\frac{1}{\\pi^2 a_0 m_0 v^2} \\Im \\left[ \\frac{t\\mu^2}{\\varepsilon \\phi^2 } \\right]
430430
431431
# Internally everything is calculated in SI units
432432
# acceleration_voltage_kev = 200 #keV

tests/test_utilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ def test_lorentz_peak_normalization():
3535
def test_gauss_zero_width_returns_zeros():
3636
x = np.linspace(-5, 5, 11)
3737
p = [0.0, 1.0, 0.0] # p[2] == 0 should yield zeros
38-
y = utilities.gauss(x, p)
38+
y = utilities.gauss(x, np.array(p))
3939
assert np.allclose(y, 0.0)
4040

4141

4242
def test_gauss_peak_at_center():
4343
x = np.linspace(-5, 5, 101)
4444
p = [0.0, 3.0, 1.2] # mean=0, amplitude=3
45-
y = utilities.gauss(x, p)
45+
y = utilities.gauss(x,np.array(p))
4646
# maximum value should be close to amplitude
4747
assert pytest.approx(3.0, rel=1e-5) == float(np.max(y))
4848
# center value equals maximum

0 commit comments

Comments
 (0)