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

[XRF] Allow to fit M subshells separately #1099

Merged
merged 10 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@ jobs:
include:
- name-suffix: "(Minimum Versions)"
os: ubuntu-latest
python-version: 3.7
BUILD_COMMAND: sdist
python-version: 3.9
BUILD_COMMAND: --sdist
QT_BINDING: PyQt5==5.14.1
XVFB_RUN: xvfb-run -a

- name-suffix: "PySide6 bdist_wheel"
- name-suffix: "PySide6 wheel"
os: ubuntu-latest
python-version: "3.10"
BUILD_COMMAND: bdist_wheel
BUILD_COMMAND: --wheel
QT_BINDING: PySide6
XVFB_RUN: xvfb-run -a

- name-suffix: "PyQt5 bdist_wheel"
- name-suffix: "PyQt5 wheel"
os: ubuntu-latest
python-version: "3.10"
BUILD_COMMAND: bdist_wheel
BUILD_COMMAND: --wheel
QT_BINDING: PyQt5
XVFB_RUN: xvfb-run -a

- name-suffix: "PyQt6 bdist_wheel"
- name-suffix: "PyQt6 wheel"
os: macos-latest
python-version: 3.11
BUILD_COMMAND: bdist_wheel
BUILD_COMMAND: --wheel
QT_BINDING: PyQt6
XVFB_RUN: ""

Expand Down Expand Up @@ -111,6 +111,7 @@ jobs:
run: |
pip install --upgrade wheel
pip install --upgrade numpy
pip install --upgrade build
# put cython
pip install cython

Expand All @@ -126,12 +127,12 @@ jobs:

- name: Generate source package or wheel
run: |
python setup.py ${{ matrix.BUILD_COMMAND }}
python -m build ${{ matrix.BUILD_COMMAND }}
ls dist

