GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit 3b1c1bac authored by Thomas Vincent's avatar Thomas Vincent

split peak_fit method to make blocking one work again

parent 14765f07
......@@ -246,7 +246,7 @@ class FitWidget(Qt.QWidget):
self.sigProcessStarted.emit()
try:
for progress in self.__fitter.peak_fit(blocking=False):
for progress in self.__fitter.peak_fit_iterator():
self.__progBar.setValue(int(100 * progress))
Qt.QApplication.processEvents()
......
......@@ -154,23 +154,25 @@ class PeakFitter(object):
results = property(lambda self: self.__results)
def peak_fit(self, blocking=True):
"""Run fit/com processing
def peak_fit(self):
"""Blocking execution of fit/com processing.
:param bool blocking:
True for blocking until the end of the processing,
False for yielding progress during the processing.
It returns the fit/com result
"""
self.__results = None
for _ in self.__peak_fit():
pass
return self.results
if blocking:
for _ in self.__peak_fit():
pass
else:
for progress, _ in enumerate(self.__peak_fit()):
yield progress / len(self.__indices)
def peak_fit_iterator(self):
"""Run fit/com processing as a generator.
It yields a progress indicator in [0, 1].
"""
for progress, _ in enumerate(self.__peak_fit()):
yield progress / len(self.__indices)
def __peak_fit(self):
self.__results = None
self.__set_status(self.RUNNING)
pool = multiprocessing.Pool(self.__n_proc)
......
Markdown is supported
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