Skip to content
Snippets Groups Projects
Commit c007575f authored by McDonnell, Marshall's avatar McDonnell, Marshall
Browse files

Re #28624 - Added ApplyScalingFactor flag to LiquidsReflectometryReduction + tests

parent 07624dea
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,7 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
self.declareProperty("AngleOffset", 0.0, doc="angle offset (degrees)")
self.declareProperty("AngleOffsetError", 0.0, doc="Angle offset error (degrees)")
self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", Direction.Output), "Output workspace")
self.declareProperty("ApplyScalingFactor", True, doc="If true, the scaling from Scaling Factor file will be applied")
self.declareProperty("ScalingFactorFile", "", doc="Scaling factor configuration file")
self.declareProperty("SlitTolerance", 0.02, doc="Tolerance for matching slit positions")
self.declareProperty("SlitsWidthFlag", True,
......@@ -183,12 +184,6 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
# Avoid leaving trash behind
AnalysisDataService.remove(str(ws_event_norm))
# Sum up the normalization peak
norm_summed = SumSpectra(InputWorkspace = norm_cropped)
norm_summed = RebinToWorkspace(WorkspaceToRebin=norm_summed,
WorkspaceToMatch=data_cropped,
OutputWorkspace=str(norm_summed))
# Sum up the normalization peak
norm_summed = SumSpectra(InputWorkspace = norm_cropped)
......@@ -209,7 +204,9 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
normalized_data.setDistribution(True)
# Apply scaling factors
normalized_data = self.apply_scaling_factor(normalized_data)
apply_scaling_factor = self.getProperty("ApplyScalingFactor").value
if apply_scaling_factor:
normalized_data = self.apply_scaling_factor(normalized_data)
q_workspace = SumSpectra(InputWorkspace = normalized_data)
q_workspace.getAxis(0).setUnit("MomentumTransfer")
......
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=no-init,attribute-defined-outside-init
import os
import systemtesting
from mantid import *
from mantid.simpleapi import *
class ApplyScalingFactorTest(systemtesting.MantidSystemTest):
def runTest(self):
scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg")
LiquidsReflectometryReduction(RunNumbers=[119814],
NormalizationRunNumber=119690,
SignalPeakPixelRange=[154, 166],
SubtractSignalBackground=True,
SignalBackgroundPixelRange=[151, 169],
NormFlag=True,
NormPeakPixelRange=[154, 160],
NormBackgroundPixelRange=[151, 163],
SubtractNormBackground=True,
LowResDataAxisPixelRangeFlag=True,
LowResDataAxisPixelRange=[99, 158],
LowResNormAxisPixelRangeFlag=True,
LowResNormAxisPixelRange=[98, 158],
TOFRange=[29623.0, 42438.0],
IncidentMediumSelected='2InDiamSi',
GeometryCorrectionFlag=False,
QMin=0.005,
QStep=0.01,
AngleOffset=0.009,
AngleOffsetError=0.001,
ApplyScalingFactor=False,
ScalingFactorFile=scaling_factor_file,
SlitsWidthFlag=True,
CropFirstAndLastPoints=False,
OutputWorkspace='reflectivity_119814_no_scaling')
def validate(self):
self.disableChecking.append('Instrument')
self.disableChecking.append('Sample')
self.disableChecking.append('SpectraMap')
self.disableChecking.append('Axes')
return "reflectivity_119814_no_scaling", 'REFL_119814_combined_data_no_scaling.nxs'
1408d9f4482f23ca203b574f589c87bc
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