Skip to content

Commit

Permalink
add a test and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Mar 8, 2024
1 parent 800eb04 commit b424ac0
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions reduction/test/test_dead_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
mtd_api.config["default.facility"] = "SNS"
mtd_api.config["default.instrument"] = "REF_L"

from lr_reduction import event_reduction, template, workflow
from lr_reduction.utils import amend_config


Expand Down Expand Up @@ -43,8 +44,29 @@ def test_deadtime_paralyzable(nexus_dir):
algo.PyExec()
corr_ws = algo.getProperty('OutputWorkspace').value
corr = corr_ws.readY(0)
with open("dc.txt", 'w') as fd:
fd.write(str(corr))
for c in corr:
assert(c>0)
assert(c<1.001)

def test_full_reduction(nexus_dir):
"""
Test dead time from the reduction workflow
"""
template_path = 'data/template.xml'
with amend_config(data_dir=nexus_dir):
ws = mtd_api.Load("REF_L_198409")

sequence_number = ws.getRun().getProperty("sequence_number").value[0]
template_data = template.read_template(template_path, sequence_number)
template_data.dead_time = True

_, r1, _ = template.process_from_template_ws(ws, template_data)

template_data.dead_time = False
_, r2, _ = template.process_from_template_ws(ws, template_data)

corr = r1/r2
for c in corr:
assert(c>0)
assert(c<1.001)

0 comments on commit b424ac0

Please sign in to comment.