Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
est
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
workflow
ewoksapps
est
Commits
0819a3ae
Commit
0819a3ae
authored
1 month ago
by
Wout De Nolf
Browse files
Options
Downloads
Patches
Plain Diff
read_concatenated_xas: handle NaNs with masked arrays
parent
9671524f
No related branches found
No related tags found
1 merge request
!172
Multi xas with nans2
Pipeline
#222230
passed
1 month ago
Stage: test
Stage: style
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/est/io/concatenated.py
+6
-2
6 additions, 2 deletions
src/est/io/concatenated.py
with
6 additions
and
2 deletions
src/est/io/concatenated.py
+
6
−
2
View file @
0819a3ae
...
...
@@ -4,6 +4,7 @@ from typing import Tuple, Dict, Any
import
pint
import
numpy
import
numpy.ma
from
est
import
settings
from
est.io.information
import
InputInformation
...
...
@@ -40,7 +41,7 @@ def read_concatenated_xas(
if
information
.
skip_concatenated_n_spectra
:
ramp_slices
=
ramp_slices
[
information
.
skip_concatenated_n_spectra
:]
interpolated_spectra
=
numpy
.
zeros
(
interpolated_spectra
=
numpy
.
ma
.
masked_all
(
(
len
(
energy
),
len
(
ramp_slices
),
1
),
dtype
=
raw_spectra
.
dtype
)
for
i
,
ramp_slice
in
enumerate
(
ramp_slices
):
...
...
@@ -49,12 +50,15 @@ def read_concatenated_xas(
if
information
.
skip_concatenated_n_points
:
raw_spectrum_i
[:
information
.
skip_concatenated_n_points
]
=
numpy
.
nan
raw_spectrum_i
[
-
information
.
skip_concatenated_n_points
:]
=
numpy
.
nan
interpolated_spectra
[:,
i
,
0
]
=
numpy
.
interp
(
spectrum_i
=
numpy
.
interp
(
energy
,
raw_energy_i
,
raw_spectrum_i
,
left
=
numpy
.
nan
,
right
=
numpy
.
nan
,
)
interpolated_spectra
[:,
i
,
0
]
=
numpy
.
ma
.
masked_array
(
spectrum_i
,
mask
=~
numpy
.
isfinite
(
spectrum_i
)
)
return
interpolated_spectra
,
energy
*
information
.
energy_unit
,
config
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment