Skip to content

Commit

Permalink
Merge pull request #1037 from vasole/strategy
Browse files Browse the repository at this point in the history
[XRF] Strategy. Do not use two groups of the same element.
  • Loading branch information
vasole authored Oct 9, 2023
2 parents 301ba2d + af3ba82 commit 06ba806
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion PyMca5/PyMcaPhysics/xrf/SingleLayerStrategy.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-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.
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 06ba806

Please sign in to comment.