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
44b9480c
Commit
44b9480c
authored
Aug 11, 2021
by
Wout De Nolf
Browse files
Refactor Process constructor to avoid argument name collisions
parent
536e90ff
Pipeline
#52518
passed with stages
in 9 minutes and 23 seconds
Changes
17
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
est/core/process/energyroi.py
View file @
44b9480c
...
...
@@ -52,14 +52,11 @@ class ROI1D:
self
.
to_
=
to_
class
EnergyROIProcess
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"energy roi"
,
varinfo
=
varinfo
,
**
inputs
)
class
EnergyROIProcess
(
Process
,
name
=
"energy roi"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
_roi
=
ROI1D
(
0
,
9999999999
)
def
set_properties
(
self
,
properties
:
dict
):
...
...
est/core/process/ignoreprocess.py
View file @
44b9480c
...
...
@@ -30,7 +30,7 @@ __date__ = "22/07/2021"
from
ewokscore.task
import
Task
class
IgnoreOutput
(
Task
):
class
IgnoreOutput
(
Task
,
input_names
=
[
"xas_obj"
]
):
"""Simple Ignore task when an input is provided but no output. Used
in the case of pure display widget.
...
...
@@ -38,11 +38,8 @@ class IgnoreOutput(Task):
ewoks
"""
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
()
class
BlankTask
(
Task
):
class
BlankTask
(
Task
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]):
"""Simple black task which will copy received xas_obj from inputs to
outputs.
...
...
@@ -50,9 +47,6 @@ class BlankTask(Task):
ewoks
"""
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
run
(
self
):
self
.
outputs
.
xas_obj
=
self
.
inputs
.
xas_obj
...
...
est/core/process/io.py
View file @
44b9480c
...
...
@@ -34,15 +34,12 @@ from est.io.utils.information import InputInformation
import
pkg_resources
class
DumpXasObject
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"result"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
super
().
__init__
(
name
=
"dump xas object"
,
varinfo
=
varinfo
,
**
inputs
)
self
.
_output_file
=
varinfo
.
get
(
"output_file"
,
None
)
class
DumpXasObject
(
Process
,
name
=
"dump xas object"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"result"
]
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
_output_file
=
kwargs
.
get
(
"varinfo"
,
dict
()).
get
(
"output_file"
,
None
)
@
property
def
output_file
(
self
):
...
...
@@ -101,17 +98,13 @@ class DumpXasObject(Process):
__call__
=
run
class
ReadXasObject
(
Process
):
_INPUT_NAMES
=
set
()
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
super
().
__init__
(
name
=
"read xas"
,
varinfo
=
varinfo
,
**
inputs
)
if
"input_information"
not
in
varinfo
:
class
ReadXasObject
(
Process
,
name
=
"read xas"
,
output_names
=
[
"xas_obj"
]):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
input_information
=
kwargs
.
get
(
"varinfo"
,
dict
()).
get
(
"input_information"
,
None
)
if
input_information
is
None
:
raise
ValueError
(
"Input information should be provided"
)
self
.
setConfiguration
(
varinfo
[
"
input_information
"
]
)
self
.
setConfiguration
(
input_information
)
def
run
(
self
):
from
est.core.io
import
XASReader
...
...
est/core/process/larch/autobk.py
View file @
44b9480c
...
...
@@ -132,15 +132,9 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
Larch_autobk
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"autobk"
,
varinfo
=
varinfo
,
**
inputs
)
class
Larch_autobk
(
Process
,
name
=
"autobk"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
set_properties
(
self
,
properties
):
if
"_larchSettings"
in
properties
:
self
.
_settings
=
properties
[
"_larchSettings"
]
...
...
est/core/process/larch/mback.py
View file @
44b9480c
...
...
@@ -123,15 +123,9 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
Larch_mback
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"mback"
,
varinfo
=
varinfo
,
**
inputs
)
class
Larch_mback
(
Process
,
name
=
"mback"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
set_properties
(
self
,
properties
):
if
"_larchSettings"
in
properties
:
self
.
_settings
=
properties
[
"_larchSettings"
]
...
...
est/core/process/larch/mback_norm.py
View file @
44b9480c
...
...
@@ -132,15 +132,9 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
Larch_mback_norm
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"mback_norm"
,
varinfo
=
varinfo
,
**
inputs
)
class
Larch_mback_norm
(
Process
,
name
=
"mback_norm"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
set_properties
(
self
,
properties
):
if
"_larchSettings"
in
properties
:
self
.
_settings
=
properties
[
"_larchSettings"
]
...
...
est/core/process/larch/pre_edge.py
View file @
44b9480c
...
...
@@ -128,15 +128,9 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
Larch_pre_edge
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"pre_edge"
,
varinfo
=
varinfo
,
**
inputs
)
class
Larch_pre_edge
(
Process
,
name
=
"pre_edge"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
set_properties
(
self
,
properties
):
if
"_larchSettings"
in
properties
:
self
.
_settings
=
properties
[
"_larchSettings"
]
...
...
est/core/process/larch/xftf.py
View file @
44b9480c
...
...
@@ -155,14 +155,11 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
Larch_xftf
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"xftf"
,
varinfo
=
varinfo
,
**
inputs
)
class
Larch_xftf
(
Process
,
name
=
"xftf"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
_plot_settings
=
{}
def
set_properties
(
self
,
properties
):
...
...
est/core/process/noise.py
View file @
44b9480c
...
...
@@ -146,14 +146,11 @@ def xas_noise(xas_obj):
return
xas_noise_process
.
run
()
class
NoiseProcess
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"noise"
,
varinfo
=
varinfo
,
**
inputs
)
class
NoiseProcess
(
Process
,
name
=
"noise"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
_window_size
=
5
self
.
_polynomial_order
=
2
...
...
est/core/process/process.py
View file @
44b9480c
...
...
@@ -193,11 +193,9 @@ class _NexusDatasetDef:
return
self
.
name
class
Process
(
Task
):
def
__init__
(
self
,
name
,
varinfo
,
**
inputs
):
super
().
__init__
(
varinfo
=
varinfo
,
**
inputs
)
self
.
_name
=
name
assert
type
(
self
.
_name
)
is
str
class
Process
(
Task
,
register
=
False
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
_advancement
=
Progress
(
name
=
self
.
name
)
self
.
__stop
=
False
"""flag to notice when a end of process is required"""
...
...
@@ -205,9 +203,13 @@ class Process(Task):
# configuration
self
.
_callbacks
=
[]
def
__init_subclass__
(
subclass
,
name
=
""
,
**
kwargs
):
super
().
__init_subclass__
(
**
kwargs
)
subclass
.
_NAME
=
name
@
property
def
name
(
self
)
->
str
:
return
self
.
_
name
return
self
.
_
NAME
def
stop
(
self
):
self
.
__stop
=
True
...
...
est/core/process/pymca/exafs.py
View file @
44b9480c
...
...
@@ -143,17 +143,12 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
PyMca_exafs
(
Process
):
class
PyMca_exafs
(
Process
,
name
=
"exafs"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
"""Process spectra for exafs and get information about the processing
advancement"""
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"exafs"
,
varinfo
=
varinfo
,
**
inputs
)
def
set_properties
(
self
,
properties
):
if
"_pymcaSettings"
in
properties
:
self
.
setConfiguration
(
properties
[
"_pymcaSettings"
])
...
...
est/core/process/pymca/ft.py
View file @
44b9480c
...
...
@@ -148,15 +148,7 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
PyMca_ft
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"ft"
,
varinfo
=
varinfo
,
**
inputs
)
class
PyMca_ft
(
Process
,
name
=
"ft"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]):
def
set_properties
(
self
,
properties
):
if
"_pymcaSettings"
in
properties
:
self
.
_settings
=
properties
[
"_pymcaSettings"
]
...
...
est/core/process/pymca/k_weight.py
View file @
44b9480c
...
...
@@ -136,15 +136,9 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
PyMca_k_weight
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"k weight"
,
varinfo
=
varinfo
,
**
inputs
)
class
PyMca_k_weight
(
Process
,
name
=
"k weight"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
set_properties
(
self
,
properties
):
if
"_kWeightSetting"
in
properties
:
_properties
=
properties
.
copy
()
...
...
est/core/process/pymca/normalization.py
View file @
44b9480c
...
...
@@ -122,16 +122,9 @@ _USE_MULTIPROCESSING_POOL = False
# note: we cannot use multiprocessing pool with pypushflow for now.
class
PyMca_normalization
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
"normalization"
,
varinfo
=
varinfo
,
**
inputs
)
self
.
_advancement
=
Progress
(
self
.
name
)
class
PyMca_normalization
(
Process
,
name
=
"normalization"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
set_properties
(
self
,
properties
):
if
"_pymcaSettings"
in
properties
:
self
.
_settings
=
properties
[
"_pymcaSettings"
]
...
...
est/core/process/roi.py
View file @
44b9480c
...
...
@@ -87,14 +87,11 @@ class _ROI(object):
return
_ROI
(
origin
=
origin
,
size
=
size
)
class
ROIProcess
(
Process
):
_INPUT_NAMES
=
set
([
"xas_obj"
])
_OUTPUT_NAMES
=
set
([
"xas_obj"
])
def
__init__
(
self
,
varinfo
=
None
,
**
inputs
):
Process
.
__init__
(
self
,
name
=
"roi"
,
varinfo
=
varinfo
,
**
inputs
)
class
ROIProcess
(
Process
,
name
=
"roi"
,
input_names
=
[
"xas_obj"
],
output_names
=
[
"xas_obj"
]
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
_roi
=
None
def
set_properties
(
self
,
properties
:
dict
):
...
...
est/core/process/setconfig.py
View file @
44b9480c
...
...
@@ -46,10 +46,7 @@ def _xas_set_config(xas_obj):
return
xas_set_config
.
process
(
xas_obj
=
xas_obj
)
class
_SetConfigProcess
(
Process
):
def
__init__
(
self
):
Process
.
__init__
(
self
,
name
=
"set_config"
)
class
_SetConfigProcess
(
Process
,
name
=
"set_config"
):
def
process
(
self
,
xas_obj
):
"""
...
...
orangecontrib/est/widgets/utils/noise.py
View file @
44b9480c
...
...
@@ -182,7 +182,7 @@ class QNoise(est.core.process.noise.NoiseProcess):
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
est
.
core
.
process
.
noise
.
NoiseProcess
.
__init__
(
self
,
*
args
,
**
kwargs
)
super
()
.
__init__
(
*
args
,
**
kwargs
)
self
.
_advancement
=
QProgress
(
"noise"
)
def
_pool_process
(
self
,
xas_obj
):
...
...
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