Skip to content

Commit bb8c49e

Browse files
authored
Merge pull request #802 from vasole/entry
[HDF5] XRF batch fitting use the selected entries when dealing with one HDF5 file
2 parents 133351f + 0e4503f commit bb8c49e

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

PyMca5/PyMcaGui/io/hdf5/HDF5Selection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#/*##########################################################################
2-
# Copyright (C) 2004-2014 V.A. Sole, European Synchrotron Radiation Facility
2+
# Copyright (C) 2004-2021 European Synchrotron Radiation Facility
33
#
44
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
55
# the ESRF by the Software group.
@@ -23,7 +23,7 @@
2323
# THE SOFTWARE.
2424
#
2525
#############################################################################*/
26-
__author__ = "V.A. Sole - ESRF Data Analysis"
26+
__author__ = "V.A. Sole"
2727
__contact__ = "sole@esrf.fr"
2828
__license__ = "MIT"
2929
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
@@ -40,7 +40,7 @@ def __init__(self, parent=None):
4040
self.mainLayout.setSpacing(2)
4141
self.selectionWidgetsDict = {}
4242
row = 0
43-
for key in ['x', 'y', 'm']:
43+
for key in ['entry', 'x', 'y', 'm']:
4444
label = qt.QLabel(self)
4545
label.setText(key+":")
4646
line = qt.QLineEdit(self)
@@ -54,7 +54,7 @@ def setSelection(self, selection):
5454
if 'cntlist' in selection:
5555
# "Raw" selection
5656
cntlist = selection['cntlist']
57-
for key in ['x', 'y', 'm']:
57+
for key in ['entry', 'x', 'y', 'm']:
5858
if key not in selection:
5959
self.selectionWidgetsDict[key].setText("")
6060
continue
@@ -70,7 +70,7 @@ def setSelection(self, selection):
7070
self.selectionWidgetsDict[key].setText(text)
7171
else:
7272
# "Digested" selection
73-
for key in ['x', 'y', 'm']:
73+
for key in ['entry', 'x', 'y', 'm']:
7474
if key not in selection:
7575
self.selectionWidgetsDict[key].setText("")
7676
continue
@@ -86,7 +86,7 @@ def setSelection(self, selection):
8686

8787
def getSelection(self):
8888
selection = {}
89-
for key in ['x', 'y', 'm']:
89+
for key in ['entry', 'x', 'y', 'm']:
9090
selection[key] = []
9191
text = safe_str(self.selectionWidgetsDict[key].text())
9292
text = text.replace(" ","")

PyMca5/PyMcaGui/pymca/PyMcaBatch.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
#/*##########################################################################
3-
# Copyright (C) 2004-2020 European Synchrotron Radiation Facility
3+
# Copyright (C) 2004-2021 European Synchrotron Radiation Facility
44
#
55
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
66
# the ESRF by the Software group.
@@ -24,7 +24,7 @@
2424
# THE SOFTWARE.
2525
#
2626
#############################################################################*/
27-
__author__ = "V.A. Sole - ESRF Data Analysis"
27+
__author__ = "V.A. Sole"
2828
__contact__ = "sole@esrf.fr"
2929
__license__ = "MIT"
3030
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
@@ -1000,14 +1000,18 @@ def _hdf5Selection(self, filename):
10001000
self.showMessage(text)
10011001
self.__listView.clear()
10021002
return selection
1003+
entryList = nexusWidget.getSelectedEntries()
10031004
datasource = None
1005+
selection['entry'] = []
10041006
selection['x'] = []
10051007
selection['y'] = []
10061008
selection['m'] = []
10071009
for key in ['x', 'y', 'm']:
10081010
if len(cntSelection[key]):
10091011
for idx in cntSelection[key]:
10101012
selection[key].append(cntlist[idx])
1013+
for item in entryList:
1014+
selection['entry'].append(item[0])
10111015
return selection
10121016

10131017
def showMessage(self, text):

PyMca5/PyMcaIO/HDF5Stack1D.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# The PyMca X-Ray Fluorescence Toolkit
44
#
5-
# Copyright (c) 2004-2020 European Synchrotron Radiation Facility
5+
# Copyright (c) 2004-2021 European Synchrotron Radiation Facility
66
#
77
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
88
# the ESRF by the Software group.
@@ -77,6 +77,11 @@ def loadFileList(self, filelist, selection, scanlist=None):
7777
_logger.info("filelist = %s", filelist)
7878
_logger.info("selection = %s", selection)
7979
_logger.info("scanlist = %s", scanlist)
80+
81+
if scanlist is not None:
82+
if type(scanlist) not in (type([]), type(())):
83+
scanlist = [scanlist]
84+
8085
# all the files in the same source
8186
hdfStack = NexusDataSource.NexusDataSource(filelist)
8287

0 commit comments

Comments
 (0)