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
3326acdd
Commit
3326acdd
authored
Dec 01, 2020
by
myron
Browse files
restructured the reference resynthesis
parent
3a7e1658
Changes
3
Hide whitespace changes
Inline
Side-by-side
XRStools/XRS_swissknife.py
View file @
3326acdd
...
...
@@ -3923,17 +3923,35 @@ def superR_recreate_rois(mydata):
## simple statistical criteria which is har coded in file reponse_percussionelle.py
## routine get_spots_list
filter_rois : 1
# not necessary of old_scan_address contains also the ROI
original_roi_path : None
"""
foil_scan_address
=
mydata
[
"old_scan_address"
]
foil_filename
,
foil_groupname
=
split_hdf5_address
(
foil_scan_address
)
roisgroupname
=
foil_groupname
tmp_groupname
=
foil_groupname
newscanstarget
=
""
for
i
in
range
(
2
):
pos
=
roisgroupname
.
rfind
(
"/"
)
newscanstarget
=
roisgroupname
[
pos
:]
+
newscanstarget
roisgroupname
=
roisgroupname
[:
pos
]
pos
=
tmp_groupname
.
rfind
(
"/"
)
newscanstarget
=
tmp_groupname
[
pos
:]
+
newscanstarget
tmp_groupname
=
tmp_groupname
[:
pos
]
if
"original_roi_path"
not
in
mydata
or
mydata
[
"original_roi_path"
]
in
[
"None"
,
None
]:
roisgroupname
=
tmp_groupname
roi_filename
=
foil_filename
else
:
roi_filename
,
roisgroupname
=
split_hdf5_address
(
mydata
[
"original_roi_path"
])
responsefilename
=
mydata
[
"responsefilename"
]
responsefilename
,
responsepath
=
split_hdf5_address
(
responsefilename
)
...
...
@@ -3957,16 +3975,6 @@ def superR_recreate_rois(mydata):
print
(
"LANCIO "
)
dic
=
{
"filename"
:
foil_filename
,
"groupname"
:
foil_groupname
,
"roisgroupname"
:
roisgroupname
,
"target_filename"
:
target_filename
,
"roisgroupname_target"
:
roisgroupname_target
,
"newscanstarget"
:
newscanstarget
,
"responsefilename"
:
responsefilename
,
"responsepath"
:
responsepath
,
"nex"
:
nex
,
"filter_rois"
:
filter_rois
}
print
(
dic
)
if
"recenterings_refined"
in
mydata
:
recenterings_refined
=
mydata
[
"recenterings_refined"
]
...
...
@@ -3994,9 +4002,10 @@ def superR_recreate_rois(mydata):
filterMask
=
h5f
[
dataname
][:]
reponse_percussionelle
.
DOROIS
(
filename
=
foil_filename
,
groupname
=
foil_groupname
,
reponse_percussionelle
.
DOROIS
(
filename
=
foil_filename
,
groupname
=
foil_groupname
,
roi_filename
=
roi_filename
,
roisgroupname
=
roisgroupname
,
target_filename
=
target_filename
,
roisgroupname_target
=
roisgroupname_target
,
...
...
XRStools/reponse_percussionelle.py
View file @
3326acdd
...
...
@@ -1211,6 +1211,7 @@ def reload_trajectories(trajectory_file, nomi_rois) : ### , trajectory_file_grou
def
DOROIS
(
filename
=
"../nonregressions/demo_imaging.hdf5"
,
groupname
=
"ROI_B/foil_scanXX/scans/Scan273/"
,
roi_filename
=
None
,
roisgroupname
=
"ROI_B/"
,
target_filename
=
"newscan.h5"
,
roisgroupname_target
=
"ROI_B_FIT8/"
,
...
...
@@ -1221,7 +1222,10 @@ def DOROIS(filename = "../nonregressions/demo_imaging.hdf5" , groupname = "ROI_B
filter_rois
=
1
,
recenterings
=
None
,
filterMask
=
None
):
if
roi_filename
is
None
:
roi_filename
=
filename
O_spots_list
,
nomi_rois
,
stats
,
origini
,
rois
,
xscales
,
energy
=
get_spots_list
(
filename
,
groupname
,
filter_rois
=
filter_rois
)
trajectory_list
=
[]
...
...
@@ -1305,10 +1309,10 @@ def DOROIS(filename = "../nonregressions/demo_imaging.hdf5" , groupname = "ROI_B
# print( filename)
# print( roisgroupname+ "/rois_definition/image")
h5f
=
h5py
.
File
(
filename
,
"r"
)
h5f
=
h5py
.
File
(
roi_
filename
,
"r"
)
# imagealldect = h5f [roisgroupname+ "/rois_definition/image"][:]
print
(
filename
)
print
(
roi_
filename
)
print
(
roisgroupname
+
"/image"
)
imagealldect
=
h5f
[
roisgroupname
+
"/image"
][:]
...
...
nonregressions/volumes/interpola_1/batch_extraction_esynth1.py
View file @
3326acdd
...
...
@@ -58,10 +58,10 @@ def main():
"do_step_make_roi"
:
False
,
"do_step_sample_extraction"
:
False
,
"do_step_interpolation"
:
False
,
"do_extract_reference_scan"
:
False
,
"do_
step_
extract_reference_scan"
:
False
,
"do_fit_reference_response"
:
False
,
"do_resynthetise_reference"
:
Fals
e
,
"do_
step_
fit_reference_response"
:
False
,
"do_
step_
resynthetise_reference"
:
Tru
e
,
"do_step_finalise_for_fit"
:
False
}
...
...
@@ -78,7 +78,7 @@ def main():
response_target_file
=
"results/response.h5"
resynthetised_reference_and_roi_target_file
=
"results/resyntetised_roi_and_scan.h5"
tools_sequencer
(
peaks_shifts
=
peaks_shifts
,
datadir
=
datadir
,
...
...
@@ -102,8 +102,9 @@ def main():
extracted_reference_target_file
=
extracted_reference_target_file
,
isolate_spot_by
=
isolate_spot_by
,
response_target_file
=
response_target_file
,
response_fit_options
=
response_fit_options
response_fit_options
=
response_fit_options
,
resynthetised_reference_and_roi_target_file
=
resynthetised_reference_and_roi_target_file
)
...
...
@@ -389,7 +390,40 @@ def synthetise_response(scan_address=None, target_address=None, resp
niter_global
=
response_fit_options
[
"niter_global"
]
)
process_input
(
s
,
exploit_slurm_mpi
=
1
,
stop_omp
=
True
)
def
resynthetise_scan
(
old_scan_address
=
None
,
response_file
=
None
,
target_address
=
None
,
original_roi_path
=
None
):
inputstring
=
"""
superR_recreate_rois :
### we have calculated the responses in responsefilename
### and we want to enlarge the scan by a margin of 3 times
### the original scan on the right and on the left
### ( so for a total of a 7 expansion factor )
responsefilename : {response_file}
nex : 0
## the old scan covered by the old rois
old_scan_address : {old_scan_address}
## where new rois and bnew scan are written
target_filename : {target_address}
filter_rois : 0
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"
)
process_input
(
s
,
exploit_slurm_mpi
=
0
,
stop_omp
=
True
)
def
tools_sequencer
(
peaks_shifts
=
None
,
datadir
=
None
,
filter_path
=
None
,
...
...
@@ -418,8 +452,8 @@ def tools_sequencer( peaks_shifts = None,
reference_scan_list
=
None
,
extracted_reference_target_file
=
None
,
response_target_file
=
None
,
response_fit_options
=
None
response_fit_options
=
None
,
resynthetised_reference_and_roi_target_file
=
None
)
:
if
roi_path
is
None
:
...
...
@@ -452,7 +486,7 @@ def tools_sequencer( peaks_shifts = None,
interpolate
(
peaks_shifts
,
signals_file
,
interpolated_signals_target_file
)
if
(
steps_to_do
[
"do_extract_reference_scan"
]):
# of course we need the REFERENCE SCAN
if
(
steps_to_do
[
"do_
step_
extract_reference_scan"
]):
# of course we need the REFERENCE SCAN
get_reference
(
datadir
=
datadir
,
roi_path
=
roi_path
,
...
...
@@ -494,7 +528,7 @@ def tools_sequencer( peaks_shifts = None,
ftarget
.
close
()
if
(
steps_to_do
[
"do_fit_reference_response"
]):
# of course we need the REFERENCE SCAN
if
(
steps_to_do
[
"do_
step_
fit_reference_response"
]):
synthetise_response
(
scan_address
=
extracted_reference_target_file
+
":references/scans/ScansSum"
,
target_address
=
response_target_file
+
":/FIT"
,
...
...
@@ -502,8 +536,13 @@ def tools_sequencer( peaks_shifts = None,
)
if
(
steps_to_do
[
"do_step_resynthetise_reference"
]):
resynthetise_scan
(
old_scan_address
=
extracted_reference_target_file
+
":references/scans/ScansSum"
,
response_file
=
response_target_file
+
":/FIT"
,
target_address
=
resynthetised_reference_and_roi_target_file
+
":/rois_and_reference"
,
original_roi_path
=
roi_path
)
...
...
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