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
55940064
Commit
55940064
authored
Dec 07, 2020
by
myron
Browse files
all non regression tests pass
parent
a79301c5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
XRStools/XES_spectra_extraction.py
View file @
55940064
...
...
@@ -104,25 +104,21 @@ def prepare(
runit
(
s
,
work_dir
,
"05_setup_recentering.yaml"
)
s
=
"""
loadscan_2Dimages :
expdata : {data_file}
roiaddress : roi.h5:/ROI_AS_SELECTED
scan_interval : [{scan_for_roi},{scan_for_roi_P1}]
monitor
_
column : {monitorcolumn}
monitorcolumn : {monitorcolumn}
recenterings : recentering.h5:/recentering
recenterings_confirmed : recentering.h5:/confirmed_shift
signaladdress : Centered_sample_scans
sumto1D : 0
energycolumn : 'Anal Energy'
monitorcolumn : izero
"""
.
format
(
data_file
=
data
,
scan_for_roi
=
scan_for_sample_roi
,
scan_for_roi_P1
=
scan_for_sample_roi
+
1
,
monitorcolumn
=
monitorcolumn
)
runit
(
s
,
work_dir
,
"06_calculate_recentering.yaml"
)
s
=
"""
superR_fit_responses:
foil_scan_address : roi.h5:/ROI_AS_SELECTED/calibration_scan/scans/Scan%03d
...
...
@@ -137,7 +133,6 @@ def prepare(
simmetrizza : 1
filter_rois : 0
target_file : fitted_response.h5:/ScanFittedResponse_%03d
MPI_N_PROCS : 1
fit_lines : 1
"""
%
(
reference_scan
,
beta_response
,
reference_scan
)
runit
(
s
,
work_dir
,
"07_fit.yaml"
)
...
...
@@ -149,7 +144,7 @@ def prepare(
nex : 0
old_scan_address : roi.h5:/ROI_AS_SELECTED/calibration_scan/scans/Scan%03d
filter_rois : 0
recenterings_refine
s
: recentering.h5:/confirmed_shift
recenterings_refine
d
: recentering.h5:/confirmed_shift
target_filename : newscan.h5:/ROI_AS_SELECTED/calibration_scan/scans/ScanReSynth_%03d
"""
%
(
reference_scan
,
reference_scan
,
reference_scan
)
runit
(
s
,
work_dir
,
"08_resynth.yaml"
)
...
...
@@ -202,7 +197,7 @@ def extract(
scan_interval : [{start}, {end}]
zmargin : 0
target : ../{result_file}:/fromscans_{start}_{end}
final_plot : PLOT
#
final_plot : PLOT
DE : 0.0
niterLip : {niterLip}
niter : {niter}
...
...
XRStools/XRS_swissknife.py
View file @
55940064
...
...
@@ -244,14 +244,14 @@ class Loader_map_as_anydict( object):
class
myOrderedDict
(
collections
.
OrderedDict
):
def
__setitem__
(
self
,
a
,
b
):
if
type
(
a
)
==
type
(
""
)
and
a
in
self
:
self
[
a
+
"_
tagkajs
"
]
=
b
self
[
a
+
"_
TAG_this_key_is_given_twice
"
]
=
b
else
:
## print super(myOrderedDict, self)
super
(
myOrderedDict
,
self
).
__setitem__
(
a
,
b
)
def
cleaned
(
key
):
while
key
[
-
8
:]
==
"_
tagkajs
"
:
while
key
[
-
2
8
:]
==
"_
TAG_this_key_is_given_twice
"
:
key
=
key
[:
-
8
]
return
key
...
...
@@ -1281,7 +1281,7 @@ def extract_spectra(mydata):
final_plot : "PLOT" # or "NOPLOT"
"""
allowed_keys
=
[
"target"
,
"sample_address"
,
"scan_interval"
,
"roiaddress"
,
"DE"
,
"discard_threshold"
,
"threshold_fraction"
,
"zmargin"
,
"flatTriggerer"
,
"slope"
,
"fitted_response"
,
"niter"
,
"niterLip"
,
"beta"
,
"weight_by_response"
,
"reference_scan"
,
]
allowed_keys
=
[
"target"
,
"sample_address"
,
"scan_interval"
,
"roiaddress"
,
"DE"
,
"discard_threshold"
,
"threshold_fraction"
,
"zmargin"
,
"flatTriggerer"
,
"slope"
,
"fitted_response"
,
"niter"
,
"niterLip"
,
"beta"
,
"weight_by_response"
,
"reference_scan"
,
"reference_address"
]
check_allowed_keys
(
mydata
,
allowed_keys
)
target_filename
,
target_groupname
=
split_hdf5_address
(
mydata
[
"target"
])
...
...
@@ -1390,7 +1390,7 @@ def extract_spectra(mydata):
rois_keys
=
list
(
set
.
intersection
(
set
(
rois_keys
),
set
(
rois_keys_orig
)
)
)
print
f
(
" After filtering the list of rois to be used is "
,
rois_keys
)
print
(
" After filtering the list of rois to be used is "
,
rois_keys
)
incidentE
=
None
if
"motorDict/energy"
in
h5
:
...
...
@@ -3975,7 +3975,10 @@ def superR_recreate_rois(mydata):
h5f
=
h5py
.
File
(
recenterings_filename
,
"r"
)
h5
=
h5f
[
recenterings_groupname
]
recenterings
=
{}
chiavi
=
filterRoiList
(
h5
.
keys
())
chiavi
=
filterRoiList
(
h5
.
keys
(),
prefix
=
""
)
for
c
in
chiavi
:
recenterings
[
int
(
c
)]
=
h5
[
c
][:]
assert
(
recenterings
[
int
(
c
)].
shape
==
(
2
,))
...
...
nonregressions/xes/results/spectra_ref.txt
View file @
55940064
This diff is collapsed.
Click to expand it.
nonregressions/xes/xes_analysis.py
View file @
55940064
...
...
@@ -9,8 +9,8 @@ if(1):
os
.
system
(
"xz -d --keep preparation_run4_16/ROI.xz ; mv preparation_run4_16/ROI preparation_run4_16/roi.h5"
)
os
.
system
(
"xz -d --keep preparation_run4_16/roi_sample.h5.xz"
)
spectra_extraction
.
prepare
(
if
1
:
spectra_extraction
.
prepare
(
work_dir
=
"preparation_run4_16"
,
data
=
"/data/id20/inhouse/data/run4_16/run6_ihr/rixs"
,
scan_for_roi
=
66
,
...
...
@@ -27,7 +27,7 @@ if(1):
do_recentering
=
True
,
beta_response
=
1.0
)
)
spectra_extraction
.
extract
(
work_dir
=
"preparation_run4_16"
,
...
...
@@ -51,5 +51,5 @@ ref = np.loadtxt( "results/spectra_ref.txt")
assert
(
abs
(
ref
-
results
).
max
(
)
<
1.0e-7
)
if
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
if
"CLEAN_RESULTS"
in
os
.
environ
and
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
os
.
system
(
"rm results/*"
)
nonregressions/xrs_raman/non_reg_testing_XRS.py
View file @
55940064
...
...
@@ -280,5 +280,5 @@ lw_ex.save_average_Sqw(save_path+'/h2o_pixel_hq.dat', emin=0.0, emax=600.0, norm
check_results
(
os
.
path
.
join
(
save_path
,
'h2o_pixel_hq.dat'
)
,
os
.
path
.
join
(
save_path
,
"h2o_pixel_hq_ref.dat"
)
)
if
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
if
"CLEAN_RESULTS"
in
os
.
environ
and
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
os
.
system
(
"rm %s/*"
%
save_path
)
nonregressions/xrs_raman/non_reg_testing_XRS_raman_extraction.py
View file @
55940064
...
...
@@ -387,5 +387,5 @@ check_results(tosavepath("non_reg_output_gui_raman_mediumq.txt"),tosavepath("non
check_results
(
tosavepath
(
"non_reg_output_gui_raman_highq.txt"
),
tosavepath
(
"non_reg_output_gui_raman_reference_highq.txt"
))
print
(
" OK "
)
if
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
if
"CLEAN_RESULTS"
in
os
.
environ
and
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
os
.
system
(
"rm %s/*"
%
save_path
)
nonregressions/xrs_raman/non_reg_testing_XRS_small.py
View file @
55940064
...
...
@@ -282,5 +282,5 @@ lw_ex.save_average_Sqw(save_path+'/h2o_pixel_hq_small.dat', emin=0.0, emax=600.0
check_results
(
os
.
path
.
join
(
save_path
,
'h2o_pixel_hq_small.dat'
)
,
os
.
path
.
join
(
save_path
,
"h2o_pixel_hq_small.dat.ref"
)
)
if
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
if
"CLEAN_RESULTS"
in
os
.
environ
and
os
.
environ
[
"CLEAN_RESULTS"
]
==
"true"
:
os
.
system
(
"rm %s/*"
%
save_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