From d7ab5be86e048e8b9794b7ddfc0775ad5aa85fea Mon Sep 17 00:00:00 2001 From: Mathieu Doucet Date: Wed, 11 Oct 2023 11:56:26 -0400 Subject: [PATCH] add wl band test --- reduction/lr_reduction/event_reduction.py | 11 +---------- reduction/test/test_reduction.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/reduction/lr_reduction/event_reduction.py b/reduction/lr_reduction/event_reduction.py index 2cc7df9..938ac65 100644 --- a/reduction/lr_reduction/event_reduction.py +++ b/reduction/lr_reduction/event_reduction.py @@ -23,6 +23,7 @@ def get_wl_range(ws): return [wl_min, wl_max] + def get_q_binning(q_min=0.001, q_max=0.15, q_step=-0.02): """ Determine Q binning @@ -35,16 +36,6 @@ def get_q_binning(q_min=0.001, q_max=0.15, q_step=-0.02): n_steps = int(np.log(q_max/q_min)/np.log(_step)) return q_min * np.asarray([_step**i for i in range(n_steps)]) -def quicknxs_scale(theta, peak, low_res, norm_peak, norm_low_res): - """ - Scaling factor to multiply by to be compatible with QuickNXS 1.0. - """ - quicknxs_scale = (float(norm_peak[1])-float(norm_peak[0])) * (float(norm_low_res[1])-float(norm_low_res[0])) - quicknxs_scale /= (float(peak[1])-float(peak[0])) * (float(low_res[1])-float(low_res[0])) - _scale = 0.005 / np.fabs(np.sin(theta)) if theta > 0.0002 else 1.0 - quicknxs_scale *= _scale - return quicknxs_scale - class EventReflectivity(object): """ diff --git a/reduction/test/test_reduction.py b/reduction/test/test_reduction.py index 9f4c122..950383b 100644 --- a/reduction/test/test_reduction.py +++ b/reduction/test/test_reduction.py @@ -11,6 +11,16 @@ from lr_reduction import event_reduction, template, workflow +def test_info(): + """ + Test utility functions to get basic info + """ + ws_sc = mtd_api.Load("REF_L_198409") + wl_min, wl_max = event_reduction.get_wl_range(ws_sc) + assert(wl_min == 13.7) + assert(wl_max == 16.3) + + def test_full_reduction(): """ Test the fill reduction chain