Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MDEventWorkspace | Mandatory | An input MDEventWorkspace. Must be in Q_sample frame. |
OutputWorkspace | Output | MDEventWorkspace | Mandatory | Copy of the input MDEventWorkspace with the corrected trajectory extents. |
This algorithm is part of the new workflow for normalizing multi-dimensional event workspaces.
Once the ends of detector trajectories are stored in the original EventWorkspace using the CropWorkspaceForMDNorm algorithm, one has to run the ConvertToMD algorithm and convert it to Q_sample. During this conversion some of the trajectories might be truncated. This recalculates the ends such as all the trajectory is completely contained within the outside box of the MDEventWorkspace
The master equation for transforming from lab coordinate system to HKL units is given by
We define the sample frame as
For elasic scattering .
For given extents of the input workspace, one can now recalculate the minimum and maximum
such as the trajectory is completely contained inside the box.
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 - RecalculateTrajectoriesExtents
# Create a host workspace
event = Load(Filename='CNCS_7860_event.nxs')
event = ConvertUnits(InputWorkspace=event, Target='DeltaE', EMode='Direct', EFixed=3)
event = CropWorkspaceForMDNorm(InputWorkspace=event, XMin=-2, XMax=3)
SetGoniometer(Workspace=event, Axis0='0,0,1,0,1')
md = ConvertToMD(InputWorkspace=event,
QDimensions='Q3D',
Q3DFrames='Q_sample',
OtherDimensions='SampleTemp',
MinValues='0.8,-2,-2,-2,-2',
MaxValues='1.,0,2,2,500')
recalculated = RecalculateTrajectoriesExtents(InputWorkspace=md)
import numpy as np
#Original workspace
high=np.array(md.getExperimentInfo(0).run()['MDNorm_high'].value)
low=np.array(md.getExperimentInfo(0).run()['MDNorm_low'].value)
n=len(high[high-low>1])
print("Number of trajectories in original workspace with length of more than 1meV: {}".format(n))
#Recalculated workspace
high=np.array(recalculated.getExperimentInfo(0).run()['MDNorm_high'].value)
low=np.array(recalculated.getExperimentInfo(0).run()['MDNorm_low'].value)
n=len(high[high-low>1])
print("Number of trajectories in recalculated workspace with length of more than 1meV: {}".format(n))
Output:
Number of trajectories in original workspace with length of more than 1meV: 51200
Number of trajectories in recalculated workspace with length of more than 1meV: 2590
Categories: Algorithm Index | MDAlgorithms\Normalisation
C++ source: RecalculateTrajectoriesExtents.cpp (last modified: 2018-11-02)
C++ header: RecalculateTrajectoriesExtents.h (last modified: 2018-11-02)