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 with X units in wavelength.
OutputWorkspace Output MatrixWorkspace Mandatory The input workspace with X units converted to Q and DX values set to the Q resolution.
SummationType Input string SumInLambda The type of summation performed for the input workspace. Allowed values: [‘SumInLambda’, ‘SumInQ’]
ReflectedForeground Input int list Mandatory A two element list [start, end] defining the reflected beam foreground region in workspace indices.
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.
FirstSlitName Input string Mandatory Name of the first slit component.
FirstSlitSizeSampleLog Input string Mandatory The sample log entry for the first slit opening.
SecondSlitName Input string Mandatory Name of the second slit component.
SecondSlitSizeSampleLog 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. This algorithms processes workspaces in which the pixels containing the reflectected line have been integrated into a single histogram. For conversion of a 2D workspace into Q_{x}, Q_{z} or equivalent momentum space, see ConvertToReflectometryQ.

The algorithm requires the presence of certain sample log entries for the Q_{z} resolution computation. These can be obtained by ReflectometryBeamStatistics. The log entries are: beam_stats.incident_angular_spread, beam_stats.first_slit_angular_spread, beam_stats.second_slit_angular_spread and beam_stats.sample_waviness. See the documentation of ReflectometryBeamStatistics for more detailed information on the sample logs.

The instrument of InputWorkspace is expected to 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 FirstSlitName and SecondSlitName 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 FirstSlitSizeSampleLog and SecondSlitSizeSampleLog.

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

# Write statistics to sample logs.
ReflectometryBeamStatistics(
    reflectedWS,
    ReflectedForeground=[198, 204, 209],
    DirectLineWorkspace=directWS,
    DirectForeground=[190, 200, 210],
    PixelSize=0.001195,
    DetectorResolution=0.0022,
    FirstSlitName='slit2',
    FirstSlitSizeSampleLog='VirtualSlitAxis.s2w_actual_width',
    SecondSlitName='slit3',
    SecondSlitSizeSampleLog='VirtualSlitAxis.s3w_actual_width',
)

# 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,
    ReflectedForeground=[198, 209],
    SummationType='SumInLambda',
    PixelSize=0.001195,
    DetectorResolution=0.0022,
    ChopperRadius=0.36,
    ChopperSpeed=chopperSpeed,
    ChopperOpening=45. - (chopper2Phase - chopper1Phase) - openoffset,
    ChopperPairDistance=chopperPairDistance,
    FirstSlitName='slit2',
    FirstSlitSizeSampleLog='VirtualSlitAxis.s2w_actual_width',
    SecondSlitName='slit3',
    SecondSlitSizeSampleLog='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: AlgorithmIndex | ILL\Reflectometry | Reflectometry

Source

C++ source: ReflectometryMomentumTransfer.cpp (last modified: 2019-07-17)

C++ header: ReflectometryMomentumTransfer.h (last modified: 2018-10-05)