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
deffcbe6
Commit
deffcbe6
authored
Feb 02, 2017
by
Damien Naudet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for python3.
parent
15d74183
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
39 additions
and
33 deletions
+39
-33
kmap/gui/XsocsGui.py
kmap/gui/XsocsGui.py
+2
-3
kmap/gui/process/FitWidget.py
kmap/gui/process/FitWidget.py
+1
-1
kmap/gui/project/Hdf5Nodes.py
kmap/gui/project/Hdf5Nodes.py
+1
-2
kmap/gui/project/ProjectItem.py
kmap/gui/project/ProjectItem.py
+1
-1
kmap/gui/silx_imports/ImageRois.py
kmap/gui/silx_imports/ImageRois.py
+4
-3
kmap/gui/view/FitView.py
kmap/gui/view/FitView.py
+5
-0
kmap/gui/view/fitview/DropPlotWidget.py
kmap/gui/view/fitview/DropPlotWidget.py
+5
-5
kmap/gui/view/fitview/FitModel.py
kmap/gui/view/fitview/FitModel.py
+6
-6
kmap/gui/widgets/XsocsPlot2D.py
kmap/gui/widgets/XsocsPlot2D.py
+2
-1
kmap/io/FitH5.py
kmap/io/FitH5.py
+2
-2
kmap/io/XsocsH5.py
kmap/io/XsocsH5.py
+5
-4
kmap/process/peak_fit.py
kmap/process/peak_fit.py
+3
-3
kmap/util/id01_spec.py
kmap/util/id01_spec.py
+2
-2
No files found.
kmap/gui/XsocsGui.py
View file @
deffcbe6
...
...
@@ -256,19 +256,18 @@ class XsocsGui(Qt.QMainWindow):
sender
=
self
.
sender
()
if
not
isinstance
(
sender
,
FitView
):
return
views
=
self
.
__fitViews
.
values
(
)
views
=
list
(
self
.
__fitViews
.
values
()
)
try
:
viewIdx
=
views
.
index
(
sender
)
except
ValueError
:
# TODO
return
fitNode
=
self
.
__fitViews
.
keys
(
)[
viewIdx
]
fitNode
=
list
(
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/process/FitWidget.py
View file @
deffcbe6
...
...
@@ -190,7 +190,7 @@ class FitWidget(Qt.QWidget):
fitLayout
=
Qt
.
QHBoxLayout
()
self
.
__fitTypeCb
=
fitTypeCb
=
Qt
.
QComboBox
()
fitTypeCb
.
addItems
(
FitWidget
.
FitTypes
.
keys
(
))
fitTypeCb
.
addItems
(
list
(
FitWidget
.
FitTypes
.
keys
()
))
fitTypeCb
.
setCurrentIndex
(
0
)
fitLayout
.
addWidget
(
Qt
.
QLabel
(
'Fit :'
))
fitLayout
.
addWidget
(
fitTypeCb
)
...
...
kmap/gui/project/Hdf5Nodes.py
View file @
deffcbe6
...
...
@@ -52,7 +52,7 @@ def getNodeClass(nodeType, attrs=None):
for
key
,
value
in
attrs
.
items
():
info
=
_registeredAttributes
.
get
(
key
)
if
info
:
klass
=
info
.
get
(
value
)
klass
=
info
.
get
(
value
.
decode
()
)
if
klass
:
break
if
not
klass
:
...
...
@@ -160,7 +160,6 @@ class H5Base(Node):
super
(
H5Base
,
self
).
__init__
(
subject
=
self
,
**
kwargs
)
self
.
setData
(
h5File
,
Qt
.
Qt
.
ToolTipRole
)
self
.
setData
(
ModelColumns
.
NameColumn
,
os
.
path
.
basename
(
self
.
h5Path
))
@
staticmethod
...
...
kmap/gui/project/ProjectItem.py
View file @
deffcbe6
...
...
@@ -62,7 +62,7 @@ def projectItemFactory(h5File, h5Path, mode=None):
# For some reason attrs.get sometimes fails,
# using "in" seems a bit more robust.
if
'XsocsClass'
in
attrs
:
xsocsClass
=
attrs
[
'XsocsClass'
]
xsocsClass
=
attrs
[
'XsocsClass'
]
.
decode
()
klass
=
getItemClass
(
xsocsClass
)
del
attrs
...
...
kmap/gui/silx_imports/ImageRois.py
View file @
deffcbe6
...
...
@@ -477,7 +477,7 @@ class ImageRoiManager(qt.QObject):
return
optionActions
def
_selectAll
(
self
,
checked
):
p
rint
self
.
_plot
.
getGraphXLimits
(),
self
.
_plot
.
getGraphYLimits
()
p
ass
def
_clearRois
(
self
,
checked
):
self
.
clear
()
...
...
@@ -507,7 +507,7 @@ class ImageRoiManager(qt.QObject):
# TODO : to raise or not to raise?
pass
rois
=
property
(
lambda
self
:
self
.
_rois
.
keys
(
))
rois
=
property
(
lambda
self
:
list
(
self
.
_rois
.
keys
()
))
def
showRois
(
self
,
show
):
# TODO : name param to tell that we only want to toggle
...
...
@@ -522,7 +522,8 @@ class ImageRoiManager(qt.QObject):
if
self
.
sender
()
!=
action
:
action
.
setChecked
(
show
)
{
roi
.
setVisible
(
show
)
for
roi
in
self
.
_rois
.
values
()}
for
roi
in
self
.
_rois
.
values
():
roi
.
setVisible
(
show
)
def
allowMultipleSelections
(
self
,
allow
):
...
...
kmap/gui/view/FitView.py
View file @
deffcbe6
...
...
@@ -64,7 +64,9 @@ class FitView(Qt.QMainWindow):
item
=
h5NodeToProjectItem
(
node
)
fitH5
=
self
.
__fitH5
=
item
.
fitH5
qspaceItem
=
h5NodeToProjectItem
(
qspaceNode
)
self
.
__qspaceH5
=
qspaceItem
.
qspaceH5
self
.
__node
=
node
with
fitH5
:
# only one entry per file supposed right now
...
...
@@ -165,6 +167,9 @@ class FitView(Qt.QMainWindow):
self
.
__sigInitPlots
.
connect
(
self
.
__firstInit
,
Qt
.
Qt
.
QueuedConnection
)
def
getFitNode
(
self
):
return
self
.
__node
def
showEvent
(
self
,
event
):
"""
Overloard method from Qt.QWidget.showEvent to set up the widget the
...
...
kmap/gui/view/fitview/DropPlotWidget.py
View file @
deffcbe6
...
...
@@ -59,15 +59,15 @@ class DropPlotWidget(XsocsPlot2D):
return
super
(
DropPlotWidget
,
self
).
dropEvent
(
event
)
qByteArray
=
mimeData
.
data
(
'application/FitModel'
)
stream
=
Qt
.
QDataStream
(
qByteArray
,
Qt
.
QIODevice
.
ReadOnly
)
h5File
=
stream
.
readString
()
entry
=
stream
.
readString
()
h5File
=
stream
.
read
Q
String
()
entry
=
stream
.
read
Q
String
()
q_axis
=
stream
.
readInt
()
type
=
stream
.
readString
()
type
=
stream
.
read
Q
String
()
if
type
==
'result'
:
process
=
stream
.
readString
()
result
=
stream
.
readString
()
process
=
stream
.
read
Q
String
()
result
=
stream
.
read
Q
String
()
self
.
plotFitResult
(
h5File
,
entry
,
process
,
result
,
q_axis
)
elif
type
==
'status'
:
self
.
plotFitStatus
(
h5File
,
entry
,
q_axis
)
...
...
kmap/gui/view/fitview/FitModel.py
View file @
deffcbe6
...
...
@@ -123,8 +123,8 @@ class FitEntryNode(H5Base):
h5file
=
self
.
h5File
entry
=
self
.
entry
stream
.
writeString
(
h5file
)
stream
.
writeString
(
entry
)
stream
.
write
Q
String
(
h5file
)
stream
.
write
Q
String
(
entry
)
stream
.
writeInt
(
q_axis
)
return
True
...
...
@@ -234,7 +234,7 @@ class FitStatusNode(FitEntryNode):
if
not
FitEntryNode
.
mimeData
(
self
,
column
,
stream
):
return
False
stream
.
writeString
(
'status'
)
stream
.
write
Q
String
(
'status'
)
return
True
...
...
@@ -294,9 +294,9 @@ class FitResultNode(FitProcessNode):
process
=
self
.
process
result
=
self
.
result
stream
.
writeString
(
'result'
)
stream
.
writeString
(
process
)
stream
.
writeString
(
result
)
stream
.
write
Q
String
(
'result'
)
stream
.
write
Q
String
(
process
)
stream
.
write
Q
String
(
result
)
return
True
...
...
kmap/gui/widgets/XsocsPlot2D.py
View file @
deffcbe6
...
...
@@ -491,7 +491,8 @@ class XsocsPlot2D(PlotWindow):
pointDock
=
self
.
__pointWidget
=
DoublePointDock
()
features
=
Qt
.
QDockWidget
.
DockWidgetVerticalTitleBar
|
Qt
.
QDockWidget
.
DockWidgetClosable
features
=
(
Qt
.
QDockWidget
.
DockWidgetVerticalTitleBar
|
Qt
.
QDockWidget
.
DockWidgetClosable
)
pointDock
.
setFeatures
(
features
)
pointDock
.
sizeHint
=
lambda
:
Qt
.
QSize
()
self
.
addDockWidget
(
Qt
.
Qt
.
BottomDockWidgetArea
,
pointDock
)
...
...
kmap/io/FitH5.py
View file @
deffcbe6
...
...
@@ -94,7 +94,7 @@ class FitH5(XsocsH5Base):
return
sorted
([
key
for
key
in
h5_file
if
(
'NX_class'
in
h5_file
[
key
].
attrs
and
h5_file
[
key
].
attrs
[
'NX_class'
]
==
'NXentry'
)])
'NX_class'
]
.
decode
()
==
'NXentry'
)])
def
processes
(
self
,
entry
):
"""
...
...
@@ -107,7 +107,7 @@ class FitH5(XsocsH5Base):
processes
=
sorted
([
key
for
key
in
entry_grp
if
(
'NX_class'
in
entry_grp
[
key
].
attrs
and
entry_grp
[
key
].
attrs
[
'NX_class'
]
==
'NXprocess'
)])
'NX_class'
]
.
decode
()
==
'NXprocess'
)])
return
processes
def
get_result_names
(
self
,
entry
,
process
):
...
...
kmap/io/XsocsH5.py
View file @
deffcbe6
...
...
@@ -76,8 +76,9 @@ class XsocsH5(XsocsH5Base):
# when there is no attribute NX_class (should return the default
# None)
self
.
__entries
=
sorted
([
key
for
key
in
h5_file
if
(
'NX_class'
in
h5_file
[
key
].
attrs
and
h5_file
[
key
].
attrs
[
'NX_class'
]
==
'NXentry'
)])
# noqa
if
(
'NX_class'
in
h5_file
[
key
].
attrs
and
h5_file
[
key
].
attrs
[
'NX_class'
].
decode
()
==
'NXentry'
)])
def
entries
(
self
):
if
self
.
__entries
is
None
:
...
...
@@ -158,8 +159,8 @@ class XsocsH5(XsocsH5Base):
def
scan_positions
(
self
,
entry
):
path
=
self
.
measurement_tpl
.
format
(
entry
)
params
=
self
.
scan_params
(
entry
)
m0
=
'/adc{0}'
.
format
(
params
[
'motor_0'
][
-
1
].
upper
())
m1
=
'/adc{0}'
.
format
(
params
[
'motor_1'
][
-
1
].
upper
())
m0
=
'/adc{0}'
.
format
(
params
[
'motor_0'
]
.
decode
()
[
-
1
].
upper
())
m1
=
'/adc{0}'
.
format
(
params
[
'motor_1'
]
.
decode
()
[
-
1
].
upper
())
n_0
=
params
[
'motor_0_steps'
]
n_1
=
params
[
'motor_1_steps'
]
...
...
kmap/process/peak_fit.py
View file @
deffcbe6
...
...
@@ -96,7 +96,7 @@ class PeakFitter(Thread):
n_proc
)
if
roi_indices
is
not
None
:
self
.
__roi_indices
=
roi_indices
[:]
self
.
__roi_indices
=
np
.
array
(
roi_indices
[:])
else
:
self
.
__roi_indices
=
None
...
...
@@ -119,7 +119,7 @@ class PeakFitter(Thread):
self
.
__set_status
(
self
.
ERROR
)
raise
self
.
__indices
=
indices
self
.
__indices
=
np
.
array
(
indices
)
def
__set_status
(
self
,
status
):
assert
status
in
self
.
__STATUSES
...
...
@@ -170,7 +170,7 @@ class PeakFitter(Thread):
try
:
with
QSpaceH5
.
QSpaceH5
(
qspace_f
)
as
qspace_h5
:
with
qspace_h5
.
qspace_dset_ctx
()
as
dset
:
with
qspace_h5
:
x_pos
=
qspace_h5
.
sample_x
[
indices
]
y_pos
=
qspace_h5
.
sample_y
[
indices
]
except
IOError
:
...
...
kmap/util/id01_spec.py
View file @
deffcbe6
...
...
@@ -332,9 +332,9 @@ class Id01DataMerger(object):
self
.
__check_parsed
()
if
scan_ids
is
None
:
scan_ids
=
self
.
__matched_scans
.
keys
(
)
scan_ids
=
list
(
self
.
__matched_scans
.
keys
()
)
if
not
isinstance
(
scan_ids
,
(
list
,
tuple
,
xrange
)):
if
not
isinstance
(
scan_ids
,
(
list
,
tuple
)):
scan_ids
=
[
scan_ids
]
scan_ids
=
set
(
scan_ids
)
...
...
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