Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xsocs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kmap
xsocs
Commits
3ad708de
Commit
3ad708de
authored
Nov 16, 2018
by
Thomas Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docstring and code style
parent
7855f5ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
35 deletions
+29
-35
xsocs/gui/process/FitWidget.py
xsocs/gui/process/FitWidget.py
+29
-35
No files found.
xsocs/gui/process/FitWidget.py
View file @
3ad708de
...
...
@@ -48,9 +48,7 @@ _logger = logging.getLogger(__name__)
class
Roi3DSelectorWidget
(
Qt
.
QWidget
):
"""
Widget displaying three RoiAxisWidgets, one for each axis.
"""
"""Widget displaying three RoiAxisWidgets, one for each axis."""
sigRoiChanged
=
Qt
.
Signal
(
object
)
"""Signal emitted when one of the slider is moved.
...
...
@@ -60,7 +58,7 @@ class Roi3DSelectorWidget(Qt.QWidget):
"""
sigRoiToggled
=
Qt
.
Signal
(
bool
)
"""
Signal emitted when the QGroupWidget is toggled on/off. """
"""Signal emitted when the QGroupWidget is toggled on/off. """
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
Roi3DSelectorWidget
,
self
).
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -107,37 +105,34 @@ class Roi3DSelectorWidget(Qt.QWidget):
class
FitWidget
(
Qt
.
QWidget
):
"""
Fit process widget.
:param qspaceFile:
:param kwargs:
"""Fit process widget.
:param str qspaceFile:
"""
sigFitTypeChanged
=
Qt
.
Signal
(
object
)
""" Signal emitted when the fit type is changed
"""
"""Signal emitted when the fit type is changed"""
sigProcessDone
=
Qt
.
Signal
(
object
)
""" Signal emitted when a fit is done. Argument is the name of the file
containing the results.
"""Signal emitted when a fit is done.
Argument is the name of the file containing the results.
"""
sigProcessStarted
=
Qt
.
Signal
()
""" Signal emitted when a fit is started. Argument is the name of the file
containing the results.
"""Signal emitted when a fit is started.
Argument is the name of the file containing the results.
"""
__sigFitDone
=
Qt
.
Signal
()
__
progressDelay
=
500
__
PROGRESS_DELAY
=
500
# TODO : pass the actual roi values
def
__init__
(
self
,
qspaceFile
,
**
kwargs
):
def
__init__
(
self
,
qspaceFile
,
**
kwargs
):
super
(
FitWidget
,
self
).
__init__
(
**
kwargs
)
self
.
__qspaceH5
=
qspaceH5
=
QSpaceH5
(
qspaceFile
)
self
.
__qspaceH5
=
QSpaceH5
(
qspaceFile
)
self
.
__progTimer
=
None
self
.
__outputFile
=
None
...
...
@@ -185,8 +180,8 @@ class FitWidget(Qt.QWidget):
layout
.
addRow
(
self
.
__statusLabel
)
# Set sliders range and step
with
qspaceH5
:
qDimensions
=
qspaceH5
.
qspace_dimension_values
with
self
.
__
qspaceH5
:
qDimensions
=
self
.
__
qspaceH5
.
qspace_dimension_values
for
slider
,
binCenters
in
zip
(
self
.
roiWidget
().
sliders
(),
qDimensions
):
slider
.
setPositionCount
(
len
(
binCenters
)
+
1
)
...
...
@@ -197,19 +192,20 @@ class FitWidget(Qt.QWidget):
self
.
__sigFitDone
.
connect
(
self
.
__slotFitDone
)
def
roiWidget
(
self
):
"""
Returns the Roi3DSelectorWidget instance.
:r
eturn:
"""
Returns the Roi3DSelectorWidget instance.
:r
type: Roi3DSelectorWidget
"""
return
self
.
__roiWidget
def
setQSpaceIndex
(
self
,
index
):
"""
"""Set slider backgrounds from given QSpace index.
Selects the qspace cube at *index* in the qspace H5 file, and
displays the corresponding profiles in the sliders.
(profile = cube summed along the corresponding axis)
:param index:
:
return:
:
param int index: QSpace index
"""
qspace
=
self
.
__qspaceH5
.
qspace_slice
(
index
)
dim2_sum
=
qspace
.
sum
(
axis
=
0
).
sum
(
axis
=
0
)
...
...
@@ -230,16 +226,14 @@ class FitWidget(Qt.QWidget):
self
.
__runButton
.
setEnabled
(
outputFile
is
not
None
)
def
getFitName
(
self
):
"""
Returns the name of the selected fit.
(e.g : Gaussian, Centroid, ...)
:return:
"""Returns the name of the selected fit, e.g., Gaussian, Centroid.
:rtype: str
"""
# TODO : real enum
return
self
.
__fitTypeCb
.
currentText
()
def
__slotRunClicked
(
self
):
# TODO : put some safeguards
self
.
__lock
(
True
)
...
...
@@ -278,7 +272,7 @@ class FitWidget(Qt.QWidget):
try
:
self
.
sigProcessStarted
.
emit
()
self
.
__fitter
.
peak_fit
(
blocking
=
False
,
callback
=
self
.
__sigFitDone
.
emit
)
self
.
__progTimer
.
start
(
self
.
__
progressDelay
)
self
.
__progTimer
.
start
(
self
.
__
PROGRESS_DELAY
)
except
Exception
as
ex
:
# TODO : popup
self
.
__statusLabel
.
setText
(
'ERROR'
)
...
...
@@ -289,7 +283,7 @@ class FitWidget(Qt.QWidget):
def
__slotProgTimer
(
self
):
if
self
.
__fitter
:
self
.
__progBar
.
setValue
(
self
.
__fitter
.
progress
())
self
.
__progTimer
.
start
(
self
.
__
progressDelay
)
self
.
__progTimer
.
start
(
self
.
__
PROGRESS_DELAY
)
def
__lock
(
self
,
lock
):
enable
=
not
lock
...
...
Write
Preview
Markdown
is supported
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