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
Thomas Kluyver
ToolBox
Commits
ba0d6d83
Commit
ba0d6d83
authored
5 years ago
by
Loïc Le Guyader
Browse files
Options
Downloads
Patches
Plain Diff
Adds line scan plots
parent
a387117a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DSSC.py
+32
-0
32 additions, 0 deletions
DSSC.py
with
32 additions
and
0 deletions
DSSC.py
+
32
−
0
View file @
ba0d6d83
...
@@ -501,6 +501,8 @@ class DSSC:
...
@@ -501,6 +501,8 @@ class DSSC:
azimuthal
[
'
delta_q (1/nm)
'
]
=
2e-9
*
np
.
pi
*
np
.
sin
(
azimuthal
[
'
delta_q (1/nm)
'
]
=
2e-9
*
np
.
pi
*
np
.
sin
(
np
.
arctan
(
azimuthal
.
distance
*
self
.
px_pitch_v
*
1e-6
/
self
.
distance
))
/
wl
np
.
arctan
(
azimuthal
.
distance
*
self
.
px_pitch_v
*
1e-6
/
self
.
distance
))
/
wl
azimuthal
.
attrs
=
self
.
binned
.
attrs
self
.
azimuthal
=
azimuthal
.
swap_dims
({
'
distance
'
:
'
delta_q (1/nm)
'
})
self
.
azimuthal
=
azimuthal
.
swap_dims
({
'
distance
'
:
'
delta_q (1/nm)
'
})
...
@@ -511,12 +513,42 @@ class DSSC:
...
@@ -511,12 +513,42 @@ class DSSC:
xr
.
plot
.
imshow
(
self
.
azimuthal
.
pumped
,
ax
=
ax1
,
robust
=
True
)
xr
.
plot
.
imshow
(
self
.
azimuthal
.
pumped
,
ax
=
ax1
,
robust
=
True
)
ax1
.
set_title
(
'
unpumped
'
)
ax1
.
set_title
(
'
unpumped
'
)
ax1
.
set_xlabel
(
self
.
scan_vname
)
xr
.
plot
.
imshow
(
self
.
azimuthal
.
pumped
-
self
.
azimuthal
.
unpumped
,
ax
=
ax2
,
robust
=
True
)
xr
.
plot
.
imshow
(
self
.
azimuthal
.
pumped
-
self
.
azimuthal
.
unpumped
,
ax
=
ax2
,
robust
=
True
)
ax2
.
set_title
(
'
pumped - unpumped
'
)
ax2
.
set_title
(
'
pumped - unpumped
'
)
ax2
.
set_xlabel
(
self
.
scan_vname
)
ax2
.
set_xlabel
(
self
.
scan_vname
)
fig
.
suptitle
(
f
'
{
self
.
plot_title
}
'
)
fig
.
suptitle
(
f
'
{
self
.
plot_title
}
'
)
def
plot_azimuthal_line_cut
(
self
,
data
,
qranges
,
qwidths
):
"""
Plot line scans on top of the data.
inputs:
data: an azimuthal integrated xarray DataArray with
'
delta_q (1/nm)
'
as one of its dimension.
qranges: a list of q-range
qwidth: a list of q-width, same length as qranges
"""
fig
,
[
ax1
,
ax2
]
=
plt
.
subplots
(
nrows
=
2
,
sharex
=
True
,
figsize
=
[
8
,
7
])
xr
.
plot
.
imshow
(
data
,
ax
=
ax1
,
robust
=
True
)
# attributes are not propagated during xarray mathematical operation https://github.com/pydata/xarray/issues/988
# so we might not have in data the scan vaiable name anymore
ax1
.
set_xlabel
(
self
.
scan_vname
)
fig
.
suptitle
(
f
'
{
self
.
plot_title
}
'
)
for
i
,
(
qr
,
qw
)
in
enumerate
(
zip
(
qranges
,
qwidths
)):
sel
=
(
data
[
'
delta_q (1/nm)
'
]
>
(
qr
-
qw
/
2
))
*
(
data
[
'
delta_q (1/nm)
'
]
<
(
qr
+
qw
/
2
))
val
=
data
.
where
(
sel
).
mean
(
'
delta_q (1/nm)
'
)
ax2
.
plot
(
data
.
scan_variable
,
val
,
c
=
f
'
C
{
i
}
'
,
label
=
f
'
q =
{
qr
:
.
2
f
}
'
)
ax1
.
axhline
(
qr
-
qw
/
2
,
c
=
f
'
C
{
i
}
'
,
lw
=
1
)
ax1
.
axhline
(
qr
+
qw
/
2
,
c
=
f
'
C
{
i
}
'
,
lw
=
1
)
ax2
.
legend
()
ax2
.
set_xlabel
(
self
.
scan_vname
)
# since 'self' is not pickable, this function has to be outside the DSSC class so that it can be used
# since 'self' is not pickable, this function has to be outside the DSSC class so that it can be used
# by the multiprocessing pool.map function
# by the multiprocessing pool.map function
def
process_one_module
(
job
):
def
process_one_module
(
job
):
...
...
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