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
fe3b9255
Commit
fe3b9255
authored
1 year ago
by
Loïc Le Guyader
Browse files
Options
Downloads
Patches
Plain Diff
Adds default argument for curvature fit
parent
60c5e70c
No related branches found
No related tags found
1 merge request
!280
WIP: First RIXS with JUNGFRAU detector implementation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/toolbox_scs/detectors/jf_hrixs.py
+23
-11
23 additions, 11 deletions
src/toolbox_scs/detectors/jf_hrixs.py
with
23 additions
and
11 deletions
src/toolbox_scs/detectors/jf_hrixs.py
+
23
−
11
View file @
fe3b9255
...
@@ -128,7 +128,7 @@ class JF_hRIXS:
...
@@ -128,7 +128,7 @@ class JF_hRIXS:
data
=
data
.
isel
(
trainId
=
slice
(
1
,
None
))
data
=
data
.
isel
(
trainId
=
slice
(
1
,
None
))
return
data
return
data
def
find_curvature
(
self
,
img
,
args
,
plot
=
False
,
**
kwargs
):
def
find_curvature
(
self
,
img
,
args
=
None
,
plot
=
False
,
**
kwargs
):
"""
Find the curvature correction coefficients.
"""
Find the curvature correction coefficients.
The hRIXS has some abberations which leads to the spectroscopic lines
The hRIXS has some abberations which leads to the spectroscopic lines
...
@@ -155,23 +155,35 @@ class JF_hRIXS:
...
@@ -155,23 +155,35 @@ class JF_hRIXS:
def
parabola
(
x
,
a
,
b
,
c
,
s
=
0
,
h
=
0
,
o
=
0
):
def
parabola
(
x
,
a
,
b
,
c
,
s
=
0
,
h
=
0
,
o
=
0
):
return
(
a
*
x
+
b
)
*
x
+
c
return
(
a
*
x
+
b
)
*
x
+
c
def
gauss
(
y
,
x
,
a
,
b
,
c
,
s
,
h
,
o
=
0
):
def
gauss
(
x
,
y
,
a
,
b
,
c
,
s
,
h
,
o
=
0
):
return
h
*
np
.
exp
(
-
((
y
-
parabola
(
x
,
a
,
b
,
c
))
/
(
2
*
s
))
**
2
)
+
o
return
h
*
np
.
exp
(
-
((
y
-
parabola
(
x
,
a
,
b
,
c
))
/
(
2
*
s
))
**
2
)
+
o
x
=
np
.
arange
(
img
.
shape
[
1
])[
None
,
:]
xx
,
yy
=
np
.
meshgrid
(
img
[
'
x
'
],
img
[
'
y
'
])
y
=
np
.
arange
(
img
.
shape
[
0
])[:,
None
]
if
plot
:
if
args
is
None
:
plt
.
figure
(
figsize
=
(
10
,
10
))
spec
=
img
.
mean
(
'
x
'
).
values
plt
.
imshow
(
img
,
cmap
=
'
gray
'
,
aspect
=
'
auto
'
,
x0
=
spec
.
argmax
()
interpolation
=
'
nearest
'
,
**
kwargs
)
b
=
0.25
plt
.
plot
(
x
[
0
,
:],
parabola
(
x
[
0
,
:],
*
args
))
args
=
(
0.0
,
b
,
(
x0
-
b
*
img
.
sizes
[
'
x
'
]
/
2
),
3
,
spec
.
max
(),
0
)
print
(
args
)
args
,
_
=
leastsq
(
lambda
args
:
(
gauss
(
y
,
x
,
*
args
)
-
img
).
ravel
(),
if
plot
:
plt
.
figure
()
plt
.
imshow
(
img
,
cmap
=
'
magma_r
'
,
aspect
=
1
/
9
,
interpolation
=
'
none
'
,
**
kwargs
)
plt
.
plot
(
xx
[
0
,
:],
parabola
(
xx
[
0
,
:],
*
args
),
ls
=
'
--
'
,
c
=
'
C0
'
,
alpha
=
0.5
)
args
,
_
=
leastsq
(
lambda
args
:
(
gauss
(
xx
,
yy
,
*
args
)
-
img
).
values
.
flatten
(),
args
)
args
)
if
plot
:
if
plot
:
plt
.
plot
(
x
[
0
,
:],
parabola
(
x
[
0
,
:],
*
args
))
plt
.
plot
(
xx
[
0
,
:],
parabola
(
xx
[
0
,
:],
*
args
),
ls
=
'
-
'
,
c
=
'
C0
'
)
self
.
CURVE_B
,
self
.
CURVE_A
,
*
_
=
args
return
args
return
args
def
parabola
(
self
,
x
):
def
parabola
(
self
,
x
):
...
...
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