Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
workflow
ewoksapps
est
Commits
dd735fbd
Commit
dd735fbd
authored
Oct 06, 2021
by
Henri Payno
Browse files
[orangecontrib] fix Setting management
parent
5c2e54a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
orangecontrib/est/widgets/pymca/exafs.py
View file @
dd735fbd
...
...
@@ -29,9 +29,8 @@ __date__ = "06/07/2019"
import
logging
from
ewokscore.hashing
import
MissingData
from
Orange.widgets
import
gui
from
Orange.widgets.settings
import
Setting
from
PyMca5.PyMcaGui.physics.xas.XASPostEdgeParameters
import
XASPostEdgeParameters
from
silx.gui
import
qt
from
silx.gui.plot
import
LegendSelector
...
...
@@ -128,11 +127,6 @@ class ExafsOW(
want_main_area
=
True
resizing_enabled
=
True
_larchSettings
=
Setting
(
dict
())
# kept for compatibility
static_input
=
Setting
({
"xas_obj"
:
None
,
"exafs"
:
None
})
"""Store the configuration of the PyMca XASClass"""
def
__init__
(
self
):
super
().
__init__
()
self
.
_window
=
ExafsWindow
()
...
...
@@ -144,23 +138,13 @@ class ExafsOW(
"Normalized Units"
)
# manage settings
pymca_settings
=
self
.
static_input
.
get
(
"exafs"
,
None
)
if
pymca_settings
is
None
:
pymca_settings
=
self
.
_larchSettings
if
pymca_settings
!=
dict
():
self
.
_window
.
_pymcaWindow
.
setParameters
(
pymca_settings
)
exafs_params
=
self
.
task_input_values
.
get
(
"exafs"
,
MissingData
)
if
exafs_params
is
not
MissingData
:
self
.
_window
.
_pymcaWindow
.
setParameters
(
exafs_params
)
# signal / slot connection
self
.
_window
.
_pymcaWindow
.
sigChanged
.
connect
(
self
.
_updateProcess
)
def
_updateProcess
(
self
):
self
.
_update_settings
()
self
.
handleNewSignals
()
def
_update_settings
(
self
):
self
.
_larchSettings
=
self
.
_window
.
_pymcaWindow
.
getParameters
()
self
.
static_input
=
{
"xas_obj"
:
None
,
"exafs"
:
self
.
_window
.
_pymcaWindow
.
getParameters
(),
}
self
.
receiveDynamicInputs
(
"exafs"
,
self
.
_window
.
_pymcaWindow
.
getParameters
())
orangecontrib/est/widgets/pymca/ft.py
View file @
dd735fbd
...
...
@@ -29,20 +29,18 @@ __date__ = "06/07/2019"
import
logging
from
Orange.widgets
import
gui
from
Orange.widgets.settings
import
Setting
from
PyMca5.PyMcaGui.physics.xas.XASFourierTransformParameters
import
(
XASFourierTransformParameters
,
)
from
silx.gui
import
qt
from
silx.gui.plot
import
LegendSelector
import
est.core.process.pymca.ft
from
orangecontrib.est.process
import
_ProcessForOrangeMixIn
from
est.gui.XasObjectViewer
import
XasObjectViewer
,
ViewType
from
est.gui.XasObjectViewer
import
_normalized_exafs
,
_ft_window_plot
from
est.gui.XasObjectViewer
import
_ft_intensity_plot
,
_ft_imaginary_plot
from
ewokscore.hashing
import
MissingData
from
orangecontrib.est.widgets.container
import
_ParameterWindowContainer
...
...
@@ -145,34 +143,21 @@ class FTOW(_ProcessForOrangeMixIn, ewokstaskclass=est.core.process.pymca.ft.PyMc
want_main_area
=
True
resizing_enabled
=
True
_pymcaSettings
=
Setting
(
dict
())
# kept for compatibility
static_input
=
dict
({
"ft"
:
None
,
"xas_obj"
:
None
})
"""Store the configuration of the PyMca XASClass"""
def
__init__
(
self
):
super
().
__init__
()
self
.
_window
=
FTWindow
(
parent
=
self
)
layout
=
gui
.
vBox
(
self
.
mainArea
,
"fourier transform"
).
layout
()
layout
.
addWidget
(
self
.
_window
)
# manage settings
pymca_settings
=
self
.
static_input
.
get
(
"ft"
,
None
)
if
pymca_settings
is
None
:
pymca_settings
=
self
.
_pymcaSettings
if
pymca_settings
!=
dict
():
self
.
_window
.
_pymcaWindow
.
setParameters
(
pymca_settings
)
ft_params
=
self
.
task_input_values
.
get
(
"ft"
,
MissingData
)
if
ft_params
is
not
MissingData
:
self
.
_window
.
_pymcaWindow
.
setParameters
(
ft_params
)
# signal / slot connection
self
.
_window
.
_pymcaWindow
.
sigChanged
.
connect
(
self
.
_updateProcess
)
def
_updateProcess
(
self
,
*
arv
,
**
kwargs
):
self
.
_update_settings
()
self
.
handleNewSignals
()
self
.
receiveDynamicInputs
(
"ft"
,
self
.
_window
.
_pymcaWindow
.
getParameters
())
def
_update_settings
(
self
):
self
.
_pymcaSettings
=
self
.
_window
.
_pymcaWindow
.
getParameters
()
self
.
static_input
=
{
"xas_obj"
:
None
,
"ft"
:
self
.
_window
.
_pymcaWindow
.
getParameters
(),
}
print
(
f
"ft parameters are
{
self
.
_window
.
_pymcaWindow
.
getParameters
()
}
"
)
orangecontrib/est/widgets/pymca/k_weight.py
View file @
dd735fbd
...
...
@@ -28,9 +28,8 @@ __license__ = "MIT"
__date__
=
"06/07/2019"
import
logging
from
ewokscore.hashing
import
MissingData
from
Orange.widgets
import
gui
from
Orange.widgets.settings
import
Setting
from
silx.gui
import
qt
import
est.core.process.pymca.k_weight
from
orangecontrib.est.process
import
_ProcessForOrangeMixIn
...
...
@@ -78,37 +77,22 @@ class KWeightOW(
want_main_area
=
True
resizing_enabled
=
True
_kWeightSetting
=
Setting
(
int
(
3
))
# kept for compatibility
static_input
=
Setting
({
"xas_obj"
:
None
,
"k_weight"
:
3
})
"""Store the configuration of the PyMca XASClass"""
def
__init__
(
self
):
super
().
__init__
()
layout
=
gui
.
vBox
(
self
.
mainArea
,
"k weight"
).
layout
()
self
.
_window
=
KWeightWindow
(
parent
=
self
)
layout
.
addWidget
(
self
.
_window
)
# manage settings
k_weight
=
self
.
static_input
.
get
(
"k_weight"
)
if
k_weight
==
3
:
k_weight
=
self
.
_kWeightSetting
if
k_weight
!=
3
:
k_weight
=
self
.
task_input_values
.
get
(
"k_weight"
,
MissingData
)
if
k_weight
is
not
MissingData
:
self
.
_window
.
_k_spin_box
.
setValue
(
k_weight
)
# signal / slot connection
self
.
_window
.
_k_spin_box
.
valueChanged
.
connect
(
self
.
_updateProcess
)
def
_updateProcess
(
self
,
*
arv
,
**
kwargs
):
self
.
_update_settings
()
self
.
handleNewSignals
()
self
.
receiveDynamicInputs
(
"k_weight"
,
self
.
_window
.
_k_spin_box
.
value
())
def
_update_settings
(
self
):
self
.
_kWeightSetting
=
self
.
_window
.
_k_spin_box
.
value
()
self
.
static_input
=
{
"xas_obj"
:
None
,
"k_weight"
:
self
.
_window
.
_k_spin_box
.
value
(),
}
def
inputsChanged
(
self
):
def
task_input_changed
(
self
):
pass
orangecontrib/est/widgets/pymca/normalization.py
View file @
dd735fbd
...
...
@@ -29,9 +29,7 @@ __date__ = "05/10/2021"
import
logging
from
Orange.widgets
import
gui
from
Orange.widgets.settings
import
Setting
from
PyMca5.PyMcaGui.physics.xas.XASNormalizationParameters
import
(
XASNormalizationParameters
,
)
...
...
@@ -49,6 +47,7 @@ from orangecontrib.est.widgets.container import _ParameterWindowContainer
from
est.gui.e0calculator
import
E0CalculatorDialog
from
est.gui.XasObjectViewer
import
XasObjectViewer
,
ViewType
import
est.core.process.pymca.normalization
from
ewokscore.hashing
import
MissingData
_logger
=
logging
.
getLogger
(
__file__
)
...
...
@@ -195,11 +194,6 @@ class NormalizationOW(
want_main_area
=
True
resizing_enabled
=
True
_pymcaSettings
=
Setting
(
dict
())
# Kept for compatibility
static_input
=
Setting
({
"xas_obj"
:
None
,
"normalization"
:
None
})
"""Store the configuration of the PyMca XASClass"""
def
__init__
(
self
):
super
().
__init__
()
self
.
_window
=
NormalizationWindow
(
parent
=
self
)
...
...
@@ -207,16 +201,13 @@ class NormalizationOW(
layout
.
addWidget
(
self
.
_window
)
self
.
_window
.
xasObjViewer
.
setWindowTitle
(
"spectra"
)
norm_params
=
self
.
task_input_values
.
get
(
"normalization"
,
MissingData
)
if
norm_params
is
not
MissingData
:
self
.
_window
.
_pymcaWindow
.
setParameters
(
norm_params
)
# expose API
self
.
setE0
=
self
.
_window
.
setE0
# manage settings
pymca_settings
=
self
.
static_input
.
get
(
"normalization"
,
None
)
if
pymca_settings
is
None
:
pymca_settings
=
self
.
_pymcaSettings
if
pymca_settings
!=
dict
():
self
.
_window
.
_pymcaWindow
.
setParameters
(
pymca_settings
)
# connect signals / slots
pymcaWindowContainer
=
self
.
_window
.
_pymcaWindow
pymcaWindowContainer
.
sigChanged
.
connect
(
self
.
_updateProcess
)
...
...
@@ -226,17 +217,12 @@ class NormalizationOW(
)
def
_updateProcess
(
self
):
self
.
_update_settings
()
self
.
handleNewSignals
()
self
.
receiveDynamicInputs
(
"normalization"
,
self
.
_window
.
_pymcaWindow
.
getParameters
()
)
def
_update_settings
(
self
):
self
.
_pymcaSettings
=
self
.
_window
.
_pymcaWindow
.
getParameters
()
self
.
static_input
=
{
"xas_obj"
:
None
,
"normalization"
:
self
.
_window
.
_pymcaWindow
.
getParameters
(),
}
def
inputsChanged
(
self
):
def
task_input_changed
(
self
):
if
"xas_obj"
in
self
.
task_inputs
:
xas_obj
=
self
.
task_inputs
[
"xas_obj"
]
if
"e0"
in
xas_obj
.
configuration
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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