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
2a4b7d42
Commit
2a4b7d42
authored
Dec 01, 2020
by
myron
Browse files
reorganised scalar products for volumes
parent
3326acdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
nonregressions/volumes/interpola_1/batch_extraction_esynth1.py
View file @
2a4b7d42
...
...
@@ -53,7 +53,17 @@ def main():
[
"niter_global"
,
3
]
])
selected_rois
=
list
(
range
(
0
,
24
))
+
list
(
range
(
36
,
60
)
)
scal_prod_use_optional_solution
=
False
scal_prod_load_factors
=
False
scal_prod_load_factors_from
=
"factors.json"
scalar_products_and_volume_target_file
=
"results/scalar_products_and_volume.h5"
steps_to_do
=
{
"do_step_make_roi"
:
False
,
"do_step_sample_extraction"
:
False
,
...
...
@@ -61,8 +71,8 @@ def main():
"do_step_extract_reference_scan"
:
False
,
"do_step_fit_reference_response"
:
False
,
"do_step_resynthetise_reference"
:
Tru
e
,
"do_step_
finalise_for_fit"
:
Fals
e
"do_step_resynthetise_reference"
:
Fals
e
,
"do_step_
scalars"
:
Tru
e
}
...
...
@@ -78,6 +88,7 @@ def main():
response_target_file
=
"results/response.h5"
############# correggi typo
resynthetised_reference_and_roi_target_file
=
"results/resyntetised_roi_and_scan.h5"
tools_sequencer
(
peaks_shifts
=
peaks_shifts
,
...
...
@@ -104,8 +115,14 @@ def main():
response_target_file
=
response_target_file
,
response_fit_options
=
response_fit_options
,
resynthetised_reference_and_roi_target_file
=
resynthetised_reference_and_roi_target_file
resynthetised_reference_and_roi_target_file
=
resynthetised_reference_and_roi_target_file
,
selected_rois
=
selected_rois
,
scal_prod_use_optional_solution
=
scal_prod_use_optional_solution
,
scal_prod_load_factors
=
scal_prod_load_factors
,
scal_prod_load_factors_from
=
scal_prod_load_factors_from
,
scalar_products_and_volume_target_file
=
scalar_products_and_volume_target_file
)
...
...
@@ -137,7 +154,7 @@ def select_rois( datadir = None, roi_scan_num=None, roi_target_path = None, fil
else
:
scans
=
list
(
roi_scan_num
)
inputstring
=
"""
input
_
string
=
"""
create_rois:
expdata : {expdata}
scans : {scans}
...
...
@@ -149,7 +166,7 @@ def select_rois( datadir = None, roi_scan_num=None, roi_target_path = None, fil
roi_target_path
=
roi_target_path
,
filter_path
=
filter_path
)
process_input
(
inputstring
,
exploit_slurm_mpi
=
0
)
process_input
(
input
_
string
,
exploit_slurm_mpi
=
0
)
def
get_reference
(
roi_path
=
None
,
...
...
@@ -161,7 +178,7 @@ def get_reference( roi_path = None,
):
signal_path
=
extracted_reference_target_file
+
":/"
inputstring
=
"""
input
_
string
=
"""
loadscan_2Dimages :
expdata : {expdata}
roiaddress : {roi_path}
...
...
@@ -174,7 +191,7 @@ def get_reference( roi_path = None,
sumto1D : 0
energycolumn : 'stx'
"""
s
=
inputstring
.
format
(
s
=
input
_
string
.
format
(
expdata
=
os
.
path
.
join
(
datadir
,
"hydra"
),
reference_scan_list
=
reference_scan_list
,
monitor_column
=
monitor_column
,
...
...
@@ -201,7 +218,7 @@ def extract_sample_givenrois(
signal_path
=
signals_target_file
+
":/_{start}_{end}"
.
format
(
start
=
start
,
end
=
end
)
inputstring
=
"""
input
_
string
=
"""
loadscan_2Dimages :
expdata : {expdata}
roiaddress : {roi_path}
...
...
@@ -218,7 +235,7 @@ def extract_sample_givenrois(
monitor_column
=
monitor_column
,
signal_path
=
signal_path
)
process_input
(
inputstring
,
exploit_slurm_mpi
=
1
)
process_input
(
input
_
string
,
exploit_slurm_mpi
=
1
)
...
...
@@ -322,7 +339,7 @@ def interpolate( peaks_shifts, interp_file_str, interp_file_target_str):
def
synthetise_response
(
scan_address
=
None
,
target_address
=
None
,
response_fit_options
=
None
):
inputstring
=
"""
input
_
string
=
"""
superR_fit_responses :
foil_scan_address : "{scan_address}"
nref : 7 # the number of subdivision per pixel dimension used to
...
...
@@ -383,7 +400,7 @@ def synthetise_response(scan_address=None, target_address=None, resp
# target_file : "fitted_responses.h5"
"""
s
=
inputstring
.
format
(
scan_address
=
scan_address
,
s
=
input
_
string
.
format
(
scan_address
=
scan_address
,
target_address
=
target_address
,
niter_optical
=
response_fit_options
[
"niter_optical"
],
beta_optical
=
response_fit_options
[
"beta_optical"
],
...
...
@@ -400,7 +417,7 @@ def resynthetise_scan(
):
inputstring
=
"""
input
_
string
=
"""
superR_recreate_rois :
### we have calculated the responses in responsefilename
### and we want to enlarge the scan by a margin of 3 times
...
...
@@ -419,10 +436,66 @@ def resynthetise_scan(
original_roi_path : {original_roi_path}
"""
s
=
inputstring
.
format
(
response_file
=
response_file
,
target_address
=
target_address
,
old_scan_address
=
old_scan_address
,
original_roi_path
=
original_roi_path
+
"/rois_definition"
)
s
=
input
_
string
.
format
(
response_file
=
response_file
,
target_address
=
target_address
,
old_scan_address
=
old_scan_address
,
original_roi_path
=
original_roi_path
+
"/rois_definition"
)
process_input
(
s
,
exploit_slurm_mpi
=
0
,
stop_omp
=
True
)
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
,
):
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
)
)
process_input
(
input_string
,
exploit_slurm_mpi
=
0
)
def
tools_sequencer
(
peaks_shifts
=
None
,
datadir
=
None
,
...
...
@@ -453,7 +526,13 @@ def tools_sequencer( peaks_shifts = None,
extracted_reference_target_file
=
None
,
response_target_file
=
None
,
response_fit_options
=
None
,
resynthetised_reference_and_roi_target_file
=
None
resynthetised_reference_and_roi_target_file
=
None
,
selected_rois
=
None
,
scal_prod_use_optional_solution
=
False
,
scal_prod_load_factors
=
False
,
scal_prod_load_factors_from
=
None
,
scalar_products_and_volume_target_file
=
None
)
:
if
roi_path
is
None
:
...
...
@@ -545,5 +624,20 @@ 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
=
False
,
scal_prod_load_factors
=
False
,
scal_prod_load_factors_from
=
None
)
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