Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ixstools
xrstools
Commits
f60b23a0
Commit
f60b23a0
authored
Dec 09, 2020
by
myron
Browse files
all non reression tests pass
parent
4c2139c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
nonregressions/volumes/esrf_scans/esynth/batch_extraction_esynth1.py
View file @
f60b23a0
...
...
@@ -11,12 +11,13 @@ from XRStools import xrs_read, xrs_rois
import
os
def
main
():
os
.
system
(
"xz -dk mask.h5.xz --stdout > mask.h5"
)
os
.
system
(
"xz -dk ../mask.h5.xz --stdout > mask.h5"
)
filter_path
=
"mask.h5:/FILTER_MASK/filter"
roi_scan_num
=
[
245
,
246
,
247
]
reference_scan_list
=
[
245
,
246
,
247
]
monitor_column
=
"izero/0.000001"
first_scan_num
=
651
...
...
@@ -56,7 +57,7 @@ def main():
"do_step_scalars"
:
False
,
"do_step_interpolation_coefficients"
:
Tru
e
,
"do_step_interpolation_coefficients"
:
Fals
e
,
"do_step_finalise_for_fit"
:
True
}
...
...
@@ -138,6 +139,8 @@ def main():
)
main
()
nonregressions/volumes/esrf_scans/interpolation/batch_extraction_interp.py
View file @
f60b23a0
...
...
@@ -5,7 +5,7 @@ import json
import
os
import
h5py
import
math
from
XRStools
import
tools_sequencer_interp
from
XRStools
import
tools_sequencer_interp
,
xrs_rois
,
xrs_read
import
os
def
main
():
os
.
system
(
"xz -dk ../mask.h5.xz --stdout > mask.h5 "
)
...
...
@@ -37,26 +37,28 @@ def main():
[
"niter_global"
,
3
]
])
resynth_z_square
=
0
resynth_z_square
=
0
.0
selected_rois
=
list
(
range
(
0
,
24
))
+
list
(
range
(
36
,
60
)
)
# selected_rois = list(range(0,24)) + list( range(36,60) )
selected_rois
=
list
(
range
(
24
,
36
))
+
list
(
range
(
60
,
72
)
)
scal_prod_use_optional_solution
=
True
scal_prod_use_optional_solution
=
False
volume_retrieval_beta
=
6.0e-
20
volume_retrieval_beta
=
6.0e-
1
volume_retrieval_niter
=
100
steps_to_do
=
{
"do_step_make_roi"
:
False
,
"do_step_sample_extraction"
:
Tru
e
,
"do_step_sample_extraction"
:
Fals
e
,
"do_step_interpolation"
:
False
,
"do_step_extract_reference_scan"
:
False
,
"do_step_fit_reference_response"
:
False
,
"do_step_resynthetise_reference"
:
False
,
"do_step_scalars"
:
True
,
"do_step_volume_retrieval"
:
False
,
"do_step_scalars"
:
False
,
"do_step_volume_retrieval"
:
True
,
"do_step_put_all_in_one_stack"
:
True
}
...
...
@@ -81,17 +83,19 @@ def main():
###### LOADING PEAKS SHIFTS
###### peaks_shifts = h5py.File("../peaks_positions_for_analysers.h5","r")["peaks_positions"][()]
###### assert( len(peaks_shifts) == 72)
roiob
=
xrs_rois
.
roi_object
()
roiob
.
loadH5
(
roi_target_path
)
elastic
=
xrs_read
.
Hydra
(
datadir
)
elastic
.
set_roiObj
(
roiob
)
elastic
.
get_compensation_factor
(
elastic_scan_for_peaks_shifts
,
method
=
'sum'
)
el_dict
=
elastic
.
cenom_dict
Enominal
=
np
.
median
(
list
(
el_dict
.
values
()
)
)
peaks_shift
=
np
.
array
([
el_dict
[
"ROI%02d"
%
i
]
if
(
"ROI%02d"
%
i
)
in
el_dict
else
nan
for
i
in
range
72
]
)
Enominal
=
np
.
median
(
peaks_shifts
)
peaks_shifts
-=
Enominal
if
steps_to_do
[
"do_step_interpolation"
]:
roiob
=
xrs_rois
.
roi_object
()
roiob
.
loadH5
(
roi_target_path
)
elastic
=
xrs_read
.
Hydra
(
datadir
)
elastic
.
set_roiObj
(
roiob
)
elastic
.
get_compensation_factor
(
elastic_scan_for_peaks_shifts
,
method
=
'sum'
)
el_dict
=
elastic
.
cenom_dict
Enominal
=
np
.
median
(
list
(
el_dict
.
values
()
)
)
peaks_shifts
=
np
.
array
([
el_dict
[
"ROI%02d"
%
i
]
if
(
"ROI%02d"
%
i
)
in
el_dict
else
nan
for
i
in
range
(
72
)
]
)
Enominal
=
np
.
median
(
peaks_shifts
)
peaks_shifts
-=
Enominal
else
:
peaks_shifts
=
None
##############################################################
##########################################################################
...
...
@@ -121,7 +125,7 @@ def main():
response_fit_options
=
response_fit_options
,
resynthetised_reference_and_roi_target_file
=
resynthetised_reference_and_roi_target_file
,
resynth_z_square
=
0
resynth_z_square
=
0
,
selected_rois
=
selected_rois
,
...
...
@@ -135,6 +139,25 @@ def main():
if
steps_to_do
[
"do_step_put_all_in_one_stack"
]
:
volumefile
=
scalar_products_and_volume_target_file
h5file_root
=
h5py
.
File
(
volumefile
,
"r+"
)
scankeys
=
list
(
h5file_root
.
keys
())
scankeys
.
sort
()
volumes
=
[]
for
k
in
scankeys
:
if
k
[:
1
]
!=
"_"
:
continue
print
(
k
)
if
"volume"
in
h5file_root
[
k
]:
volumes
.
append
(
h5file_root
[
k
][
"volume"
]
)
# volume = np.concatenate(volumes,axis=0)
volume
=
np
.
array
(
volumes
)
h5py
.
File
(
"concatenated_volume.h5"
,
"w"
)[
"volume"
]
=
volume
h5file_root
.
close
()
main
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment