Skip to content

Commit

Permalink
fix tNR launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Sep 26, 2024
1 parent aea8716 commit 962fed2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions launcher/scripts/time_resolved_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

sys.path.append("/SNS/REF_L/shared/reduction")


from lr_reduction import time_resolved


Expand Down
24 changes: 23 additions & 1 deletion reduction/lr_reduction/time_resolved.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
mantid.kernel.config.setLogLevel(3)

from . import template
from .event_reduction import compute_resolution
from .event_reduction import apply_dead_time_correction, compute_resolution


def reduce_30Hz_from_ws(meas_ws_30Hz, ref_ws_30Hz, data_60Hz, template_data, scan_index=1, # noqa ARG001
Expand Down Expand Up @@ -223,6 +223,16 @@ def reduce_slices_ws(meas_ws, template_file,
:param theta_value: force theta value
:param theta_offset: add a theta offset, defaults to zero
"""
# Save options
options = dict(meas_run=meas_ws.getRun()['run_number'].value,
template=template_file,
time_interval=time_interval,
output_dir=output_dir,
scan_index=scan_index,
theta_value=theta_value,
theta_offset=theta_offset)
with open(os.path.join(output_dir, 'options.json'), 'w') as fp:
json.dump(options, fp)

# Load the template
print("Reading template")
Expand All @@ -244,6 +254,11 @@ def reduce_slices_ws(meas_ws, template_file,
except:
meas_run = 0

# Apply dead time correction up front since we are using the error events but
# not filtering them.
if template_data.dead_time:
apply_dead_time_correction(meas_ws, template_data)

# Time slices
print("Slicing data")
splitws, infows = api.GenerateEventsFilter(InputWorkspace=meas_ws, TimeInterval=time_interval)
Expand All @@ -265,6 +280,13 @@ def reduce_slices_ws(meas_ws, template_file,
# Load DB so we do it only once
ws_db = api.LoadEventNexus("REF_L_%s" % template_data.norm_file)

# Apply dead time correction up-front
if template_data.dead_time:
apply_dead_time_correction(ws_db, template_data)

# Turn off dead time since we already did it
template_data.dead_time = False

reduced = []
total_time = 0
for name in wsnames:
Expand Down

0 comments on commit 962fed2

Please sign in to comment.