- name: Install from source package
run: |
for filename in dist/PyMca5*.*; do
for filename in dist/*ca5-5.*; do
echo "\nInstall $filename"
pip install --pre $filename
done
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION 5.9.3
-------------

- XRF. Allow to fit M subshells

- Compatibility with numpy 2.0

- GUI. Compatibility with matplotlib 3.9.0
Expand Down
14 changes: 7 additions & 7 deletions src/PyMca5/PyMcaGui/physics/xrf/FitPeakSelect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The PyMca X-Ray Fluorescence Toolkit
#
# Copyright (c) 2004-2023 European Synchrotron Radiation Facility
# Copyright (c) 2004-2025 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF.
Expand Down Expand Up @@ -119,7 +119,7 @@ class PeakButtonList(qt.QWidget):
# emitted object is a list
sigSelectionChanged = qt.pyqtSignal(object)
def __init__(self, parent=None, name="PeakButtonList",
peaklist=['K','Ka','Kb','L','L1','L2','L3','M'],
peaklist=['K','Ka','Kb','L','L1','L2','L3','M', 'M1', 'M2', 'M3', 'M4', 'M5'],
fl=0):
qt.QWidget.__init__(self,parent)
self.peaklist = peaklist
Expand Down Expand Up @@ -228,7 +228,7 @@ def __init__(self, parent=None, name="FitPeakSelect", peakdict = {}, energyTable
line.setFrameShadow(qt.QFrame.Sunken)

self.peaks = PeakButtonList(self)
self.peaks.setDisabled(['K','Ka','Kb','L','L1','L2','L3','M'])
self.peaks.setDisabled(['K','Ka','Kb','L','L1','L2','L3','M', 'M1', 'M2', 'M3', 'M4', 'M5'])

self.energyTable.sigEnergyTableSignal.connect(self._energyTableAction)
self.table.sigElementClicked.connect(self.elementClicked)
Expand Down Expand Up @@ -328,19 +328,19 @@ def setPeaksDisabled(self,symbol):
elif z > 17:
#self.peaks.setDisabled(['Ka','Kb','M'])
#disabled = ['Ka','Kb','M']
disabled = ['M']
disabled = ['M', 'M1', 'M2', 'M3', 'M4', 'M5']
elif z > 2:
#self.peaks.setDisabled(['Ka','Kb','L','L1','L2','L3','M'])
#disabled = ['Ka','Kb','L','L1','L2','L3','M']
disabled = ['L','L1','L2','L3','M']
disabled = ['L','L1','L2','L3','M', 'M1', 'M2', 'M3', 'M4', 'M5']
else:
#self.peaks.setDisabled(['K','Ka','Kb','L','L1','L2','L3','M'])
#disabled = ['Ka','Kb','L','L1','L2','L3','M']
disabled = ['Ka', 'Kb','L','L1','L2','L3','M']
disabled = ['Ka', 'Kb','L','L1','L2','L3','M', 'M1', 'M2', 'M3', 'M4', 'M5']

ele = symbol
if self.energyValue is not None:
for peak in ['K', 'Ka', 'Kb', 'L','L1','L2','L3','M']:
for peak in ['K', 'Ka', 'Kb', 'L','L1','L2','L3','M', 'M1', 'M2', 'M3', 'M4', 'M5']:
if peak not in disabled:
if peak == 'L':
if Elements.Element[ele]['binding']['L3'] > self.energyValue:
Expand Down
26 changes: 19 additions & 7 deletions src/PyMca5/PyMcaPhysics/xrf/Elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The PyMca X-Ray Fluorescence Toolkit
#
# Copyright (c) 2004-2023 European Synchrotron Radiation Facility
# Copyright (c) 2004-2025 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF.
Expand Down Expand Up @@ -189,16 +189,28 @@
LShell.ElementL1ShellTransitions,
LShell.ElementL2ShellTransitions,
LShell.ElementL3ShellTransitions,
MShell.ElementMShellTransitions]
MShell.ElementMShellTransitions,
MShell.ElementM1ShellTransitions,
MShell.ElementM2ShellTransitions,
MShell.ElementM3ShellTransitions,
MShell.ElementM4ShellTransitions,
MShell.ElementM5ShellTransitions]
ElementShellRates = [KShell.ElementKShellRates,
KShell.ElementKAlphaRates,
KShell.ElementKBetaRates,
LShell.ElementLShellRates,
LShell.ElementL1ShellRates,
LShell.ElementL2ShellRates,
LShell.ElementL3ShellRates,MShell.ElementMShellRates]
LShell.ElementL3ShellRates,
MShell.ElementMShellRates,
MShell.ElementM1ShellRates,
MShell.ElementM2ShellRates,
MShell.ElementM3ShellRates,
MShell.ElementM4ShellRates,
MShell.ElementM5ShellRates]

ElementXrays = ['K xrays', 'Ka xrays', 'Kb xrays', 'L xrays','L1 xrays','L2 xrays','L3 xrays','M xrays']
ElementXrays = ['K xrays', 'Ka xrays', 'Kb xrays', 'L xrays','L1 xrays','L2 xrays','L3 xrays','M xrays',
'M1 xrays', 'M2 xrays', 'M3 xrays', 'M4 xrays', 'M5 xrays']

def getsymbol(z):
if (z > 0) and (z<=len(ElementList)):
Expand Down Expand Up @@ -2900,7 +2912,7 @@ def _updateElementDict(symbol, dict, energy=None, minenergy=MINENERGY, minrate=0
if 'rays' in dict:
for rays in dict['rays']:
for transition in dict[rays]:
#print "transition deleted = ",transition
#print("transition deleted = ",transition)
del dict[transition]
#print "rays deleted = ",rays
del dict[rays]
Expand All @@ -2909,9 +2921,9 @@ def _updateElementDict(symbol, dict, energy=None, minenergy=MINENERGY, minrate=0
z = getz(ele)
for n in range(len(ElementXrays)):
rays = ElementXrays[n]
if (rays == 'L xrays'):
if rays == 'L xrays':
shellrates = getElementLShellRates(ele,energy=energy,photoweights=photoweights)
elif (rays == 'M xrays'):
elif rays == 'M xrays':
shellrates = getElementMShellRates(ele,energy=energy,photoweights=photoweights)
else:
shellrates = ElementShellRates[n][z-1]
Expand Down
6 changes: 5 additions & 1 deletion src/PyMca5/PyMcaPhysics/xrf/MShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The PyMca X-Ray Fluorescence Toolkit
#
# Copyright (c) 2004-2016 European Synchrotron Radiation Facility
# Copyright (c) 2004-2025 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
Expand Down Expand Up @@ -289,6 +289,10 @@ def getweights(ele,excitedshells=None):
ElementM3ShellTransitions[2:] + \
ElementM4ShellTransitions[2:] + \
ElementM5ShellTransitions[2:]

for i in range(len(ElementMShellTransitions)):
ElementMShellTransitions[i]+="*"

nele = len(ElementM1ShellRates)
elements = range(1,nele+1)
weights = []
Expand Down
Loading