From 347d37091c96ff595095734d4e7a875b74737942 Mon Sep 17 00:00:00 2001 From: Mathieu Doucet Date: Fri, 26 Apr 2024 14:32:10 -0400 Subject: [PATCH] fix template --- reduction/lr_reduction/DeadTimeCorrection.py | 3 ++- reduction/lr_reduction/reduction_template_reader.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/reduction/lr_reduction/DeadTimeCorrection.py b/reduction/lr_reduction/DeadTimeCorrection.py index a6b16a8..8318c83 100644 --- a/reduction/lr_reduction/DeadTimeCorrection.py +++ b/reduction/lr_reduction/DeadTimeCorrection.py @@ -44,6 +44,7 @@ def PyExec(self): dead_time = self.getProperty("DeadTime").value tof_step = self.getProperty("TOFStep").value paralyzing = self.getProperty("Paralyzable").value + output_workspace = self.getPropertyValue("OutputWorkspace") # Rebin the data according to the tof_step we want to compute the correction with tof_min, tof_max = self.getProperty("TOFRange").value @@ -54,7 +55,7 @@ def PyExec(self): _ws_sc = Rebin(InputWorkspace=ws_event_data, Params="%s,%s,%s" % (tof_min, tof_step, tof_max), PreserveEvents=False) # Get the total number of counts on the detector for each TOF bin per pulse - counts_ws = SumSpectra(_ws_sc) + counts_ws = SumSpectra(_ws_sc, OutputWorkspace=output_workspace) # If we have error events, add them since those are also detector triggers if ws_error_events is not None: diff --git a/reduction/lr_reduction/reduction_template_reader.py b/reduction/lr_reduction/reduction_template_reader.py index 6261df9..9fb2ac3 100644 --- a/reduction/lr_reduction/reduction_template_reader.py +++ b/reduction/lr_reduction/reduction_template_reader.py @@ -68,6 +68,8 @@ def __init__(self): # Dead time correction self.dead_time:bool = False self.paralyzable:bool = True + self.dead_time_value = 4.2 + self.dead_time_tof_step = 150 def from_dict(self, data_dict, permissible=True): r""" @@ -154,7 +156,8 @@ def to_xml(self): # Dead time correction _xml += "%s\n" % str(self.dead_time) _xml += "%s\n" % str(self.paralyzable) - + _xml += "%s\n" % str(self.dead_time_value) + _xml += "%s\n" % str(self.dead_time_tof_step) _xml += "\n" return _xml @@ -261,6 +264,10 @@ def from_xml_element(self, instrument_dom): default=self.dead_time) self.paralyzable = getBoolElement(instrument_dom, "dead_time_paralyzable", default=self.paralyzable) + self.dead_time_value = getFloatElement(instrument_dom, "dead_time_value", + default=self.dead_time_value) + self.dead_time_tof_step = getFloatElement(instrument_dom, "dead_time_tof_step", + default=self.dead_time_tof_step) ###### Utility functions to read XML content ########################