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
db657de7
Commit
db657de7
authored
Dec 22, 2020
by
payno
Browse files
[spectra] fix: replace some _spectra_volume to Spectra.map_to
parent
190f4842
Changes
3
Hide whitespace changes
Inline
Side-by-side
est/core/process/process.py
View file @
db657de7
...
...
@@ -167,8 +167,7 @@ class Process(object):
if
use
==
"_spectra_volume"
:
# if we can display the result as a numpy.array 3d
try
:
_data
[
key
]
=
XASObject
.
_spectra_volume
(
xas_obj
.
spectra
,
_data
[
key
]
=
xas_obj
.
spectra
.
map_to
(
key
=
key
,
relative_to
=
relative_to
,
)
...
...
est/core/types/xasobject.py
View file @
db657de7
...
...
@@ -297,16 +297,7 @@ class XASObject(object):
return
res
def
absorbed_beam
(
self
)
->
numpy
.
ndarray
:
return
XASObject
.
_spectra_volume
(
spectra
=
self
.
spectra
,
key
=
"mu"
,
)
@
staticmethod
def
_spectra_volume
(
spectra
:
Spectra
,
key
:
str
,
relative_to
:
str
=
"energy"
):
"""Convert a list of spectra (mu) to a numpy array.
..note: only convert raw data for now"""
return
spectra
.
map_to
(
key
=
key
,
relative_to
=
relative_to
)
return
self
.
spectra
.
map_to
(
key
=
"mu"
)
def
load_frm_dict
(
self
,
ddict
:
dict
):
"""load XAS values from a dict"""
...
...
est/gui/XasObjectViewer.py
View file @
db657de7
...
...
@@ -242,7 +242,6 @@ class MapViewer(qt.QWidget):
return
# set the map view
spectra_volume
=
self
.
_xasObj
.
spectra
.
map_to
(
spectra
=
self
.
_xasObj
.
spectra
,
key
=
self
.
getActiveKey
(),
)
self
.
_mainWindow
.
setStack
(
spectra_volume
)
...
...
@@ -463,9 +462,7 @@ def _plot_norm(obj, **kwargs):
if
isinstance
(
obj
,
XASObject
):
assert
"index"
in
kwargs
index_dim1
=
kwargs
[
"index"
]
spectra
=
XASObject
.
_spectra_volume
(
obj
.
spectra
,
"normalized_mu"
,
obj
.
dim1
,
obj
.
dim2
,
relative_to
=
"energy"
)
spectra
=
obj
.
spectra
.
map_to
(
"normalized_mu"
,
relative_to
=
"energy"
)
spectra
=
spectra
[:,
index_dim1
,
:]
mean
=
numpy
.
mean
(
spectra
,
axis
=
1
)
std
=
numpy
.
std
(
spectra
,
axis
=
1
)
...
...
@@ -557,9 +554,7 @@ def _plot_raw(obj, **kwargs):
elif
isinstance
(
obj
,
XASObject
):
assert
"index"
in
kwargs
index_dim1
=
kwargs
[
"index"
]
spectra
=
XASObject
.
_spectra_volume
(
obj
.
spectra
,
"normalized_mu"
,
obj
.
dim1
,
obj
.
dim2
,
relative_to
=
"energy"
)
spectra
=
obj
.
spectra
.
map_to
(
"normalized_mu"
,
relative_to
=
"energy"
)
spectra
=
spectra
[:,
index_dim1
,
:]
mean
=
numpy
.
mean
(
spectra
,
axis
=
1
)
std
=
numpy
.
std
(
spectra
,
axis
=
1
)
...
...
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