ReflectometryReductionOne v3#

Summary#

Reduces a single TOF/Lambda reflectometry run into a mod Q vs I/I0 workspace. Performs monitor normalization and transmission corrections.

See Also#

ReflectometryReductionOneAuto

Properties#

Name

Direction

Type

Default

Description

TaskExecutionOrder

Input

str list

The tasks to execute, in execution order.

InputWorkspace

Input

MatrixWorkspace

Mandatory

Run to reduce.

SummationType

Input

string

SumInLambda

The type of summation to perform. Allowed values: [‘SumInLambda’, ‘SumInQ’]

ReductionType

Input

string

Normal

The type of reduction to perform when summing in Q. Allowed values: [‘Normal’, ‘DivergentBeam’, ‘NonFlatSample’]

IncludePartialBins

Input

boolean

False

If true then partial bins at the beginning and end of the output range are included

ThetaIn

Input

number

Optional

Angle in degrees

ProcessingInstructions

Input

string

Mandatory

Grouping pattern on spectrum numbers to yield only the detectors of interest. See GroupDetectors for details.

WavelengthMin

Input

number

Mandatory

Wavelength minimum in angstroms

WavelengthMax

Input

number

Mandatory

Wavelength maximum in angstroms

I0MonitorIndex

Input

number

Optional

I0 monitor workspace index

MonitorBackgroundWavelengthMin

Input

number

Optional

Wavelength minimum for monitor background subtraction in angstroms.

MonitorBackgroundWavelengthMax

Input

number

Optional

Wavelength maximum for monitor background subtraction in angstroms.

MonitorIntegrationWavelengthMin

Input

number

Optional

Wavelength minimum for integration in angstroms.

MonitorIntegrationWavelengthMax

Input

number

Optional

Wavelength maximum for integration in angstroms.

NormalizeByIntegratedMonitors

Input

boolean

True

Normalize by dividing by the integrated monitors.

SubtractBackground

Input

boolean

False

If true then perform background subtraction

BackgroundProcessingInstructions

Input

string

These processing instructions will be passed to the background subtraction algorithm

BackgroundCalculationMethod

Input

string

PerDetectorAverage

The type of background reduction to perform. Allowed values: [‘PerDetectorAverage’, ‘Polynomial’, ‘AveragePixelFit’]

DegreeOfPolynomial

Input

number

0

Degree of the fitted polynomial.

CostFunction

Input

string

Least squares

The cost function to be passed to the Fit algorithm. Allowed values: [‘Least squares’, ‘Unweighted least squares’]

FirstTransmissionRun

Input

MatrixWorkspace

First transmission run, or the low wavelength transmission run if SecondTransmissionRun is also provided.

SecondTransmissionRun

Input

MatrixWorkspace

Second, high wavelength transmission run. Optional. Causes the FirstTransmissionRun to be treated as the low wavelength transmission run.

Params

Input

dbl list

A comma separated list of first bin boundary, width, last bin boundary. These parameters are used for stitching together transmission runs. Values are in wavelength (angstroms). This input is only needed if a SecondTransmission run is provided.

StartOverlap

Input

number

Optional

Start wavelength for stitching transmission runs together. Only used if a second transmission run is provided.

EndOverlap

Input

number

Optional

End wavelength (angstroms) for stitching transmission runs together. Only used if a second transmission run is provided.

ScaleRHSWorkspace

Input

boolean

True

Scale the right-hand-side or left-hand-side workspace. Only used if a second transmission run is provided.

TransmissionProcessingInstructions

Input

string

These processing instructions will be passed to the transmission workspace algorithm

CorrectionAlgorithm

Input

string

None

The type of correction to perform. Allowed values: [‘None’, ‘PolynomialCorrection’, ‘ExponentialCorrection’]

Polynomial

Input

dbl list

Coefficients to be passed to the PolynomialCorrection algorithm.

C0

Input

number

0

C0 value to be passed to the ExponentialCorrection algorithm.

C1

Input

number

0

C1 value to be passed to the ExponentialCorrection algorithm.

Debug

Input

boolean

False

Whether to enable the output of extra workspaces.

Diagnostics

Input

boolean

False

Whether to enable the output of interim workspaces for debugging purposes.

OutputWorkspace

Output

MatrixWorkspace

Outputs the workspace associated with the last performed task. Typically IvsQ.

OutputWorkspaceWavelength

Output

MatrixWorkspace

Output Workspace IvsLam. Intermediate workspace.

OutputWorkspaceQ

Output

MatrixWorkspace

Output Workspace IvsQ.

OutputWorkspaceTransmission

Output

MatrixWorkspace

Output transmissison workspace in wavelength

OutputWorkspaceFirstTransmission

Output

MatrixWorkspace

First transmissison workspace in wavelength

OutputWorkspaceSecondTransmission

Output

MatrixWorkspace

Second transmissison workspace in wavelength

Description#

This algorithm is not meant to be used directly by users. Please see ReflectometryReductionOneAuto v3, which is a facade over this algorithm.

Version 3 is a refactor of ReflectometryReductionOne version 2 into a task-based algorithm. The reduction methodology and output workspaces are intended to be the same as version 2. See ReflectometryReductionOne version 2 for the detailed description of the reduction workflow, including conversion to wavelength, monitor normalisation, transmission correction, summation in Q, and conversion to momentum transfer.

Task Execution Order#

Version 3 exposes the TaskExecutionOrder property. This property is intended for advanced use. If it is left blank, the algorithm dynamically builds the task execution order from the input workspace and reduction properties. If it is provided, the custom task execution order is used instead.

When TaskExecutionOrder is blank, the generated order depends on:

  • the input workspace X unit. A workspace already in wavelength is treated as partially reduced, so the initial extraction, summation, wavelength conversion, monitor normalisation, and transmission normalisation tasks are skipped;

  • SummationType. SumInQ uses the Q-summation task after the normalisation steps, while the default wavelength summation uses the detector summation task before wavelength conversion;

  • monitor normalisation properties. TaskNormalizeByMonitor is included only when I0MonitorIndex, MonitorBackgroundWavelengthMin, and MonitorBackgroundWavelengthMax are all set;

  • transmission and algorithmic correction properties. TaskNormalizeByTransmission is included when FirstTransmissionRun is set. If CorrectionAlgorithm is set, TaskNormalizeByAlgorithm is used instead;

  • SubtractBackground. TaskBackgroundSubtraction is included only when this property is set.

The available task names are:

  • TaskExtractROI

  • TaskBackgroundSubtraction

  • TaskSumDetectors

  • TaskConvertToWavelength

  • TaskNormalizeByMonitor

  • TaskNormalizeByTransmission

  • TaskNormalizeByAlgorithm

  • TaskSumDetectorsInQ

  • TaskCropWavelength

  • TaskConvertToQ

Custom task orders must use valid task names and must include the prerequisite tasks needed to satisfy each task’s input dependencies. Knowledge of the implementation of the task-based structure is therefore required.

For routine reductions, leave TaskExecutionOrder blank so that the algorithm selects the same workflow as version 2 from the supplied properties.

Previous Versions#

This is version 3 of the algorithm. For version 2, please see here.

Usage#

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 - Reduce a run using the dynamically generated task order

run = Load(Filename='INTER00013460.nxs')
IvsQ, IvsLam = ReflectometryReductionOne(InputWorkspace=run,
                                         WavelengthMin=1.0,
                                         WavelengthMax=17.0,
                                         ProcessingInstructions='4',
                                         I0MonitorIndex=2,
                                         MonitorBackgroundWavelengthMin=15.0,
                                         MonitorBackgroundWavelengthMax=17.0,
                                         MonitorIntegrationWavelengthMin=4.0,
                                         MonitorIntegrationWavelengthMax=10.0)

print("{:.4f}".format(IvsLam.readY(0)[533]))
print("{:.4f}".format(IvsLam.readY(0)[534]))
print("{:.4f}".format(IvsQ.readY(0)[327]))
print("{:.4f}".format(IvsQ.readY(0)[328]))

Output:

0.0003
0.0003
0.0003
0.0003

Example - Reduce a run using a custom task execution order

run = Load(Filename='INTER00013460.nxs')
task_order = [
    "TaskExtractROI",
    "TaskSumDetectors",
    "TaskConvertToWavelength",
    "TaskNormalizeByMonitor",
    "TaskCropWavelength",
    "TaskConvertToQ",
]
IvsQ, IvsLam = ReflectometryReductionOne(TaskExecutionOrder=task_order,
                                         InputWorkspace=run,
                                         WavelengthMin=1.0,
                                         WavelengthMax=17.0,
                                         ProcessingInstructions='4',
                                         I0MonitorIndex=2,
                                         MonitorBackgroundWavelengthMin=15.0,
                                         MonitorBackgroundWavelengthMax=17.0,
                                         MonitorIntegrationWavelengthMin=4.0,
                                         MonitorIntegrationWavelengthMax=10.0)

print("{:.4f}".format(IvsLam.readY(0)[533]))
print("{:.4f}".format(IvsLam.readY(0)[534]))
print("{:.4f}".format(IvsQ.readY(0)[327]))
print("{:.4f}".format(IvsQ.readY(0)[328]))

Output:

0.0003
0.0003
0.0003
0.0003

Categories: AlgorithmIndex | Reflectometry

Source#

C++ header: ReflectometryReductionOne3.h

C++ source: ReflectometryReductionOne3.cpp