From af3ba825fb498bb9a0ec3deac567c5b419676a47 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Mon, 9 Oct 2023 11:54:20 +0200 Subject: [PATCH] Do not use two groups of the same element. --- PyMca5/PyMcaPhysics/xrf/SingleLayerStrategy.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PyMca5/PyMcaPhysics/xrf/SingleLayerStrategy.py b/PyMca5/PyMcaPhysics/xrf/SingleLayerStrategy.py index c077c1361..69719896a 100644 --- a/PyMca5/PyMcaPhysics/xrf/SingleLayerStrategy.py +++ b/PyMca5/PyMcaPhysics/xrf/SingleLayerStrategy.py @@ -2,7 +2,7 @@ # # The PyMca X-Ray Fluorescence Toolkit # -# Copyright (c) 2004-2018 European Synchrotron Radiation Facility +# Copyright (c) 2004-2023 European Synchrotron Radiation Facility # # This file is part of the PyMca X-ray Fluorescence Toolkit developed at # the ESRF by the Software group. @@ -118,6 +118,7 @@ def applyStrategy(self, fitResult, fluorescenceRates, currentIteration=None): CompoundList = [] CompoundFraction = [] materialCounter = -1 + previousElements = [] for group in strategyConfiguration["peaks"]: materialCounter += 1 if "-" in group: @@ -126,6 +127,12 @@ def applyStrategy(self, fitResult, fluorescenceRates, currentIteration=None): _logger.debug("ignoring %s", group) continue ele = group.split()[0] + if ele in previousElements: + print("Strategy element %s considered twice! Ignoring second entry" % ele) + _logger.critical("Strategy element %s considered twice. Ignoring second entry" % ele) + continue + else: + previousElements.append(ele) material = strategyConfiguration["materials"][materialCounter] if material in ["-", ele, ele + "1"]: CompoundList.append(ele)