Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ixstools
xrstools
Commits
912f122a
Commit
912f122a
authored
Dec 02, 2020
by
myron
Browse files
restructuring the esynth reconstruction
parent
07373fc5
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
nonregressions/volumes/
interpola_1
/batch_extraction_esynth1.py
→
nonregressions/volumes/
esrf_scans/esynth
/batch_extraction_esynth1.py
View file @
912f122a
...
...
@@ -6,13 +6,13 @@ import os
import
h5py
import
math
BATCH_PARALLELISM
=
4
BATCH_PARALLELISM
=
1
import
os
def
main
():
os
.
system
(
"xz -dk mask.h5.xz"
)
os
.
system
(
"xz -dk mask.h5.xz
--stdout > mask.h5
"
)
filter_path
=
"mask.h5:/FILTER_MASK/filter"
...
...
@@ -27,7 +27,7 @@ def main():
Zdim
=
10
Edim
=
7
peaks_shifts
=
h5py
.
File
(
"peaks_positions_for_analysers.h5"
,
"r"
)[
"peaks_positions"
][()]
peaks_shifts
=
h5py
.
File
(
"
../
peaks_positions_for_analysers.h5"
,
"r"
)[
"peaks_positions"
][()]
assert
(
len
(
peaks_shifts
)
==
72
)
Enominal
=
np
.
median
(
peaks_shifts
)
...
...
@@ -54,29 +54,25 @@ def main():
[
"niter_global"
,
3
]
])
selected_rois
=
list
(
range
(
0
,
24
))
+
list
(
range
(
36
,
60
)
)
scal_prod_use_optional_solution
=
True
volume_retrieval_beta
=
6.0e-20
volume_retrieval_niter
=
100
scalar_products_
and_volume_
target_file
=
"results/scalar_products
_and_volume
.h5"
scalar_products_target_file
=
"results/scalar_products.h5"
steps_to_do
=
{
"do_step_make_roi"
:
False
,
"do_step_sample_extraction"
:
False
,
"do_step_interpolation"
:
False
,
"do_step_extract_reference_scan"
:
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_interpolation_coefficients"
:
False
,
"do_step_finalise_for_fit"
:
False
}
...
...
@@ -123,8 +119,7 @@ def main():
selected_rois
=
selected_rois
,
scal_prod_use_optional_solution
=
scal_prod_use_optional_solution
,
scalar_products_and_volume_target_file
=
scalar_products_and_volume_target_file
,
scalar_products_target_file
=
scalar_products_target_file
,
volume_retrieval_beta
=
volume_retrieval_beta
,
volume_retrieval_niter
=
volume_retrieval_niter
...
...
@@ -219,27 +214,27 @@ def extract_sample_givenrois(
monitor_column
=
None
,
signals_target_file
=
None
,
):
for
start
in
range
(
Start
,
End
,
Thickness
):
for
iE
,
start
in
enumerate
(
range
(
Start
,
End
,
Thickness
)
)
:
end
=
start
+
Thickness
signal_path
=
signals_target_file
+
":/
_{start}_{end}"
.
format
(
start
=
start
,
end
=
end
)
signal_path
=
signals_target_file
+
":/
E{iE}"
.
format
(
iE
=
iE
)
input_string
=
"""
loadscan_2Dimages :
expdata : {expdata}
roiaddress : {roi_path}
scan_interval : [{start}, {end}]
energy
_
column : sty
energycolumn : sty
signaladdress : {signal_path}
monitor
_
column : {monitor_column}
monitorcolumn : {monitor_column}
sumto1D : 0
"""
.
format
(
expdata
=
os
.
path
.
join
(
datadir
,
"hydra"
),
roi_path
=
roi_path
,
start
=
start
,
end
=
end
,
monitor_column
=
monitor_column
,
monitor_column
=
monitor_column
,
signal_path
=
signal_path
)
process_input
(
input_string
,
exploit_slurm_mpi
=
1
)
...
...
@@ -449,57 +444,27 @@ def resynthetise_scan(
def
get_scalars
(
Start
=
None
,
Thickness
=
None
,
reference_address
=
None
,
signals_file
=
None
,
target_file
=
None
,
use_optional_solution
=
False
,
save_factors
=
False
,
load_factors_from
=
None
,
selected_rois
=
None
,
scal_prod_use_optional_solution
=
False
,
scal_prod_load_factors
=
False
,
scal_prod_load_factors_from
=
None
,
def
get_scalars
(
iE
=
None
,
signals_file
=
None
,
reference_file
=
None
,
target_file
=
None
):
input_string
=
"""
superR_scal_deltaXimages :
sample_address : {signals_file}:/_{start}_{end}/scans
delta_address : {reference_address}
# roi_keys : [60, 64, 35, 69, 34, 24, 5, 6, 71, 70, 39, 58, 56, 33]
roi_keys : {selected_rois}
nbin : 1
target_address : {target_file}:/_{start}_{end}/scal_prods
"""
if
scal_prod_use_optional_solution
:
input_string
=
input_string
+
"""
optional_solution : {target_file}:/_{start}_{end}/volume
"""
if
True
:
input_string
=
input_string
+
"""
save_factors_on : factors_{start}_{end}.json
"""
if
scal_prod_load_factors
:
input_string
=
input_string
+
"""
load_factors_from : %s
"""
%
scal_prod_load_factors_from
input_string
=
input_string
.
format
(
start
=
Start
,
end
=
Start
+
Thickness
,
signals_file
=
signals_file
,
reference_address
=
reference_address
,
target_file
=
target_file
,
selected_rois
=
list
(
selected_rois
)
inputstring
=
"""
superR_scal_deltaXimages_Esynt :
sample_address : {signals_file}:/E{iE}/scans
delta_address : {reference_file}:/rois_and_reference/scans/ScansSum
load_factors_from :
nbin : 1
target_address : {target_file}:/{iE}/scal_prods
"""
.
format
(
iE
=
iE
,
signals_file
=
signals_file
,
reference_file
=
reference_file
,
target_file
=
target_file
,
)
process_input
(
input_string
,
exploit_slurm_mpi
=
0
)
process_input
(
inputstring
,
exploit_slurm_mpi
=
0
)
def
get_volume
(
Start
=
None
,
Thickness
=
None
,
...
...
@@ -587,8 +552,7 @@ def tools_sequencer( peaks_shifts = None,
resynthetised_reference_and_roi_target_file
=
None
,
selected_rois
=
None
,
scal_prod_use_optional_solution
=
False
,
scalar_products_and_volume_target_file
=
None
,
scalar_products_target_file
=
None
,
volume_retrieval_beta
=
None
,
volume_retrieval_niter
=
None
...
...
@@ -619,7 +583,7 @@ def tools_sequencer( peaks_shifts = None,
signals_target_file
=
signals_target_file
)
if
(
steps_to_do
[
"do_step_interpolation"
]):
if
(
steps_to_do
[
"do_step_interpolation
_coefficients
"
]):
os
.
system
(
"cp {signals_file} {interpolated_signals_target_file}"
.
format
(
signals_file
=
signals_file
,
interpolated_signals_target_file
=
interpolated_signals_target_file
)
)
interpolate
(
peaks_shifts
,
signals_file
,
interpolated_signals_target_file
)
...
...
@@ -683,18 +647,15 @@ def tools_sequencer( peaks_shifts = None,
)
if
(
steps_to_do
[
"do_step_scalars"
]):
for
start
in
range
(
first_scan_num
,
(
first_scan_num
+
Edim
*
Zdim
),
Zdim
):
get_scalars
(
Start
=
start
,
Thickness
=
Zdim
,
reference_address
=
resynthetised_reference_and_roi_target_file
+
":/rois_and_reference/scans/ScansSum"
,
signals_file
=
interpolated_signals_file
,
target_file
=
scalar_products_and_volume_target_file
,
selected_rois
=
selected_rois
,
scal_prod_use_optional_solution
=
scal_prod_use_optional_solution
,
scal_prod_load_factors
=
False
,
scal_prod_load_factors_from
=
None
if
(
steps_to_do
[
"do_step_scalars"
]):
os
.
system
(
"rm %s"
%
scalar_products_target_file
)
for
iE
in
range
(
Edim
)
:
get_scalars
(
iE
=
iE
,
signals_file
=
signals_file
,
reference_file
=
resynthetised_reference_and_roi_target_file
,
target_file
=
scalar_products_target_file
)
if
(
scal_prod_use_optional_solution
):
collect_factors
(
pattern
=
"factors_*_*.json"
,
newfile
=
"newfactors.json"
)
...
...
@@ -712,15 +673,6 @@ def tools_sequencer( peaks_shifts = None,
if
(
steps_to_do
[
"do_step_volume_retrieval"
]):
for
start
in
range
(
first_scan_num
,
(
first_scan_num
+
Edim
*
Zdim
),
Zdim
):
get_volume
(
Start
=
start
,
Thickness
=
Zdim
,
volumes_file
=
scalar_products_and_volume_target_file
,
beta
=
volume_retrieval_beta
,
niter
=
volume_retrieval_niter
,
)
main
()
...
...
nonregressions/volumes/esrf_scans/interpolation/batch_extraction_interp.py
0 → 100644
View file @
912f122a
This diff is collapsed.
Click to expand it.
nonregressions/volumes/esrf_scans/mask.h5.xz
0 → 100755
View file @
912f122a
File added
nonregressions/volumes/
interpola_1
/peaks_positions_for_analysers.h5
→
nonregressions/volumes/
esrf_scans
/peaks_positions_for_analysers.h5
View file @
912f122a
File moved
nonregressions/volumes/test2/batch_extraction_esynth1.py
View file @
912f122a
...
...
@@ -44,9 +44,9 @@ def main():
"do_step_make_roi"
:
False
,
"do_step_make_reference"
:
False
,
"do_step_sample_extraction"
:
False
,
"do_step_scalar_products"
:
Fals
e
,
"do_step_interpolation_coefficients"
:
Tru
e
,
"do_step_finalise_for_fit"
:
Tru
e
"do_step_scalar_products"
:
Tru
e
,
"do_step_interpolation_coefficients"
:
Fals
e
,
"do_step_finalise_for_fit"
:
Fals
e
}
...
...
@@ -331,8 +331,6 @@ def get_reference( roi_path = None, reference_target_file = None ):
def
get_scalars
(
iE
=
None
,
signals_file
=
None
,
reference_file
=
None
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment