\(\renewcommand\AA{\unicode{x212B}}\)

RecalculateTrajectoriesExtents v1

../_images/RecalculateTrajectoriesExtents-v1_dlg.png

RecalculateTrajectoriesExtents dialog.

Summary

Recalculates trajectory limits set by CropWorkspaceForMDNorm

Properties

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.

Description

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

\[\begin{split}Q_l = 2 \pi R \cdot U \cdot B \left(\begin{array}{c} h \\ k \\ l \end{array}\right)\end{split}\]

We define the sample frame as

\[\begin{split}Q_s=R^{-1}Q_l=R^{-1} \left(\begin{array}{c} -k_f\sin(\theta)\cos(\phi) \\ -k_f\sin(\theta)\sin(\phi) \\ k_i-k_f\cos(\theta) \end{array}\right)\end{split}\]

For elasic scattering \(k_i=k_f\). For given extents of the input workspace, one can now recalculate the minimum and maximum \(k_f\) such as the trajectory is completely contained inside the box.

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 - 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: AlgorithmIndex | MDAlgorithms\Normalisation

Source

C++ header: RecalculateTrajectoriesExtents.h (last modified: 2021-03-31)

C++ source: RecalculateTrajectoriesExtents.cpp (last modified: 2021-03-31)