Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
ToolBox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
SCS
ToolBox
Commits
1900b961
Commit
1900b961
authored
4 weeks ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
Add key argument to viking removePolyBaseline()
parent
b47f51d6
No related branches found
No related tags found
1 merge request
!326
Up8062
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/toolbox_scs/detectors/viking.py
+5
-4
5 additions, 4 deletions
src/toolbox_scs/detectors/viking.py
with
5 additions
and
4 deletions
src/toolbox_scs/detectors/viking.py
+
5
−
4
View file @
1900b961
...
...
@@ -270,7 +270,7 @@ class Viking:
ret
[
'
photoelectrons_per_count
'
]
=
self
.
e_per_counts
(
run
,
ret
[
'
gain
'
])
return
ret
def
removePolyBaseline
(
self
,
data
):
def
removePolyBaseline
(
self
,
data
,
key
=
'
spectrum
'
):
"""
Removes a polynomial baseline to a spectrum, assuming a fixed
position for the signal.
...
...
@@ -279,6 +279,7 @@ class Viking:
----------
data: xarray Dataset
The Viking data containing the variable
"
spectrum
"
or given by argument key
Output
------
...
...
@@ -287,10 +288,10 @@ class Viking:
containing the baseline subtracted spectra.
"""
if
'
spectrum
'
not
in
data
:
if
key
not
in
data
:
return
x
=
data
.
newt_x
spectra
=
data
[
'
spectrum
'
]
spectra
=
data
[
key
]
mask
=
xr
.
ones_like
(
x
,
dtype
=
bool
)
if
len
(
self
.
BL_SIGNAL_RANGE
)
>
0
:
if
not
hasattr
(
self
.
BL_SIGNAL_RANGE
[
0
],
'
__len__
'
):
...
...
@@ -307,7 +308,7 @@ class Viking:
final_bl
=
np
.
empty
(
spectra
.
shape
)
for
t
in
range
(
spectra
.
shape
[
0
]):
final_bl
[
t
]
=
np
.
polyval
(
fit
[:,
t
],
x
)
data
[
'
spectrum
_nobl
'
]
=
spectra
-
final_bl
data
[
key
+
'
_nobl
'
]
=
spectra
-
final_bl
return
data
def
xas
(
self
,
data
,
data_ref
,
thickness
=
1
,
plot
=
False
,
...
...
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