ConvertToDiffractionMDWorkspace v3

../_images/ConvertToDiffractionMDWorkspace-v3_dlg.png

ConvertToDiffractionMDWorkspace dialog.

Summary

Create a MDEventWorkspace with events in reciprocal space (Qx, Qy, Qz) for an elastic diffraction experiment.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory An input workspace.
OutputWorkspace Output MDEventWorkspace Mandatory Name of the output MDEventWorkspace. If the workspace already exists, then the events will be added to it.
Append Input boolean False Append events to the output workspace. The workspace is replaced if unchecked.
ClearInputWorkspace Input boolean False Clearing the events from the input workspace during conversion (to save memory) is not supported by algorithm v2
OneEventPerBin Input boolean True Use the histogram representation (event for event workspaces). One MDEvent will be created for each histogram bin (even empty ones). Warning! This can use significantly more memory!
OutputDimensions Input string Q (lab frame) What will be the dimensions of the output workspace? Q (lab frame): Wave-vector change of the lattice in the lab frame. Q (sample frame): Wave-vector change of the lattice in the frame of the sample (taking out goniometer rotation). HKL: Use the sample’s UB matrix to convert to crystal’s HKL indices. Allowed values: [‘Q (sample frame)’, ‘Q (lab frame)’, ‘HKL’]
LorentzCorrection Input boolean False Correct the weights of events by multiplying by the Lorentz formula: sin(theta)^2 / lambda^4
SplitInto Input int list 2 A comma separated list of into how many sub-grid elements each dimension should split; or just one to split into the same number for all dimensions. Default 2.
SplitThreshold Input number 1500 How many events in a box before it should be split. Default 1500.
MaxRecursionDepth Input number 20 How many levels of box splitting recursion are allowed. The smallest box will have each side length l = (extents) / (SplitInto^{MaxRecursionDepth}). Default 20.
MinRecursionDepth Input number 1 Optional. If specified, then all the boxes will be split to this minimum recursion depth. 1 = one level of splitting, etc. Be careful using this since it can quickly create a huge number of boxes = (SplitInto ^ (MinRercursionDepth * NumDimensions)). But setting this property equal to MaxRecursionDepth property is necessary if one wants to generate multiple file based workspaces in order to merge them later
Extents Input dbl list   A comma separated list of min, max for each dimension, specifying the extents of each dimension. Optional, default will use ConvertToMDMinMaxLocal to calculate extents for each dimension.

Description

The algorithm converts from a MatrixWorkspace (in any input units) into a MDWorkspace containing 3D events in reciprocal space.

The calculations apply only to elastic diffraction experiments. The conversion can be done either to Q-space in the lab or sample frame, or to HKL of the crystal.

Version 3 of this algorithm will by default automatically calculate the extents of the MD workspace using the ConvertToMDMinMaxLocal v1 algorithm. Old version of this algorithm (version 2) also still exists which uses the fixed bounds +/- 50. See the ConvertToDiffractionMDWorkspace v2 for details of the old implementation and ConvertToMDMinMaxLocal v1 for information on how extents are now calculated.

Types of Conversion

  • Q (lab frame): this calculates the momentum transfer (ki-kf) for each event is calculated in the experimental lab frame.
  • Q (sample frame): the goniometer rotation of the sample is taken out, to give Q in the frame of the sample. See SetGoniometer v1 to specify the goniometer used in the experiment.
  • HKL: uses the UB matrix (see SetUB v1, FindUBUsingFFT v1 and others) to calculate the HKL Miller indices of each event.

Lorentz Correction

If selected, the following Lorentz correction factor is applied on each event by multiplying its weight by L:

L = \frac{ sin(\theta)^2 } { \lambda^{4} }

Where \theta is half of the neutron scattering angle (conventionally called 2\theta). \lambda is the neutron wavelength in Angstroms.

This correction is also done by the AnvredCorrection v1 algorithm, and will be set to false if that algorithm has been run on the input workspace.

Usage

Example - Convert re-binned MARI 2D workspace to 3D MD workspace for further analysis/merging with data at different temperatures :

# create or load event workspace
events = CreateSampleWorkspace(OutputWorkspace='events', WorkspaceType='Event', Function='Multiple Peaks')
# convert to  MD workspace
md = ConvertToDiffractionMDWorkspace(InputWorkspace=events, OutputWorkspace='md', OneEventPerBin=False, LorentzCorrection=True, SplitThreshold=150)

# A way to look at these results as a text:
print("Resulting MD workspace has {0} events and {1} dimensions".format(md.getNEvents(),md.getNumDims()))
print("Workspace Type is:  {}".format(md.id()))

Output:

Resulting MD workspace has 81058 events and 3 dimensions
Workspace Type is:  MDEventWorkspace<MDEvent,3>

Categories: Algorithms | MDAlgorithms\Creation

Source

C++ source: ConvertToDiffractionMDWorkspace3.cpp (last modified: 2017-09-09)

C++ header: ConvertToDiffractionMDWorkspace3.h (last modified: 2017-01-11)