\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
This algorithm executes the full data reduction for ILL reflectometers D17 and FIGARO in TOF mode (specular reflection) following [1].
The mandatory inputs are comma separated list of nexus files for direct and reflected beam measurements. , stands as the separator of different angle configurations. + (sum) or - (range sum) operations can be used to sum different files at the same instrument configuration. When summing the metadata (e.g. acquisition time) will also be summed, so that the subsequent normalisation is handled correctly. There must be the same number of angle configurations both for direct and reflected beam inputs.
The output is a workspace group that contains the calculated reflectivity curves as a function of the momentum transfer. The output is point data and has the calculated Q resolution attributed to it. There is a separate output for each angle configuration. An automatically stitched result is also produced. Stitch in this case just takes the union of all the initial points without merging or removal, only scaling can be applied. The outputs can be readily saved by SaveReflectometryAscii algorithm for further analysis.
If user specified \(\theta\) angles are provided, they will be used. Otherwise SampleAngle or DetectorAngle (default) option is executed.
The default summation type is incoherent (sum along constant \(\lambda\)), where the reflectivity curve is calculated by dividing the summed foreground of the reflected beam by the summed foreground of the direct beam. For coherent summing, first the reflected beam data is divided by the direct beam data in 2D, then the ratio is summed along the lines of the constant \(Q_{z}\).
Many options can be specified as a single value, which will be applied to all the angle configurations, or as a list of values. In the case of the latter, the list must be of the same size, as many different angle configurations there are.
The processed direct beam runs can be cached in Analysis Data Service in order to save significant time when multiple samples correspond to the same direct beam with the same processing configurations. The name for the cached direct beam runs are derived from the run numbers; it is the run number if there is only one numor, or the first run number if there are several numors summed. Both the processed direct beam, and its summed foreground are cached. Care must be taken when enabling the caching, since if the same direct beam must be used with different options (e.g. different wavelength ranges) for different reflected beams, the caching will result in an error in subsequent reduction steps due to incompatibility of the workspaces. In such case the caching must be disabled, or one has to clean the cache manually by deleting the corresponding workspaces.
Note
To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.
Example - Single Angle
ws = ReflectometryILLAutoProcess(
Run='317370',
DirectRun='317369',
WavelengthLowerBound=3.5,
WavelengthUpperBound=24.5,
DeltaQFractionBinning=0.1
)
print('The R(Q) workspace has {0} points'.format(ws.getItem(0).blocksize()))
The R(Q) workspace has 672 points
Example - Multiple Angles
ws = ReflectometryILLAutoProcess(
Run='541853,541854',
DirectRun='541838,541839',
WavelengthLowerBound=[3.5,3.5],
WavelengthUpperBound=[25.,22.],
GlobalScaleFactor=0.13,
DeltaQFractionBinning=0.5
)
print('The R(Q) workspace at first angle has {0} points'.format(ws.getItem(0).blocksize()))
print('The R(Q) workspace at second angle has {0} points'.format(ws.getItem(1).blocksize()))
print('The R(Q) workspace at second angle has {0} points'.format(ws.getItem(2).blocksize()))
The R(Q) workspace at first angle has 186 points
The R(Q) workspace at second angle has 94 points
The R(Q) workspace at second angle has 280 points
Example - Full treatment with 3 angles and multiple numors summed
from mantid.simpleapi import *
config['default.facility'] = 'ILL'
config['default.instrument'] = 'D17'
config.appendDataSearchSubDir('ILL/D17/')
name = 'Thick_HR_5'
directBeams = '397812,397806,397808'
reflectedBeams = '397826+397827,397828,397829+397830+397831+397832'
foregroundWidth = [4,5,8]
wavelengthLower = [3., 1.6, 2.]
wavelengthUpper = [27., 25., 25.]
angleOffset = 2
angleWidth = 10
ReflectometryILLAutoProcess(
Run=reflectedBeams,
DirectRun=directBeams,
OutputWorkspace=name,
SummationType='Incoherent',
AngleOption='SampleAngle',
DirectLowAngleFrgHalfWidth=foregroundWidth,
DirectHighAngleFrgHalfWidth=foregroundWidth,
DirectLowAngleBkgOffset=angleOffset,
DirectLowAngleBkgWidth=angleWidth,
DirectHighAngleBkgOffset=angleOffset,
DirectHighAngleBkgWidth=angleWidth,
ReflLowAngleFrgHalfWidth=foregroundWidth,
ReflHighAngleFrgHalfWidth=foregroundWidth,
ReflLowAngleBkgOffset=angleOffset,
ReflLowAngleBkgWidth=angleWidth,
ReflHighAngleBkgOffset=angleOffset,
ReflHighAngleBkgWidth=angleWidth,
WavelengthLowerBound=wavelengthLower,
WavelengthUpperBound=wavelengthUpper,
DeltaQFractionBinning=0.5
)
import matplotlib.pyplot as plt
from mantid import plots
plt.style.use('classic')
plt.rcParams['figure.figsize'] = (12, 7)
plt.rcParams['font.size'] = 18
wsMantid = mtd['Thick_HR_5_stitched']
fig, ax = plt.subplots(subplot_kw={'projection':'mantid'})
ax.plot(wsMantid, 'b', label="RoundRobin")
ax.errorbar(wsMantid,'rs', 'b', markersize=0.1, label=None)
ax.set_xlim(0.01, 0.2)
ax.set_ylim(0.000001, 2.)
ax.set_yscale("log")
ax.set_xscale("log")
ax.set_xlabel('Q [$\AA^{-1}$]')
ax.set_ylabel('R')
ax.legend()
fig.show()
[1] | P. Gutfreund, T. Saerbeck, M. A. Gonzalez, E. Pellegrini, M. Laver, C. Dewhurst, R. Cubitt, Towards generalized data reduction on a chopper-based time-of-flight neutron reflectometer. J. Appl. Cryst. (2018). 51, 606-615, |
Name | Direction | Type | Default | Description |
---|---|---|---|---|
PolarizationOption | Input | string | NonPolarized | Indicate whether measurements are polarized. Allowed values: [‘NonPolarized’, ‘Polarized’] |
Run | Input | list of str lists | A list of reflected run numbers/files. Allowed values: [‘nxs’] | |
Run00 | Input | list of str lists | A list of reflected run numbers/files for 00 (or 0). Allowed values: [‘nxs’] | |
Run01 | Input | list of str lists | A list of reflected run numbers/files for 01. Allowed values: [‘nxs’] | |
Run10 | Input | list of str lists | A list of reflected run numbers/files for 10. Allowed values: [‘nxs’] | |
Run11 | Input | list of str lists | A list of reflected run numbers/files for 11 (or 1). Allowed values: [‘nxs’] | |
PolarizationEfficiencyFile | Input | string | A file containing the polarization efficiency factors. | |
DirectRun | Input | list of str lists | Mandatory | A list of direct run numbers/files. Allowed values: [‘nxs’] |
OutputWorkspace | Output | WorkspaceGroup | Mandatory | The output workspace group. |
DirectFlatBackground | Input | string | Background Average | Flat background calculation method for background subtraction. Allowed values: [‘Background Average’, ‘Background Constant Fit’, ‘Background Linear Fit’, ‘Background OFF’] |
ReflFlatBackground | Input | string | Background Average | Flat background calculation method for background subtraction. Allowed values: [‘Background Average’, ‘Background Constant Fit’, ‘Background Linear Fit’, ‘Background OFF’] |
SubalgorithmLogging | Input | string | Logging OFF | Enable or disable child algorithm logging. Allowed values: [‘Logging OFF’, ‘Logging ON’] |
Cleanup | Input | string | Cleanup ON | Enable or disable intermediate workspace cleanup. Allowed values: [‘Cleanup ON’, ‘Cleanup OFF’] |
WaterWorkspace | Input | MatrixWorkspace | A (water) calibration workspace (unit TOF). | |
SlitNormalisation | Input | string | Slit Normalisation AUTO | Enable or disable slit normalisation. Allowed values: [‘Slit Normalisation AUTO’, ‘Slit Normalisation OFF’, ‘Slit Normalisation ON’] |
FluxNormalisation | Input | string | Normalise To Time | Neutron flux normalisation method. Allowed values: [‘Normalise To Time’, ‘Normalise To Monitor’, ‘Normalisation OFF’] |
GlobalScaleFactor | Input | number | 1 | Scale factor. |
UseManualScaleFactors | Input | boolean | False | Choose to apply manual scale factors for stitching. |
ManualScaleFactors | Input | dbl list | A list of manual scale factors for stitching (number of anlge configurations minus 1) | |
CacheDirectBeam | Input | boolean | False | Cache the processed direct beam in ADS for ready use with further reflected beams;saves important execution time, however assumes that the direct beam processing configuration must be invariant for different reflected beams. |
AngleOption | Input | str list | DetectorAngle | Angle option used for detector positioning |
Theta | Input | dbl list | -1 | A user-defined angle theta in degree |
SummationType | Input | str list | Incoherent | Type of summation to perform |
WavelengthLowerBound | Input | dbl list | 2 | The lower wavelength bound (Angstrom) |
WavelengthUpperBound | Input | dbl list | 30 | The upper wavelength bound (Angstrom) |
DeltaQFractionBinning | Input | dbl list | 0.5 | If set, group the output by steps of this fraction multiplied by Q resolution |
DirectLowAngleFrgHalfWidth | Input | long list | 2 | Number of foreground pixels at lower angles from the centre pixel. |
DirectLowAngleBkgOffset | Input | long list | 5 | Distance of flat background region towards smaller detector angles from the foreground centre, in pixels |
DirectLowAngleBkgWidth | Input | long list | 5 | Width of flat background region towards smaller detector angles from the foreground centre, in pixels |
DirectHighAngleFrgHalfWidth | Input | long list | 2 | Number of foreground pixels at higher angles from the centre pixel. |
DirectHighAngleBkgOffset | Input | long list | 5 | Distance of flat background region towards larger detector angles from the foreground centre, in pixels |
DirectHighAngleBkgWidth | Input | long list | 5 | Width of flat background region towards larger detector angles from the foreground centre, in pixels |
DirectFitStartWorkspaceIndex | Input | long list | 0 | Start histogram index used for peak fitting |
DirectFitEndWorkspaceIndex | Input | long list | 255 | Last histogram index used for peak fitting |
DirectFitWavelengthLowerBound | Input | number | -1 | Minimum x value (unit wavelength) used for peak fitting. |
DirectFitWavelengthUpperBound | Input | number | -1 | Maximum x value (unit wavelength) used for peak fitting. |
ReflLowAngleFrgHalfWidth | Input | long list | 2 | Number of foreground pixels at lower angles from the centre pixel. |
ReflLowAngleBkgOffset | Input | long list | 5 | Distance of flat background region towards smaller detector angles from the foreground centre, in pixels. |
ReflLowAngleBkgWidth | Input | long list | 5 | Width of flat background region towards smaller detector angles from the foreground centre, in pixels |
ReflHighAngleFrgHalfWidth | Input | long list | 2 | Number of foreground pixels at higher angles from the centre pixel. |
ReflHighAngleBkgOffset | Input | long list | 5 | Distance of flat background region towards larger detector angles from the foreground centre, in pixels |
ReflHighAngleBkgWidth | Input | long list | 5 | Width of flat background region towards larger detector angles from the foreground centre, in pixels. |
ReflFitStartWorkspaceIndex | Input | long list | 0 | Start histogram index used for peak fitting |
ReflFitEndWorkspaceIndex | Input | long list | 255 | Last histogram index used for peak fitting |
ReflFitWavelengthLowerBound | Input | dbl list | -1 | Minimum x value (unit wavelength) used for peak fitting |
ReflFitWavelengthUpperBound | Input | dbl list | -1 | Maximum x value (unit wavelength) used for peak fitting |
Categories: AlgorithmIndex | ILL\Reflectometry | ILL\Auto | Workflow\Reflectometry
Python: ReflectometryILLAutoProcess.py (last modified: 2020-09-16)