Skip to content

Commit

Permalink
Merge pull request #802 from vasole/entry
Browse files Browse the repository at this point in the history
[HDF5] XRF batch fitting use the selected entries when dealing with one HDF5 file
  • Loading branch information
vasole authored Apr 7, 2021
2 parents 133351f + 0e4503f commit bb8c49e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
12 changes: 6 additions & 6 deletions PyMca5/PyMcaGui/io/hdf5/HDF5Selection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/*##########################################################################
# Copyright (C) 2004-2014 V.A. Sole, European Synchrotron Radiation Facility
# Copyright (C) 2004-2021 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
Expand All @@ -23,7 +23,7 @@
# THE SOFTWARE.
#
#############################################################################*/
__author__ = "V.A. Sole - ESRF Data Analysis"
__author__ = "V.A. Sole"
__contact__ = "sole@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
Expand All @@ -40,7 +40,7 @@ def __init__(self, parent=None):
self.mainLayout.setSpacing(2)
self.selectionWidgetsDict = {}
row = 0
for key in ['x', 'y', 'm']:
for key in ['entry', 'x', 'y', 'm']:
label = qt.QLabel(self)
label.setText(key+":")
line = qt.QLineEdit(self)
Expand All @@ -54,7 +54,7 @@ def setSelection(self, selection):
if 'cntlist' in selection:
# "Raw" selection
cntlist = selection['cntlist']
for key in ['x', 'y', 'm']:
for key in ['entry', 'x', 'y', 'm']:
if key not in selection:
self.selectionWidgetsDict[key].setText("")
continue
Expand All @@ -70,7 +70,7 @@ def setSelection(self, selection):
self.selectionWidgetsDict[key].setText(text)
else:
# "Digested" selection
for key in ['x', 'y', 'm']:
for key in ['entry', 'x', 'y', 'm']:
if key not in selection:
self.selectionWidgetsDict[key].setText("")
continue
Expand All @@ -86,7 +86,7 @@ def setSelection(self, selection):

def getSelection(self):
selection = {}
for key in ['x', 'y', 'm']:
for key in ['entry', 'x', 'y', 'm']:
selection[key] = []
text = safe_str(self.selectionWidgetsDict[key].text())
text = text.replace(" ","")
Expand Down
8 changes: 6 additions & 2 deletions PyMca5/PyMcaGui/pymca/PyMcaBatch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#/*##########################################################################
# Copyright (C) 2004-2020 European Synchrotron Radiation Facility
# Copyright (C) 2004-2021 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
Expand All @@ -24,7 +24,7 @@
# THE SOFTWARE.
#
#############################################################################*/
__author__ = "V.A. Sole - ESRF Data Analysis"
__author__ = "V.A. Sole"
__contact__ = "sole@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
Expand Down Expand Up @@ -1000,14 +1000,18 @@ def _hdf5Selection(self, filename):
self.showMessage(text)
self.__listView.clear()
return selection
entryList = nexusWidget.getSelectedEntries()
datasource = None
selection['entry'] = []
selection['x'] = []
selection['y'] = []
selection['m'] = []
for key in ['x', 'y', 'm']:
if len(cntSelection[key]):
for idx in cntSelection[key]:
selection[key].append(cntlist[idx])
for item in entryList:
selection['entry'].append(item[0])
return selection

def showMessage(self, text):
Expand Down
7 changes: 6 additions & 1 deletion PyMca5/PyMcaIO/HDF5Stack1D.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-2020 European Synchrotron Radiation Facility
# Copyright (c) 2004-2021 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 @@ -77,6 +77,11 @@ def loadFileList(self, filelist, selection, scanlist=None):
_logger.info("filelist = %s", filelist)
_logger.info("selection = %s", selection)
_logger.info("scanlist = %s", scanlist)

if scanlist is not None:
if type(scanlist) not in (type([]), type(())):
scanlist = [scanlist]

# all the files in the same source
hdfStack = NexusDataSource.NexusDataSource(filelist)

Expand Down

0 comments on commit bb8c49e

Please sign in to comment.