Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
JupyLabBook
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SIRIUS Beamline
Notebooks
JupyLabBook
Commits
d0f7ad62
Commit
d0f7ad62
authored
8 months ago
by
Arnaud HEMMERLE
Browse files
Options
Downloads
Patches
Plain Diff
Add the possibility to print the mean values of selected sensors in GIXS
parent
cf2ed1e3
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+3
-0
3 additions, 0 deletions
CHANGELOG.md
lib/backend/gixs.py
+25
-4
25 additions, 4 deletions
lib/backend/gixs.py
lib/frontend/process_widgets/wgixs.py
+12
-2
12 additions, 2 deletions
lib/frontend/process_widgets/wgixs.py
lib/jupylabbook.py
+1
-1
1 addition, 1 deletion
lib/jupylabbook.py
with
41 additions
and
7 deletions
CHANGELOG.md
+
3
−
0
View file @
d0f7ad62
# Release notes
## v3.2.3
-
Add the possibility to print the mean values of selected sensors in GIXS, GIXD, area_detector, XRF.
## v3.2.2
-
Flyscan update: add the possibility to read nexus files generated by the flyscan. Works for plot 1D, plot images, and plot GIXD.
...
...
This diff is collapsed.
Click to expand it.
lib/backend/gixs.py
+
25
−
4
View file @
d0f7ad62
...
...
@@ -22,6 +22,7 @@ def process_gixs_scan(
pixel_poni_x
,
pixel_poni_y
,
pixel_size
,
is_force_gamma
=
False
,
is_force_delta
=
False
,
is_force_thetai
=
False
,
fgamma
=
0.
,
fdelta
=
0.
,
fthetai
=
0.
,
roi_2d
=
[
-
1
,
-
1
,
-
1
,
-
1
],
clim
=
(
-
1
,
-
1
),
selected_sensors
=
None
,
absorbers
=
''
,
is_gixs_logz
=
True
,
map_gixs
=
'
viridis
'
,
path_to_save_dir
=
''
,
is_print_stamps
=
False
,
is_plot
=
False
,
is_save_sum
=
False
,
is_save_each
=
False
,
is_print_info
=
False
):
...
...
@@ -99,13 +100,15 @@ def process_gixs_scan(
"""
images
,
images_sum
,
qxy_grid
,
qz_grid
,
integ_qxy
,
integ_qz
,
\
qxy_list
,
qz_list
,
gamma_str
,
delta_str
,
thetai_str
,
time_str
,
stamps_0d
,
data_0d
=
\
qxy_list
,
qz_list
,
gamma_str
,
delta_str
,
thetai_str
,
time_str
,
sensors_str
,
\
stamps_0d
,
data_0d
=
\
extract_gixs_scan
(
nxs_name
,
path_to_nxs_dir
,
wavelength
,
distance_detec
,
pixel_poni_x
,
pixel_poni_y
,
pixel_size
,
is_force_gamma
,
is_force_delta
,
is_force_thetai
,
fgamma
,
fdelta
,
fthetai
,
selected_sensors
,
is_print_stamps
,
is_print_info
)
...
...
@@ -121,7 +124,8 @@ def process_gixs_scan(
fig
=
plot_gixs_scan
(
images_sum
,
roi_2d
,
clim
,
qxy_grid
,
qz_grid
,
qxy_list
,
qz_list
,
nxs_name
,
absorbers
,
is_gixs_logz
,
map_gixs
,
gamma_str
,
delta_str
,
thetai_str
,
time_str
gamma_str
,
delta_str
,
thetai_str
,
time_str
,
sensors_str
)
if
is_save_each
:
...
...
@@ -152,6 +156,7 @@ def extract_gixs_scan(
pixel_poni_x
,
pixel_poni_y
,
pixel_size
,
is_force_gamma
,
is_force_delta
,
is_force_thetai
,
fgamma
,
fdelta
,
fthetai
,
selected_sensors
,
is_print_stamps
,
is_print_info
):
"""
Extract the nexus file and return useful quantities for GIXS.
...
...
@@ -286,6 +291,7 @@ def extract_gixs_scan(
column_gamma
=
i
if
stamp_0d
[
1
].
lower
()
==
'
alphax
'
:
column_thetai
=
i
else
:
if
stamp_0d
[
0
].
lower
()
==
'
sensorstimestamps
'
:
column_epoch
=
i
...
...
@@ -342,10 +348,22 @@ def extract_gixs_scan(
else
:
thetai_str
=
'
thetai (alphax) not found, forced to the value: thetai = %3.4g deg
'
%
(
thetai
)
# Extract the value of the sensors in the list selected_sensors
sensors_str
=
''
if
selected_sensors
is
not
None
:
for
sensor
in
selected_sensors
:
for
i
,
stamp_0d
in
enumerate
(
stamps_0d
):
if
stamp_0d
[
1
]
is
not
None
:
if
stamp_0d
[
1
].
lower
()
==
sensor
:
sensor_value
=
np
.
mean
(
data_0d
[
i
][
args
])
sensors_str
+=
f
'
{
sensor
}
=
{
sensor_value
}
\n
'
if
is_print_info
:
print
(
gamma_str
)
print
(
delta_str
)
print
(
thetai_str
)
print
(
sensors_str
)
# Extract time
time_str
=
''
...
...
@@ -435,14 +453,16 @@ def extract_gixs_scan(
qxy_list
=
None
qz_list
=
None
return
images
,
images_sum
,
qxy_grid
,
qz_grid
,
integ_qxy
,
integ_qz
,
\
qxy_list
,
qz_list
,
gamma_str
,
delta_str
,
thetai_str
,
time_str
,
\
qxy_list
,
qz_list
,
gamma_str
,
delta_str
,
thetai_str
,
time_str
,
sensors_str
,
\
stamps_0d
,
data_0d
def
plot_gixs_scan
(
images_sum
,
roi_2d
,
clim
,
qxy_grid
,
qz_grid
,
qxy_list
,
qz_list
,
nxs_name
,
absorbers
,
is_gixs_logz
,
map_gixs
,
gamma_str
,
delta_str
,
thetai_str
,
time_str
):
gamma_str
,
delta_str
,
thetai_str
,
time_str
,
sensors_str
):
"""
Plot GIXS data.
...
...
@@ -495,6 +515,7 @@ def plot_gixs_scan(
print
(
_RED
+
gamma_str
+
_RESET
)
print
(
_RED
+
delta_str
+
_RESET
)
print
(
_RED
+
thetai_str
+
_RESET
)
print
(
_RED
+
sensors_str
+
_RESET
)
# If there is a negative value in the ROI,
# take the whole detector
...
...
This diff is collapsed.
Click to expand it.
lib/frontend/process_widgets/wgixs.py
+
12
−
2
View file @
d0f7ad62
...
...
@@ -30,7 +30,8 @@ def display_widgets_gixs(expt):
'
is_print_stamps
'
,
'
is_print_info
'
,
'
is_print_abs
'
,
'
distance_detec
'
,
'
pixel_poni_x
'
,
'
pixel_poni_y
'
,
'
fgamma
'
,
'
fdelta
'
,
'
fthetai
'
,
'
pixel_size
'
,
'
wavelength
'
,
'
x_min
'
,
'
size_x
'
,
'
y_min
'
,
'
size_y
'
,
'
clim_min
'
,
'
clim_max
'
,
'
map_gixs
'
'
x_min
'
,
'
size_x
'
,
'
y_min
'
,
'
size_y
'
,
'
clim_min
'
,
'
clim_max
'
,
'
map_gixs
'
,
'
selected_sensors_str
'
]
)
...
...
@@ -64,6 +65,7 @@ def display_widgets_gixs(expt):
"
fthetai=%s,
\n
"
"
roi_2d=[%s, %s, %s, %s],
"
"
clim=(%s, %s),
\n
"
"
selected_sensors=%s,
\n
"
"
absorbers=
'
%s
'
,
"
"
is_gixs_logz=%s,
"
"
map_gixs=
'
%s
'
,
"
...
...
@@ -93,6 +95,7 @@ def display_widgets_gixs(expt):
expt
.
params
[
'
size_y
'
],
expt
.
params
[
'
clim_min
'
],
expt
.
params
[
'
clim_max
'
],
expt
.
params
[
'
selected_sensors_str
'
].
split
(
'
;
'
),
absorbers
,
expt
.
params
[
'
is_gixs_logz
'
],
expt
.
params
[
'
map_gixs
'
],
...
...
@@ -303,6 +306,13 @@ def display_widgets_gixs(expt):
rows
=
5
,
description
=
'
Map
'
)
# Selected sensors to plot
dw
[
'
selected_sensors_str
'
]
=
iwid
.
Text
(
value
=
expt
.
get_default_param_value
(
'
selected_sensors_str
'
,
alt
=
''
),
style
=
style
,
layout
=
iwid
.
Layout
(
width
=
'
800px
'
),
description
=
'
Sensors to add (sep. with
\"
;
\"
)
'
)
# Proceed
button
=
iwid
.
Button
(
description
=
'
Insert plot
'
,
style
=
{
"
button_color
"
:
"
lightgreen
"
})
...
...
@@ -331,7 +341,7 @@ def display_widgets_gixs(expt):
])
lvl_4
=
iwid
.
HBox
([
dw
[
'
clim_min
'
],
dw
[
'
clim_max
'
]
dw
[
'
clim_min
'
],
dw
[
'
clim_max
'
]
,
dw
[
'
selected_sensors_str
'
]
])
...
...
This diff is collapsed.
Click to expand it.
lib/jupylabbook.py
+
1
−
1
View file @
d0f7ad62
...
...
@@ -22,7 +22,7 @@ except ModuleNotFoundError:
# Rules for numbering versions
# vX.Y.Z with X major, Y minor, Z patch. Each new version increments Z (not used if Z=0).
# If the file Example.ipynb cannot run with the new libraries, increment Y and restart at Z=0.
__version__
=
'
v3.2.
2
'
__version__
=
'
v3.2.
3
'
# Define the object experiment
# It contains all the attributes relevant to the current experiment
...
...
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