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

ConvertToMDMinMaxLocal v1

../_images/ConvertToMDMinMaxLocal-v1_dlg.png

ConvertToMDMinMaxLocal dialog.

Summary

Calculate limits of ConvertToMD transformation possible for this particular workspace and the instrument, attached to it.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory An input Matrix Workspace (2DMatrix or Event workspace)
QDimensions InOut string CopyToMD String, describing available analysis modes, registered with MD Transformation factory.There are 3 modes currently available and described in details on MD Transformation factory page.The modes names are CopyToMD, |Q| and Q3D. Allowed values: [‘CopyToMD’, ‘Q3D’, ‘|Q|’]
dEAnalysisMode InOut string Direct You can analyze neutron energy transfer in Direct, Indirect or Elastic mode.The analysis mode has to correspond to experimental set up. Selecting inelastic mode increasesthe number of the target workspace dimensions by one. See MD Transformation factory for further details. Allowed values: [‘Elastic’, ‘Direct’, ‘Indirect’]
Q3DFrames Input string AutoSelect Selects Q-dimensions of the output workspace in Q3D case. AutoSelect: Choose the target coordinate frame as the function of goniometer and UB matrix values set on the input workspace. Q (lab frame): Wave-vector converted into the lab frame. Q (sample frame): Wave-vector converted into the frame of the sample (taking out the goniometer rotation). HKL: Use the sample’s UB matrix to convert Wave-vector to crystal’s HKL indices.See MD Transformation factory (Q3D) for more details about this. Allowed values: [‘Q_lab’, ‘Q_sample’, ‘HKL’, ‘AutoSelect’]
QConversionScales Input string Q in A^-1 This property to normalize three momentums obtained in Q3D mode. See MD Transformation factory for description and available scaling modes. The value can be modified depending on the target coordinate system, defined by the property OutputDimensions. Allowed values: [‘Q in A^-1’, ‘Q in lattice units’, ‘Orthogonal HKL’, ‘HKL’]
OtherDimensions Input str list   List(comma separated) of additional to Q and DeltaE variables which form additional (orthogonal) to Q dimensions in the target workspace (e.g. Temperature or Magnetic field). These variables had to be logged during experiment and the names of these variables have to coincide with the log names for the records of these variables in the source workspace.
PreprocDetectorsWS Input string PreprocessedDetectorsWS The name of the table workspace where the part of the detectors transformation into reciprocal space, calculated by PreprocessDetectorsToMD v1 algorithm is stored. If the workspace is not found in analysis data service, PreprocessDetectorsToMD v1 used to calculate it. If found, the algorithm uses existing workspace. The field is useful if one expects to analyze number of different experiments obtained on the same instrument… warning:: Dangerous if one uses number of workspaces with modified derived instrument one after another. In this case this property has to be set to “-“ sting (minus without quotes) or empty (possible from script only) to force the workspace recalculation each time the algorithm is invoked.
UpdateMasks Input boolean False if PreprocessDetectorWS is used to build the workspace with preprocessed detectors at first algorithm call,and the input workspaces instruments are different by just different masked detectors, setting this option to true forces PreprocessDetectorsToMD v1 update only the detectors masks for all subsequent calls to this algorithm… warning:: This is temporary solution necessary until Mantid masks spectra by 0 rather then by NaN.
LorentzCorrection Input boolean False Correct the weights of events or signals and errors transformed into reciprocal space by multiplying them by the Lorentz multiplier: \(sin(\theta)^2/\lambda^4\). Currently works in Q3D Elastic case only and is ignored in any other case.
IgnoreZeroSignals Input boolean False Enabling this property forces the algorithm to ignore bins with zero signal for an input matrix workspace. Input event workspaces are not affected. This violates the data normalization but may substantially accelerate calculations in situations when the normalization is not important (e.g. peak finding).
Uproj Input dbl list   Defines the first projection vector of the target Q coordinate system in Q3D mode - Default (1,0,0)
Vproj Input dbl list   Defines the second projection vector of the target Q coordinate system in Q3D mode - Default (0,1,0).
Wproj Input dbl list   Defines the third projection vector of the target Q coordinate system in Q3D mode. - Default (0,0,1)
AbsMinQ Input number 0 Do not add events to MD workspace that are closer to the origin in QSample radius than this value. Needed for 3Dviews to remove noise.
MinValues Output dbl list    
MaxValues Output dbl list    

