diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a50d82fd5..19e539b3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: "" @@ -111,6 +111,7 @@ jobs: run: | pip install --upgrade wheel pip install --upgrade numpy + pip install --upgrade build # put cython pip install cython @@ -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 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 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: diff --git a/src/PyMca5/PyMcaPhysics/xrf/Elements.py b/src/PyMca5/PyMcaPhysics/xrf/Elements.py index dc5181a94..a7e1ecfc7 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)): @@ -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] @@ -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] 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 = []