Skip to content

Commit

Permalink
add wl band test
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Oct 11, 2023
1 parent bd0a33f commit d7ab5be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 1 addition & 10 deletions reduction/lr_reduction/event_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
"""
Expand Down
10 changes: 10 additions & 0 deletions reduction/test/test_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d7ab5be

Please sign in to comment.