diff --git a/README.md b/README.md index 55916e1..f14229b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Reduction scripts for the Liquids Reflectometer. This includes both automated re ## Release notes: + - reduction v2.0.19 [03/2024] Add dead time correction and clean up functional background option - reduction v2.0.14 [02/2024] Add functional background - reduction v2.0.13 [08/2023] Get correct angle with free liquids - reduction v2.0.9 [04/2023] Subtract normalization background & add x-direction option diff --git a/reduction/lr_reduction/__init__.py b/reduction/lr_reduction/__init__.py index 2b6bf42..3e97ba8 100644 --- a/reduction/lr_reduction/__init__.py +++ b/reduction/lr_reduction/__init__.py @@ -1 +1 @@ -__version__ = '2.0.18' +__version__ = '2.0.19' diff --git a/reduction/lr_reduction/template.py b/reduction/lr_reduction/template.py index 2224265..9c89eb3 100644 --- a/reduction/lr_reduction/template.py +++ b/reduction/lr_reduction/template.py @@ -128,8 +128,7 @@ def _value_check(key, data, reference): def process_from_template(run_number, template_path, q_summing=False, normalize=True, - tof_weighted=False, bck_in_q=False, clean=False, info=False, - functional_background=False): + tof_weighted=False, bck_in_q=False, clean=False, info=False): """ The clean option removes leading zeros and the drop when doing q-summing """ @@ -141,14 +140,12 @@ def process_from_template(run_number, template_path, q_summing=False, normalize= ws_sc = api.Load("REF_L_%s" % run_number) return process_from_template_ws(ws_sc, template_path, q_summing=q_summing, tof_weighted=tof_weighted, bck_in_q=bck_in_q, - clean=clean, info=info, normalize=normalize, - functional_background=functional_background) + clean=clean, info=info, normalize=normalize) def process_from_template_ws(ws_sc, template_data, q_summing=False, tof_weighted=False, bck_in_q=False, clean=False, - info=False, normalize=True, theta_value=None, ws_db=None, - functional_background=False): + info=False, normalize=True, theta_value=None, ws_db=None): # Get the sequence number sequence_number = 1 if ws_sc.getRun().hasProperty("sequence_number"): @@ -225,7 +222,7 @@ def process_from_template_ws(ws_sc, template_data, q_summing=False, theta=np.abs(theta), dead_time=template_data.dead_time, paralyzable=template_data.paralyzable, - functional_background=functional_background, + functional_background=template_data.two_backgrounds, instrument=event_reduction.EventReflectivity.INSTRUMENT_4B) # R(Q) diff --git a/reduction/lr_reduction/workflow.py b/reduction/lr_reduction/workflow.py index 8249fe5..0e78150 100644 --- a/reduction/lr_reduction/workflow.py +++ b/reduction/lr_reduction/workflow.py @@ -11,8 +11,7 @@ def reduce(ws, template_file, output_dir, average_overlap=False, - q_summing=False, bck_in_q=False, is_live=False, - functional_background=False): + q_summing=False, bck_in_q=False, is_live=False): """ Function called by reduce_REFL.py, which lives in /SNS/REF_L/shared/autoreduce and is called by the automated reduction workflow. @@ -31,7 +30,6 @@ def reduce(ws, template_file, output_dir, average_overlap=False, tof_weighted=q_summing, clean=q_summing, bck_in_q=bck_in_q, - functional_background=functional_background, info=True) # Save partial results diff --git a/reduction/test/test_reduction.py b/reduction/test/test_reduction.py index 0adce2b..e44b179 100644 --- a/reduction/test/test_reduction.py +++ b/reduction/test/test_reduction.py @@ -40,7 +40,7 @@ def test_info(nexus_dir): def test_full_reduction(nexus_dir): """ - Test the fill reduction chain + Test the full reduction chain """ template_path = 'data/template.xml' qz_all = [] @@ -122,9 +122,13 @@ def test_reduce_functional_bck(nexus_dir, template_dir): for i in range(198409, 198417): with amend_config(data_dir=nexus_dir): ws = mtd_api.Load("REF_L_%s" % i) - workflow.reduce(ws, template_path, output_dir=output_dir, - average_overlap=False, - functional_background=True) + + sequence_number = ws.getRun().getProperty("sequence_number").value[0] + template_data = template.read_template(template_path, sequence_number) + template_data.two_backgrounds = True + + workflow.reduce(ws, template_data, output_dir=output_dir, + average_overlap=False) reference_path = 'data/reference_fbck.txt' if os.path.isfile(reference_path): @@ -164,9 +168,9 @@ def test_reduce_bck_option_mismatch(nexus_dir): sequence_number = ws.getRun().getProperty("sequence_number").value[0] template_data = template.read_template(template_path, sequence_number) template_data.background_roi = template_data.background_roi[:2] + template_data.two_backgrounds = True workflow.reduce(ws, template_data, output_dir=output_dir, - average_overlap=False, - functional_background=True) + average_overlap=False) reference_path = 'data/reference_rq.txt' if os.path.isfile(reference_path):