Unverified Commit fdad2bce authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #30197 from mantidproject/d33_tof_lambda_range

ILL TOF SANS wavelength range
parents b82b5f04 a4f1d351
......@@ -353,7 +353,7 @@ class SANSILLAutoProcess(DataProcessorAlgorithm):
'DefaultQBinning', 'BinningFactor',
'OutputBinning', 'NPixelDivision',
'NumberOfWedges', 'WedgeAngle', 'WedgeOffset',
'AsymmetricWedges', 'IQxQyLogBinning'])
'AsymmetricWedges', 'IQxQyLogBinning', 'WavelengthRange'])
self.setPropertyGroup('OutputType', 'Integration Options')
self.setPropertyGroup('CalculateResolution', 'Integration Options')
......@@ -684,7 +684,8 @@ class SANSILLAutoProcess(DataProcessorAlgorithm):
DeltaQ=(self.deltaq[i]
if len(self.deltaq) == self.dimensionality
else self.deltaq[0]),
IQxQyLogBinning=self.getProperty('IQxQyLogBinning').value
IQxQyLogBinning=self.getProperty('IQxQyLogBinning').value,
WavelengthRange=self.getProperty('WavelengthRange').value
)
# wedges ungrouping and renaming
......
......@@ -7,7 +7,8 @@
from mantid.api import PythonAlgorithm, MatrixWorkspaceProperty, WorkspaceUnitValidator, WorkspaceGroupProperty, \
PropertyMode, MatrixWorkspace, NumericAxis
from mantid.kernel import EnabledWhenProperty, FloatArrayProperty, Direction, StringListValidator, \
IntBoundedValidator, FloatBoundedValidator, PropertyCriterion, LogicOperator
IntBoundedValidator, FloatBoundedValidator, PropertyCriterion, LogicOperator, FloatArrayOrderedPairsValidator, \
FloatArrayLengthValidator, CompositeValidator
from mantid.simpleapi import *
from MildnerCarpenter import *
import numpy as np
......@@ -20,6 +21,7 @@ class SANSILLIntegration(PythonAlgorithm):
_output_type = ''
_resolution = ''
_masking_criterion = ''
_lambda_range = []
def category(self):
return 'ILL\\SANS'
......@@ -152,27 +154,39 @@ class SANSILLIntegration(PythonAlgorithm):
self.setPropertyGroup('MaxQxy', 'I(Qx,Qy) Options')
self.setPropertyGroup('DeltaQ', 'I(Qx,Qy) Options')
self.setPropertyGroup('IQxQyLogBinning', 'I(Qx,Qy) Options')
self.declareProperty(name='BinMaskingCriteria', defaultValue='',
doc='Criteria to mask bins, used for TOF mode,'
' for example to discard high and low lambda ranges;'
'see MaskBinsIf algorithm for details.')
self.declareProperty(WorkspaceGroupProperty('PanelOutputWorkspaces', '',
direction=Direction.Output,
optional=PropertyMode.Optional),
doc='The name of the output workspace group for detector panels.')
self.setPropertyGroup('PanelOutputWorkspaces', 'I(Q) Options')
lambda_range_validator = CompositeValidator()
lambda_range_validator.add(FloatArrayOrderedPairsValidator())
lambda_range_validator.add(FloatArrayLengthValidator(2))
self.declareProperty(FloatArrayProperty('WavelengthRange', [1., 10.], validator=lambda_range_validator),
doc='Wavelength range [Angstrom] to be used in integration (TOF only).')
def PyExec(self):
self._input_ws = self.getPropertyValue('InputWorkspace')
self._output_type = self.getPropertyValue('OutputType')
self._resolution = self.getPropertyValue('CalculateResolution')
self._output_ws = self.getPropertyValue('OutputWorkspace')
self._masking_criterion = self.getPropertyValue('BinMaskingCriteria')
if self._masking_criterion:
MaskBinsIf(InputWorkspace=self._input_ws, OutputWorkspace=self._input_ws+'_masked', Criterion=self._masking_criterion)
self._input_ws = self._input_ws+'_masked'
self._lambda_range = self.getProperty('WavelengthRange').value
is_tof = mtd[self._input_ws].getRun().getLogData('tof_mode').value == 'TOF' # D33 only
if is_tof:
cut_input_ws = self._input_ws+'_cut'
CropWorkspaceRagged(InputWorkspace=self._input_ws,
OutputWorkspace=cut_input_ws,
XMin=self._lambda_range[0],
XMax=self._lambda_range[1])
self._input_ws = cut_input_ws
# re-calculate the Q-range after lambda cut
CalculateDynamicRange(Workspace=self._input_ws,
ComponentNames=['back_detector',
'front_detector_right',
'front_detector_left',
'front_detector_top',
'front_detector_bottom'])
self._integrate(self._input_ws, self._output_ws)
self.setProperty('OutputWorkspace', self._output_ws)
panels_out_ws = self.getPropertyValue('PanelOutputWorkspaces')
......@@ -189,6 +203,8 @@ class SANSILLIntegration(PythonAlgorithm):
panel_outputs.append(out_ws)
GroupWorkspaces(InputWorkspaces=panel_outputs, OutputWorkspace=panels_out_ws)
self.setProperty('PanelOutputWorkspaces', mtd[panels_out_ws])
if is_tof:
DeleteWorkspace(self._input_ws)
def _integrate(self, in_ws, out_ws, panel=None):
if self._output_type == 'I(Q)' or self._output_type == 'I(Phi,Q)':
......
......@@ -102,7 +102,7 @@ class SANSILLIntegrationTest(unittest.TestCase):
# TOF resolution is not yet implemented
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq')
self._check_output(mtd['iq'])
self.assertEqual(mtd['iq'].blocksize(), 217)
self.assertEqual(mtd['iq'].blocksize(), 162)
def _check_output(self, ws, spectra = 1):
self.assertTrue(ws)
......
......@@ -23,7 +23,8 @@ class ILL_D11_Test(systemtesting.MantidSystemTest):
mtd.clear()
def validate(self):
self.tolerance = 1e-5
self.tolerance = 1e-3
self.tolerance_is_rel_err = True
self.disableChecking = ['Instrument']
return ['iq', 'ILL_SANS_D11_IQ.nxs']
......@@ -83,7 +84,8 @@ class ILL_D22_Test(systemtesting.MantidSystemTest):
mtd.clear()
def validate(self):
self.tolerance = 1e-5
self.tolerance = 1e-3
self.tolerance_is_rel_err = True
self.disableChecking = ['Instrument']
return ['iq', 'ILL_SANS_D22_IQ_v2.nxs']
......@@ -144,7 +146,8 @@ class ILL_D33_VTOF_Test(systemtesting.MantidSystemTest):
mtd.clear()
def validate(self):
self.tolerance = 1e-4
self.tolerance = 1e-3
self.tolerance_is_rel_err = True
self.disableChecking = ['Instrument']
return ['iq', 'ILL_SANS_D33_VTOF_IQ.nxs']
......@@ -169,8 +172,7 @@ class ILL_D33_VTOF_Test(systemtesting.MantidSystemTest):
SANSILLReduction(Run='093410', ProcessAs='Sample', BeamInputWorkspace='beam', TransmissionInputWorkspace='str',
ContainerInputWorkspace='can', MaskedInputWorkspace='mask', OutputWorkspace='sample', FluxInputWorkspace='flux')
# I(Q)
SANSILLIntegration(InputWorkspace='sample', OutputBinning='0.005,-0.1,1',
OutputWorkspace='iq', BinMaskingCriteria='x<1 || x>10')
SANSILLIntegration(InputWorkspace='sample', OutputBinning='0.005,-0.1,1', OutputWorkspace='iq')
class ILL_D33_LTOF_Test(systemtesting.MantidSystemTest):
......@@ -188,7 +190,8 @@ class ILL_D33_LTOF_Test(systemtesting.MantidSystemTest):
mtd.clear()
def validate(self):
self.tolerance = 1e-5
self.tolerance = 1e-3
self.tolerance_is_rel_err = True
self.disableChecking = ['Instrument']
return ['iq', 'ILL_SANS_D33_LTOF_IQ.nxs']
......@@ -214,8 +217,7 @@ class ILL_D33_LTOF_Test(systemtesting.MantidSystemTest):
ContainerInputWorkspace='can', MaskedInputWorkspace='mask', OutputWorkspace='sample', FluxInputWorkspace='flux')
# I(Q)
SANSILLIntegration(InputWorkspace='sample', OutputBinning='0.005,-0.1,1',
OutputWorkspace='iq', BinMaskingCriteria='x<1 || x>10')
SANSILLIntegration(InputWorkspace='sample', OutputBinning='0.005,-0.1,1', OutputWorkspace='iq')
class ILL_D33_Test(systemtesting.MantidSystemTest):
......@@ -234,6 +236,7 @@ class ILL_D33_Test(systemtesting.MantidSystemTest):
def validate(self):
self.tolerance = 1e-3
self.tolerance_is_rel_err = True
self.disableChecking = ['Instrument']
return ['iq', 'ILL_SANS_D33_IQ.nxs']
......
b2736c2cb28e09bf50bb8e8ef4c9363f
1bca86d19953d25aff9f7760152ca1ee
91857b64e5158f9cd37fc283d546c111
cf34cccaef9056684cc7260069cde554
0a71d5f25a650b287e594221cccfe662
7c281c94d46eaad721e672db3de4eef5
......@@ -8,8 +8,6 @@ SANS Changes
Improvements
############
- Add support for D11, D16, D22 and D33 in the :ref:`MaskBTP <algm-MaskBTP>` algorithm.
.. warning:: **Developers:** Sort changes under appropriate heading
putting new features at the top of the section, followed by
improvements, followed by bug fixes.
......@@ -20,15 +18,17 @@ Algorithms and instruments
Improvements
############
- Added instrument definitions for the two new PSD based multi-panel SANS instruments D11B and D22B at the ILL.
- In :ref:`SANSILLAutoProcess <algm-SANSILLAutoProcess>`, the beam radius can be different for each distance.
A new parameter, TransmissionBeamRadius, has been added to set the beam radius for transmission experiments.
The default value of all beam radii is now 0.1m.
- With :ref:`SANSILLAutoProcess <algm-SANSILLAutoProcess>`, if sample thickness is set to -1, the algorithm will try to get it
from the nexus file.
- With :ref:`SANSILLAutoProcess <algm-SANSILLAutoProcess>`, the output workspace will get its title from the nexus file.
- The Rectangle option for :ref:`SolidAngle <algm-SolidAngle>` is now supported for ILL's D22 and D33.
- Add loader and MaskBTP support for D11B and D22B.
- Added instrument definitions for the two new PSD based multi-panel SANS instruments D11B and D22B at the ILL.
- Added support for D11, D16, D22 and D33 in the :ref:`MaskBTP <algm-MaskBTP>` algorithm.
- Several improvements have been done in ILL SANS suite :ref:`SANSILLAutoProcess <algm-SANSILLAutoProcess>`:
- The beam radius can be different for each distance.
- A new parameter, TransmissionBeamRadius, has been added to set the beam radius for transmission measurements.
- The default value of all the beam radii is now 0.1m.
- If sample thickness is set to -1, the algorithm will try to get it from the nexus file itself.
- The output workspace will get its title from the nexus file.
- WavelengthRange is exposed to the algorithm, which is crucial for TOF reduction.
- The Rectangle option for :ref:`SolidAngle <algm-SolidAngle>` is now supported for ILL's D22 and D33.
- Added loader and MaskBTP support for D11B and D22B.
Bugfixes
########
......
......@@ -164,7 +164,8 @@ class RundexSettings(object):
"MaxQxy",
"DeltaQ",
"IQxQyLogBinning",
"OutputPanels"
"OutputPanels",
"WavelengthRange"
],
REFL_POL : [
"PolarizationEfficiencyFile",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment