@@ -20,6 +20,24 @@ class Configuration(object):
20
20
KZI_VS_KZF = 1
21
21
DELTA_KZ_VS_QZ = 3
22
22
23
+ # Global variables
24
+
25
+ wl_bandwidth = 3.2
26
+ use_constant_q = False
27
+ sample_size = 10
28
+ # Final Q rebin
29
+ do_final_rebin = True
30
+ final_rebin_step = - 0.01
31
+ # Normalize to unity when stitching
32
+ normalize_to_unity = True
33
+ total_reflectivity_q_cutoff = 0.01
34
+ # Use all cross-sections when stitching
35
+ global_stitching = False
36
+ # Use a polynomial curve fit when stitching
37
+ polynomial_stitching = False
38
+ polynomial_stitching_degree = 3
39
+ polynomial_stitching_points = 3
40
+
23
41
def __init__ (self , settings = None ):
24
42
self .instrument = Instrument ()
25
43
# Number of TOF bins
@@ -30,7 +48,6 @@ def __init__(self, settings=None):
30
48
# 1 = Constant Q bin width
31
49
# 2 = Constant 1/wavelength bin width
32
50
self .tof_bin_type = 0
33
- self .wl_bandwidth = 3.2
34
51
35
52
# Threshold under which we skip a cross-section, as fraction of the max count
36
53
self .count_threshold = 0.01
@@ -44,8 +61,6 @@ def __init__(self, settings=None):
44
61
self .set_direct_angle_offset = False
45
62
self .direct_angle_offset_overwrite = 0
46
63
self .use_dangle = False
47
- self .use_constant_q = False
48
- self .sample_size = 10
49
64
50
65
# Update the specular peak range after finding the peak
51
66
# within the ROI
@@ -75,24 +90,11 @@ def __init__(self, settings=None):
75
90
self .scaling_factor = 1.0
76
91
# Error in the scaling factor
77
92
self .scaling_error = 0.0
78
- # Normalize to unity when stitching
79
- self .normalize_to_unity = True
80
- self .total_reflectivity_q_cutoff = 0.01
81
- # Use all cross-sections when stitching
82
- self .global_stitching = False
83
- # Use a polynomial curve fit when stitching
84
- self .polynomial_stitching = False
85
- self .polynomial_stitching_degree = 3
86
- self .polynomial_stitching_points = 3
87
93
88
94
# Cut first and last N points
89
95
self .cut_first_n_points = 1
90
96
self .cut_last_n_points = 1
91
97
92
- # Final Q rebin
93
- self .do_final_rebin = True
94
- self .final_rebin_step = - 0.01
95
-
96
98
# UI elements
97
99
self .normalize_x_tof = False
98
100
self .x_wl_map = False
@@ -272,7 +274,7 @@ def _verify_true(parameter, default):
272
274
self .use_roi_bck = _verify_true ("use_roi_bck" , self .use_roi_bck )
273
275
self .use_tight_bck = _verify_true ("use_tight_bck" , self .use_tight_bck )
274
276
self .bck_offset = int (settings .value ("bck_offset" , self .bck_offset ))
275
- self .wl_bandwidth = float (settings .value ("wl_bandwidth" , self .wl_bandwidth ))
277
+ Configuration .wl_bandwidth = float (settings .value ("wl_bandwidth" , self .wl_bandwidth ))
276
278
277
279
self .force_peak_roi = _verify_true ("force_peak_roi" , self .force_peak_roi )
278
280
self .force_low_res_roi = _verify_true ("force_low_res_roi" , self .force_low_res_roi )
@@ -292,16 +294,16 @@ def _verify_true(parameter, default):
292
294
self .cut_last_n_points = int (settings .value ("cut_last_n_points" , self .cut_last_n_points ))
293
295
294
296
# Normalize to unity when stitching
295
- self .normalize_to_unity = _verify_true ("normalize_to_unity" , self .normalize_to_unity )
296
- self .total_reflectivity_q_cutoff = float (
297
+ Configuration .normalize_to_unity = _verify_true ("normalize_to_unity" , self .normalize_to_unity )
298
+ Configuration .total_reflectivity_q_cutoff = float (
297
299
settings .value ("total_reflectivity_q_cutoff" , self .total_reflectivity_q_cutoff )
298
300
)
299
- self .global_stitching = _verify_true ("global_stitching" , self .global_stitching )
300
- self .polynomial_stitching = _verify_true ("polynomial_stitching" , self .polynomial_stitching )
301
- self .polynomial_stitching_degree = int (
301
+ Configuration .global_stitching = _verify_true ("global_stitching" , self .global_stitching )
302
+ Configuration .polynomial_stitching = _verify_true ("polynomial_stitching" , self .polynomial_stitching )
303
+ Configuration .polynomial_stitching_degree = int (
302
304
settings .value ("polynomial_stitching_degree" , self .polynomial_stitching_degree )
303
305
)
304
- self .polynomial_stitching_points = int (
306
+ Configuration .polynomial_stitching_points = int (
305
307
settings .value ("polynomial_stitching_points" , self .polynomial_stitching_points )
306
308
)
307
309
@@ -311,17 +313,17 @@ def _verify_true(parameter, default):
311
313
self .log_1d = _verify_true ("log_1d" , self .log_1d )
312
314
self .log_2d = _verify_true ("log_2d" , self .log_2d )
313
315
314
- self .use_constant_q = _verify_true ("use_constant_q" , self .use_constant_q )
316
+ Configuration .use_constant_q = _verify_true ("use_constant_q" , self .use_constant_q )
315
317
self .use_dangle = _verify_true ("use_dangle" , self .use_dangle )
316
318
self .set_direct_pixel = _verify_true ("set_direct_pixel" , self .set_direct_pixel )
317
319
self .direct_pixel_overwrite = float (settings .value ("direct_pixel_overwrite" , self .direct_pixel_overwrite ))
318
320
self .set_direct_angle_offset = _verify_true ("set_direct_angle_offset" , self .set_direct_angle_offset )
319
321
self .direct_angle_offset_overwrite = float (
320
322
settings .value ("direct_angle_offset_overwrite" , self .direct_angle_offset_overwrite )
321
323
)
322
- self .sample_size = float (settings .value ("sample_size" , self .sample_size ))
323
- self .do_final_rebin = _verify_true ("do_final_rebin" , self .do_final_rebin )
324
- self .final_rebin_step = float (settings .value ("final_rebin_step" , self .final_rebin_step ))
324
+ Configuration .sample_size = float (settings .value ("sample_size" , self .sample_size ))
325
+ Configuration .do_final_rebin = _verify_true ("do_final_rebin" , self .do_final_rebin )
326
+ Configuration .final_rebin_step = float (settings .value ("final_rebin_step" , self .final_rebin_step ))
325
327
326
328
# Off-specular options
327
329
self .off_spec_x_axis = int (settings .value ("off_spec_x_axis" , self .off_spec_x_axis ))
0 commit comments