From e7626dfca97007c79f1e0645a545cb06034da0f3 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 15:54:07 +0100 Subject: [PATCH 01/10] Provide individual M subshell rates. --- src/PyMca5/PyMcaPhysics/xrf/Elements.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/PyMca5/PyMcaPhysics/xrf/Elements.py b/src/PyMca5/PyMcaPhysics/xrf/Elements.py index dc5181a94..ef4b983dd 100644 --- a/src/PyMca5/PyMcaPhysics/xrf/Elements.py +++ b/src/PyMca5/PyMcaPhysics/xrf/Elements.py @@ -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. @@ -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)): @@ -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] From 4525da7a78896b8d4a62e624d0392113d09dba07 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 15:55:46 +0100 Subject: [PATCH 02/10] Show the M subshell --- src/PyMca5/PyMcaGui/physics/xrf/FitPeakSelect.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/PyMca5/PyMcaGui/physics/xrf/FitPeakSelect.py b/src/PyMca5/PyMcaGui/physics/xrf/FitPeakSelect.py index b13e783e2..a7e46ede8 100644 --- a/src/PyMca5/PyMcaGui/physics/xrf/FitPeakSelect.py +++ b/src/PyMca5/PyMcaGui/physics/xrf/FitPeakSelect.py @@ -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. @@ -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 @@ -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) @@ -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: From 53a20b400cfbd5c9c76c5dd9e50c946fb122443f Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 17:05:54 +0100 Subject: [PATCH 03/10] Separate shell and sub-shell. --- src/PyMca5/PyMcaPhysics/xrf/Elements.py | 2 +- src/PyMca5/PyMcaPhysics/xrf/MShell.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/PyMca5/PyMcaPhysics/xrf/Elements.py b/src/PyMca5/PyMcaPhysics/xrf/Elements.py index ef4b983dd..a7e1ecfc7 100644 --- a/src/PyMca5/PyMcaPhysics/xrf/Elements.py +++ b/src/PyMca5/PyMcaPhysics/xrf/Elements.py @@ -2912,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] diff --git a/src/PyMca5/PyMcaPhysics/xrf/MShell.py b/src/PyMca5/PyMcaPhysics/xrf/MShell.py index 025edcf16..94c5b41ad 100644 --- a/src/PyMca5/PyMcaPhysics/xrf/MShell.py +++ b/src/PyMca5/PyMcaPhysics/xrf/MShell.py @@ -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. @@ -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 = [] From d081a8f340d5dc7b7bca28413da2578b9c97cdb9 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 17:37:56 +0100 Subject: [PATCH 04/10] Allow to fit M subshells. --- changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index 7d00b1c5a..68870608a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 From 1c053eddad8a54c1bdf4d2be71868284f62ba547 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 17:45:46 +0100 Subject: [PATCH 05/10] 3.7 not available --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a50d82fd5..08d194941 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: include: - name-suffix: "(Minimum Versions)" os: ubuntu-latest - python-version: 3.7 + python-version: 3.8 BUILD_COMMAND: sdist QT_BINDING: PyQt5==5.14.1 XVFB_RUN: xvfb-run -a From 1e3bfa022656458ae5e5d1db88f549f2aab95db8 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 17:56:04 +0100 Subject: [PATCH 06/10] Use build --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08d194941..76eff0596 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,28 +27,28 @@ jobs: - name-suffix: "(Minimum Versions)" os: ubuntu-latest python-version: 3.8 - BUILD_COMMAND: sdist + 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: "" @@ -126,7 +126,7 @@ 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 From 3d6cb5f9071bc92b2cabce6ae1e5bd54f4cddd9a Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 17:57:55 +0100 Subject: [PATCH 07/10] Add build module --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76eff0596..88501db3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,6 +111,7 @@ jobs: run: | pip install --upgrade wheel pip install --upgrade numpy + pip install --upgrade build # put cython pip install cython From aea738585280024bec5e118a1713c11ff3862971 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 18:08:51 +0100 Subject: [PATCH 08/10] Issue with lower and capital PyMca case --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88501db3f..0fa63232b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,7 +132,7 @@ jobs: - 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 From 79e98d6250107e6c896478e4d585904ed2059a38 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 18:17:11 +0100 Subject: [PATCH 09/10] Try to make sure an updated cython is used --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fa63232b..5f64516e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,6 +132,7 @@ jobs: - name: Install from source package run: | + pip install --upgrade cython for filename in dist/*ca5-5.*; do echo "\nInstall $filename" pip install --pre $filename From f8c9a4ac7b93ae333bc1a352658ec6f7acdee272 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 13 Jan 2025 18:24:14 +0100 Subject: [PATCH 10/10] Set 3.9 as minimum version. --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f64516e9..19e539b3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: include: - name-suffix: "(Minimum Versions)" os: ubuntu-latest - python-version: 3.8 + python-version: 3.9 BUILD_COMMAND: --sdist QT_BINDING: PyQt5==5.14.1 XVFB_RUN: xvfb-run -a @@ -132,7 +132,6 @@ jobs: - name: Install from source package run: | - pip install --upgrade cython for filename in dist/*ca5-5.*; do echo "\nInstall $filename" pip install --pre $filename