Commit c29af11d authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[io] Changes name of functions to read and write components into Nexus file

parent 6cd97d67
Pipeline #21168 passed with stage
in 1 minute and 58 seconds
......@@ -37,7 +37,7 @@ from silx.gui.plot import ScatterView, StackView, Plot1D
from silx.gui.widgets.FrameBrowser import HorizontalSliderWithBrowser
import darfix
from darfix.io.utils import write_process
from darfix.io.utils import write_components
class DisplayComponentsWidget(qt.QMainWindow):
......@@ -172,8 +172,8 @@ class DisplayComponentsWidget(qt.QMainWindow):
fileDialog.setOption(fileDialog.DontUseNativeDialog)
fileDialog.setDefaultSuffix(".h5")
if fileDialog.exec_():
write_process(fileDialog.selectedFiles()[0], 'entry',
self.dimensions, self.W, self.components, 1)
write_components(fileDialog.selectedFiles()[0], 'entry',
self.dimensions, self.W, self.components, 1)
def _activeCurveChanged(self, prev_legend=None, legend=None):
if legend:
......
......@@ -38,7 +38,7 @@ from silx.gui.plot import StackView
import darfix
from darfix.core.componentsMatching import ComponentsMatching, Method
from darfix.gui.datasetSelectionWidget import FilenameSelectionWidget
from darfix.io.utils import read_process
from darfix.io.utils import read_components
import logging
_logger = logging.getLogger(__file__)
......@@ -127,7 +127,7 @@ class LinkComponentsWidget(qt.QWidget):
msg.exec_()
return
dimensions, components, W = read_process(filename)
dimensions, components, W = read_components(filename)
self._linked_sv.hide()
self._sv1.setStack(components)
......@@ -148,7 +148,7 @@ class LinkComponentsWidget(qt.QWidget):
if filename == '':
return
dimensions, components, W = read_process(filename)
dimensions, components, W = read_components(filename)
self._linked_sv.hide()
self._sv2.setStack(components)
......
......@@ -72,7 +72,7 @@ def advancement_display(iteration, total, prefix='', suffix='', decimals=1, leng
print()
def read_process(h5_file):
def read_components(h5_file):
with h5py.File(h5_file, "r") as nx:
# find the default NXentry group
nx_entry = nx[nx.attrs["default"]]
......@@ -89,8 +89,8 @@ def read_process(h5_file):
return dimensions, components, W
def write_process(h5_file, entry, dimensions, W, data, processing_order,
data_path='/', overwrite=True):
def write_components(h5_file, entry, dimensions, W, data, processing_order,
data_path='/', overwrite=True):
"""
Write a stack of components and its parameters into .h5
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment