ReflectometryMomentumTransfer v1

../_images/ReflectometryMomentumTransfer-v1_dlg.png

ReflectometryMomentumTransfer dialog.

Summary

Convert wavelength to momentum transfer and calculate the Qz resolution for reflectometers at continuous beam sources.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory A reflectivity workspace in wavelenght.
OutputWorkspace Output MatrixWorkspace Mandatory The input workspace with DX values set to the Qz resolution.
ReflectedBeamWorkspace Input MatrixWorkspace Mandatory A reflected beam workspace in wavelength.
ReflectedForeground Input int list Mandatory A two element list [start, end] defining the reflected beam foreground region in workspace indices.
DirectBeamWorkspace Input MatrixWorkspace Mandatory A direct beam workspace in wavelength.
DirectForeground Input int list Mandatory A two element list [start, end] defining the direct beam foreground region in workspace indices.
SummationType Input string SumInLambda The type of summation performed for the input workspace. Allowed values: [‘SumInLambda’, ‘SumInQ’]
Polarized Input boolean False True if the input workspace is part of polarization analysis experiment, false otherwise.
PixelSize Input number Mandatory Detector pixel size, in meters.
DetectorResolution Input number Mandatory Detector pixel resolution, in meters.
ChopperSpeed Input number Mandatory Chopper speed, in rpm.
ChopperOpening Input number Mandatory The opening angle between the two choppers, in degrees.
ChopperRadius Input number Mandatory Chopper radius, in meters.
ChopperPairDistance Input number Mandatory The gap between two choppers, in meters.
Slit1Name Input string Mandatory Name of the first slit component.
Slit1SizeSampleLog Input string Mandatory The sample log entry for the first slit opening.
Slit2Name Input string Mandatory Name of the second slit component.
Slit2SizeSampleLog Input string Mandatory The sample log entry for the second slit opening.
TOFChannelWidth Input number Mandatory TOF bin width, in microseconds.

Description

This algorithm converts a reflectivity workspace from wavelength to momentum transfer Q_{z} and calculates the Q_{z} resolution. The resolution is added as the Dx (X Errors) field in the output workspace.

The two additional input workspaces, ReflectedBeamWorkspace and DirectBeamWorkspace are the raw reflected and direct beam workspaces before foreground summation. They are needed for the resolution calculation.

The instruments of all three input workspaces are expected contain two components representing the two slits in the beam before the sample. The names of these components are given to the algorithm as the Slit1Name and Slit2Name properties. The slit openings (width or height depending on reflectometer setup) should be written in the sample logs (units ‘m’ or ‘mm’). The log enties are named by Slit1SizeSampleLog and Slit2SizeSampleLog.

The Polarized property should be used to indicate whether InputWorkspace is part of a polarization analysis dataset.

The SummationType property reflects the type of foreground summation used to obtain the reflectivity workspace.

Conversion to momentum transfer

The unit conversion from wavelength to Q_{z} is done by ConvertUnits.

Q_{z} resolution

The resolution calculation follows the procedure described in [1].

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In MantidPlot this is done using Manage User Directories.

Example - ReflectometryMomentumTransfer

# Load data.
reflectedWS = LoadILLReflectometry('ILL/D17/317370.nxs', XUnit='TimeOfFlight')
ConvertToDistribution(reflectedWS)
directWS = LoadILLReflectometry('ILL/D17/317369.nxs', XUnit='TimeOfFlight')
ConvertToDistribution(directWS)

# Extract some instrument parameters.
chopperPairDistance = 1e-2 * reflectedWS.run().getProperty('Distance.ChopperGap').value
chopperSpeed = reflectedWS.run().getProperty('VirtualChopper.chopper1_speed_average').value
chopper1Phase = reflectedWS.run().getProperty('VirtualChopper.chopper1_phase_average').value
chopper2Phase = reflectedWS.run().getProperty('VirtualChopper.chopper2_phase_average').value
openoffset = reflectedWS.run().getProperty('VirtualChopper.open_offset').value

# Normalize to time.
duration = reflectedWS.run().getProperty('duration').value
reflectedWS /= duration
duration = directWS.run().getProperty('duration').value
directWS /= duration

# Calculate reflectivity.
refForeground = SumSpectra(reflectedWS, 198, 209)
dirForeground = SumSpectra(directWS, 190, 210)
refForeground = RebinToWorkspace(WorkspaceToRebin=refForeground, WorkspaceToMatch=dirForeground)
R = refForeground / dirForeground

# Convert TOF to wavelength, crop.
R = ConvertUnits(R, 'Wavelength')
R = CropWorkspace(R, XMin=4.3, XMax=14.0, StoreInADS=False)
n = reflectedWS.getNumberHistograms()
reflectedWS = ConvertUnits(reflectedWS, 'Wavelength')
reflectedWS = CropWorkspaceRagged(reflectedWS, XMin=n*[4.3], XMax=n*[14.0], StoreInADS=False)
directWS = ConvertUnits(directWS, 'Wavelength')
directWS = CropWorkspaceRagged(directWS, XMin=n*[4.3], XMax=n*[14.0])

outws = ReflectometryMomentumTransfer(
    R,
    reflectedWS,
    directWS,
    ReflectedForeground=[198, 209],
    DirectForeground=[190, 210],
    SummationType='SumInLambda',
    Polarized=False,
    PixelSize=0.001195,
    DetectorResolution=0.0022,
    ChopperRadius=0.36,
    ChopperSpeed=chopperSpeed,
    ChopperOpening=45. - (chopper2Phase - chopper1Phase) - openoffset,
    ChopperPairDistance=chopperPairDistance,
    Slit1Name='slit2',
    Slit1SizeSampleLog='VirtualSlitAxis.s2w_actual_width',
    Slit2Name='slit3',
    Slit2SizeSampleLog='VirtualSlitAxis.s3w_actual_width',
    TOFChannelWidth=57.
)

qs = outws.readX(0)
dqs = outws.readDx(0)
print('First refectivity point Qz = {:.4f} +- {:.4f} A-1'.format(qs[0], dqs[0]))
print('and last Qz = {:.4f} +- {:.4f} A-1'.format(qs[-1], dqs[-1]))

Output:

First refectivity point Qz = 0.0118 +- 0.0001 A-1
and last Qz = 0.0381 +- 0.0005 A-1

References

[1]P. Gutfreund, T. Saerbeck, M. A. Gonzalez, E. Pellegrini, M. Laver, C. Dewhurst, R. Cubitt, arXiv:1710.04139 [physics.ins-det]

Categories: Algorithms | ILL\Reflectometry | Reflectometry

Source

C++ source: ReflectometryMomentumTransfer.cpp (last modified: 2018-04-27)

C++ header: ReflectometryMomentumTransfer.h (last modified: 2018-06-21)