Description

Calculate min-max input values for selected workspace and MD transformation, chosen from MD Transformation factory.

Used as helper algorithm for ConvertToMD v1 but can also be deployed separately to evaluate the MD transformation limits for the current workspace.

Initiates the same as ConvertToMD v1 algorithm transformation from the MD Transformation factory and uses this transformation to evaluate all points where the transformation can achieve extrema for each workspace spectra. Then goes through all extrema points, calculates min/max values for each spectra and select global min-max transformation values for this workspace.

For example, given input workspace in the units of energy transfer and requesting \(|Q|\) inelastic transformation, the algorithm looks through all spectra of the input workspace and identifies minimal, maximal and an extremal [1] energy transfer for the input spectra. Then it runs \(|Q|,dE\) conversion for these energy transfer points and loops through all spectra of the workspace to identify \(|Q|_{min}, |Q|_{max}\) and \(dE_{min},dE_{max}\) values.

Note

[1]extremal energy transfer for |Q| transformation occurs at some energy transfer where momentum transfer is maximal. Its value depend on polar angle of the detector.

Usage

Example - Find min-max values for |Q| transformation :

# Simulates Load of a workspace with all necessary parameters #################
detWS = CreateSimulationWorkspace(Instrument='MAR',BinParams=[-50,2,50],UnitX='DeltaE')
AddSampleLog(detWS,LogName='Ei',LogText='52.',LogType='Number');
# evaluate |Q| transformation limits
minn,maxx = ConvertToMDMinMaxLocal(InputWorkspace=detWS,QDimensions='|Q|',dEAnalysisMode='Direct')
# Look at sample results:
print('MD workspace limits:')
print('|Q|_min: {0:10f}, dE_min: {1:10f}'.format(minn[0],minn[1]))
print('|Q|_max: {0:10f}, dE_max: {1:10f}'.format(maxx[0],maxx[1]))

Output:

MD workspace limits:
|Q|_min:   0.299713, dE_min: -50.000000
|Q|_max:  11.102851, dE_max:  50.000000

Example – Find min-max values for Q3D transformation, while converting TOF to energy transfer :

# Simulates Load of a workspace with all necessary parameters #################
detWS = CreateSimulationWorkspace(Instrument='MAR',BinParams=[20000,20,400000],UnitX='TOF')
AddSampleLog(detWS,LogName='Ei',LogText='52.',LogType='Number');

# evaluate Q3D transformation limits, which includes converting units
minn,maxx = ConvertToMDMinMaxLocal(InputWorkspace=detWS,QDimensions='Q3D',dEAnalysisMode='Direct')
print('Min values::  Qx: {0:10f}, Qy: {1:10f}, Qz: {2:10f},  dE:{3:10f}'.format(minn[0],minn[1],minn[2],minn[3]))
print('Max values::  Qx: {0:10f}, Qy: {1:10f}, Qz: {2:10f},  dE:{3:10f}'.format(maxx[0],maxx[1],maxx[2],maxx[3]))

Output:

Min values::  Qx:  -0.067199, Qy:  -0.090211, Qz:   4.617771,  dE: 51.680897
Max values::  Qx:   0.067199, Qy:   0.392381, Qz:   5.282783,  dE: 51.999462

Example – Finding min-max values for CopyToMD transformation uses the source workspace limits :

# Simulates Load of a workspace with all necessary parameters #################
detWS = CreateSimulationWorkspace(Instrument='MAR',BinParams=[200,2,20000],UnitX='TOF')
AddSampleLog(detWS,LogName='Ei',LogText='52.',LogType='Number');
minn,maxx = ConvertToMDMinMaxLocal(InputWorkspace=detWS,QDimensions='CopyToMD',dEAnalysisMode='Direct',OtherDimensions='Ei')
# Look at sample results:
print('MD workspace limits:')
print('TOF_min: {0:10f}, Ei_min: {1:10f}'.format(minn[0],minn[1]))
print('TOF_max: {0:10f}, Ei_max: {1:10f}'.format(maxx[0],maxx[1]))

Output:

MD workspace limits:
TOF_min: 200.000000, Ei_min:  52.000000
TOF_max: 20000.000000, Ei_max:  52.000000

Categories: AlgorithmIndex | MDAlgorithms\Creation

Source

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

C++ source: ConvertToMDMinMaxLocal.cpp (last modified: 2021-06-08)