Skip to content
Snippets Groups Projects
Unverified Commit cbbaa9d6 authored by Mathieu Doucet's avatar Mathieu Doucet Committed by GitHub
Browse files

MR: add option not to perform final rebin

parent 1009d97e
No related branches found
No related tags found
No related merge requests found
...@@ -95,6 +95,7 @@ class MagnetismReflectometryReduction(PythonAlgorithm): ...@@ -95,6 +95,7 @@ class MagnetismReflectometryReduction(PythonAlgorithm):
self.declareProperty("RoundUpPixel", True, doc="If True, round up pixel position of the specular reflectivity") self.declareProperty("RoundUpPixel", True, doc="If True, round up pixel position of the specular reflectivity")
self.declareProperty("UseSANGLE", False, doc="If True, use SANGLE as the scattering angle") self.declareProperty("UseSANGLE", False, doc="If True, use SANGLE as the scattering angle")
self.declareProperty("SpecularPixel", 180.0, doc="Pixel position of the specular reflectivity") self.declareProperty("SpecularPixel", 180.0, doc="Pixel position of the specular reflectivity")
self.declareProperty("FinalRebin", True, doc="If True, the final reflectivity will be rebinned")
self.declareProperty("QMin", 0.005, doc="Minimum Q-value") self.declareProperty("QMin", 0.005, doc="Minimum Q-value")
self.declareProperty("QStep", 0.02, doc="Step size in Q. Enter a negative value to get a log scale") self.declareProperty("QStep", 0.02, doc="Step size in Q. Enter a negative value to get a log scale")
self.declareProperty("AngleOffset", 0.0, doc="angle offset (rad)") self.declareProperty("AngleOffset", 0.0, doc="angle offset (rad)")
...@@ -442,13 +443,22 @@ class MagnetismReflectometryReduction(PythonAlgorithm): ...@@ -442,13 +443,22 @@ class MagnetismReflectometryReduction(PythonAlgorithm):
q_workspace = SortXAxis(InputWorkspace=q_workspace, OutputWorkspace=str(q_workspace)) q_workspace = SortXAxis(InputWorkspace=q_workspace, OutputWorkspace=str(q_workspace))
name_output_ws = str(workspace)+'_reflectivity' name_output_ws = str(workspace)+'_reflectivity'
try: do_q_rebin = self.getProperty("FinalRebin").value
q_rebin = Rebin(InputWorkspace=q_workspace, Params=q_range,
OutputWorkspace=name_output_ws)
except:
raise RuntimeError("Could not rebin with %s" % str(q_range))
AnalysisDataService.remove(str(q_workspace)) if do_q_rebin:
try:
q_rebin = Rebin(InputWorkspace=q_workspace, Params=q_range,
OutputWorkspace=name_output_ws)
AnalysisDataService.remove(str(q_workspace))
except:
logger.error("Could not rebin with %s" % str(q_range))
do_q_rebin = False
# If we either didn't want to rebin or we failed to rebin,
# rename the reflectivity workspace and proceed with it.
if not do_q_rebin:
q_rebin = RenameWorkspace(InputWorkspace=q_workspace,
OutputWorkspace=name_output_ws)
return q_rebin return q_rebin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment