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
2199911a
Commit
2199911a
authored
Dec 16, 2016
by
Damien Naudet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temporary link fit to qspace.
parent
c1960275
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
16 deletions
+55
-16
kmap/gui/XsocsGui.py
kmap/gui/XsocsGui.py
+26
-4
kmap/gui/view/FitView.py
kmap/gui/view/FitView.py
+26
-12
kmap/gui/view/QspaceView.py
kmap/gui/view/QspaceView.py
+3
-0
No files found.
kmap/gui/XsocsGui.py
View file @
2199911a
...
...
@@ -26,6 +26,7 @@
from
__future__
import
absolute_import
import
os
from
collections
import
OrderedDict
from
silx.gui
import
qt
as
Qt
...
...
@@ -95,8 +96,8 @@ class XsocsGui(Qt.QMainWindow):
self
.
__project
=
None
self
.
__intensityView
=
None
self
.
__qspaceViews
=
{}
self
.
__fitViews
=
{}
self
.
__qspaceViews
=
OrderedDict
()
self
.
__fitViews
=
OrderedDict
()
self
.
__createViews
()
self
.
__createActions
()
...
...
@@ -214,7 +215,7 @@ class XsocsGui(Qt.QMainWindow):
tree
=
property
(
lambda
self
:
self
.
centralWidget
())
def
__showQSpace
(
self
,
node
):
def
__showQSpace
(
self
,
node
,
bringToFront
=
True
):
view
=
self
.
__qspaceViews
.
get
(
node
)
if
not
view
:
view
=
QSpaceView
(
self
,
model
=
node
.
model
,
node
=
node
)
...
...
@@ -227,7 +228,9 @@ class XsocsGui(Qt.QMainWindow):
view
.
resize
(
size
)
view
.
sigProcessApplied
.
connect
(
self
.
__qspaceRoiApplied
)
view
.
show
()
view
.
raise_
()
if
bringToFront
:
view
.
raise_
()
return
view
def
__qspaceRoiApplied
(
self
,
node
,
roi
):
item
=
h5NodeToProjectItem
(
node
)
...
...
@@ -257,7 +260,26 @@ class XsocsGui(Qt.QMainWindow):
# TODO : unmaintainable and FUGLY!!!!! node.parent().parent()
view
=
FitView
(
self
,
node
.
model
,
node
,
node
.
parent
().
parent
())
self
.
__fitViews
[
node
]
=
view
view
.
sigPointSelected
.
connect
(
self
.
__fitViewPointSelected
)
view
.
show
()
return
view
def
__fitViewPointSelected
(
self
,
point
):
sender
=
self
.
sender
()
if
not
isinstance
(
sender
,
FitView
):
return
views
=
self
.
__fitViews
.
values
()
try
:
viewIdx
=
views
.
index
(
sender
)
except
ValueError
:
# TODO
return
fitNode
=
self
.
__fitViews
.
keys
()[
viewIdx
]
qspaceNode
=
fitNode
.
parent
().
parent
()
qspaceView
=
self
.
__showQSpace
(
qspaceNode
,
bringToFront
=
False
)
qspaceView
.
selectPoint
(
point
.
x
,
point
.
y
)
def
model
(
self
):
return
self
.
tree
.
model
()
...
...
kmap/gui/view/FitView.py
View file @
2199911a
...
...
@@ -333,7 +333,7 @@ class DropPlotWidget(XsocsPlot2D):
class
FitView
(
Qt
.
QMainWindow
):
sigP
rocessAppli
ed
=
Qt
.
Signal
(
object
)
sigP
ointSelect
ed
=
Qt
.
Signal
(
object
)
def
__init__
(
self
,
parent
,
...
...
@@ -343,6 +343,8 @@ class FitView(Qt.QMainWindow):
**
kwargs
):
super
(
FitView
,
self
).
__init__
(
parent
)
self
.
__firstShow
=
True
self
.
setWindowTitle
(
'[XSOCS] {0}'
.
format
(
node
.
h5Path
))
item
=
h5NodeToProjectItem
(
node
)
...
...
@@ -425,24 +427,24 @@ class FitView(Qt.QMainWindow):
grpLayout
.
addWidget
(
plot
)
self
.
__fitPlots
.
append
(
plot
)
plot
.
setGraphTitle
(
'Qx fit'
)
self
.
setShowMousePosition
(
True
)
self
.
setShowSelectedCoordinates
(
True
)
plot
.
setShowMousePosition
(
True
)
plot
.
setShowSelectedCoordinates
(
True
)
plot
=
XsocsPlot2D
()
plot
.
setKeepDataAspectRatio
(
False
)
grpLayout
.
addWidget
(
plot
)
self
.
__fitPlots
.
append
(
plot
)
plot
.
setGraphTitle
(
'Qy fit'
)
self
.
setShowMousePosition
(
True
)
self
.
setShowSelectedCoordinates
(
True
)
plot
.
setShowMousePosition
(
True
)
plot
.
setShowSelectedCoordinates
(
True
)
plot
=
XsocsPlot2D
()
plot
.
setKeepDataAspectRatio
(
False
)
grpLayout
.
addWidget
(
plot
)
self
.
__fitPlots
.
append
(
plot
)
plot
.
setGraphTitle
(
'Qz fit'
)
self
.
setShowMousePosition
(
True
)
self
.
setShowSelectedCoordinates
(
True
)
plot
.
setShowMousePosition
(
True
)
plot
.
setShowSelectedCoordinates
(
True
)
layout
.
addWidget
(
grpBox
,
0
,
2
)
...
...
@@ -451,7 +453,16 @@ class FitView(Qt.QMainWindow):
self
.
setCentralWidget
(
centralWid
)
self
.
__initPlots
()
# self.__initPlots()
def
showEvent
(
self
,
event
):
# TODO : this is a workaround to the fact that
# plot ranges aren't set correctly when adding data when the plot
# widget hasn't been shown yet.
super
(
FitView
,
self
).
showEvent
(
event
)
if
self
.
__firstShow
:
self
.
__firstShow
=
False
self
.
__initPlots
()
def
__initPlots
(
self
):
...
...
@@ -473,8 +484,8 @@ class FitView(Qt.QMainWindow):
_initCentroid
(
self
.
__plots
,
fitH5
.
filename
,
entry
,
process
)
def
__plotSignal
(
self
,
point
):
# x, y = point.x, point.y
self
.
__plotFitResults
(
point
.
xIdx
)
self
.
sigPointSelected
.
emit
(
point
)
def
__plotFitResults
(
self
,
xIdx
):
# TODO : the values could/should be loaded when the widget is shown for the
...
...
@@ -643,9 +654,12 @@ def _initLeastSq(plots, fitH5Name, entry, process):
"""
# hard coded result name, this isn't satisfactory but I can't think
# of any other way right now.
plots
[
0
].
plotFitResult
(
fitH5Name
,
entry
,
process
,
'position'
,
FitH5
.
qx_axis
)
plots
[
1
].
plotFitResult
(
fitH5Name
,
entry
,
process
,
'position'
,
FitH5
.
qy_axis
)
plots
[
2
].
plotFitResult
(
fitH5Name
,
entry
,
process
,
'position'
,
FitH5
.
qz_axis
)
plots
[
0
].
plotFitResult
(
fitH5Name
,
entry
,
process
,
'position'
,
FitH5
.
qx_axis
)
plots
[
1
].
plotFitResult
(
fitH5Name
,
entry
,
process
,
'position'
,
FitH5
.
qy_axis
)
plots
[
2
].
plotFitResult
(
fitH5Name
,
entry
,
process
,
'position'
,
FitH5
.
qz_axis
)
def
_initCentroid
(
plots
,
fitH5Name
,
entry
,
process
):
...
...
kmap/gui/view/QspaceView.py
View file @
2199911a
...
...
@@ -396,6 +396,9 @@ class QSpaceView(Qt.QMainWindow):
self
.
sigProcessApplied
.
emit
(
self
.
__node
,
roi
)
def
selectPoint
(
self
,
x
,
y
):
self
.
__showIsoView
(
x
,
y
)
def
__pointSelected
(
self
,
point
):
xIdx
=
point
.
xIdx
x
=
point
.
x
...
...
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