Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
kmap
xsocs
Commits
3b1c1bac
Commit
3b1c1bac
authored
Nov 20, 2018
by
Thomas Vincent
Browse files
split peak_fit method to make blocking one work again
parent
14765f07
Changes
2
Hide whitespace changes
Inline
Side-by-side
xsocs/gui/process/FitWidget.py
View file @
3b1c1bac
...
...
@@ -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
()
...
...
xsocs/process/fit/peak_fit.py
View file @
3b1c1bac
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment