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

PreprocessDetectorsToMD v1

../_images/PreprocessDetectorsToMD-v1_dlg.png

PreprocessDetectorsToMD dialog.

Summary

Its a helper algorithm, used to make common part of transformation from real to reciprocal space. It is used by ConvertToMD v1 and ConvertToMDMinMaxLocal v1 algorithms to save time spent on this transformation when the algorithm used multiple times for multiple measurements on the same instrument.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Name of an input Matrix Workspace with instrument.

OutputWorkspace

Output

TableWorkspace

Name of the output Table workspace with pre-processed detectors data. If the workspace exists, it will be replaced.

GetMaskState

Input

boolean

True

Returns masked state of the detectors. If this option is false, the masked detectors are just dropped from the resulting workspace and spectra-to detectors map has to be used to analyse the spectra. This is temporary parameter and logic necessary until Mantid masks signal by 0 rather then NaN.

UpdateMasksInfo

Input

boolean

False

If target workspace already exists as the result of previous deployment of this algorithm, the algorithm just updated masks states column instead of calculating the whole target workspace. The target workspace has to be appropriate for the source workspace This is temporary parameter and logic necessary until Mantid masks signal by 0 rather then NaN.

GetEFixed

Input

boolean

False

This option makes sense for Indirect instrument, where each detector can have its own energy, defined by correspondent crystal-analyzer position. If this option is selected for other instrument types, the value of eFixed is taken from workspace property Ei or eFixed if Ei is missing and is set to NaN if no such properties are defined on the input workspace.

Description

The algorithm calculates expensive part of the transformation from real to reciprocal space, calculating namely, detector positions, sample-detector distances, angular detectors positions, etc. These values can be slow to calculate for composite detectors and other algorithms can substantially benefit from using preprocessed values.

The algorithm places processed values into a table workspace with the following columns:

Column Name :

Type

Description:

DetDirections

V3D

unit 3D vector directed from sample to detector

L2

double

sample-detector distance

TwoTheta

double

Composite detectors Polar angle

Azimuthal

double

Composite detectors Azimutal angle

DetectorID

int

Unique detector number

detIDMap

size_t

index of the detector in the detector’s array

detMask [1]

int

1 if masked and 0 if not

efixed [2]

double

energy of the detector (intirect only)

In addition to the preprocessed detectors intofmation, the following log entries are added to the table workspace:

  • Ei – Incident neurtorns energy if such log value is attached to input workspace.

  • L1 – Source-sample distance.

  • ActualDetectorsNum – total number of existing preprocessed detectors (number of rows in the table above).

  • InstrumentName – the name of the source instrument.

  • FakeDetectors – if detectors posisions were not actually preprocessed but fake detectros were used instead

    (InstrumentName==*FakeInstrument* in this case).

Notes

Usage

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

# Simulates Load of a workspace with all necessary parameters #################
detWS = CreateSimulationWorkspace(Instrument='MAR',BinParams=[-50,5,50],UnitX='DeltaE')
AddSampleLog(detWS,LogName='Ei',LogText='52.',LogType='Number');
#
preprDetWS = PreprocessDetectorsToMD(InputWorkspace=detWS,GetMaskState=1,GetEFixed=1)
# Look at sample results:
print("The resulting table has the following columns:")
print(preprDetWS.keys())
print("The number of rows in the workspace is :  {}".format(len(preprDetWS.column('L2'))))
polar = preprDetWS.column('TwoTheta')
print("The polar angle for detector N {0} is {1:5f} rad".format(10,polar[10]))
print("The table workspace logs (properties) are currently not available from python")

Output:

The resulting table has the following columns:
['DetDirections', 'L2', 'TwoTheta', 'Azimuthal', 'DetectorID', 'detIDMap', 'spec2detMap', 'detMask', 'eFixed', 'DIFA', 'DIFC', 'TZERO']
The number of rows in the workspace is :  918
The polar angle for detector N 10 is 0.314159 rad
The table workspace logs (properties) are currently not available from python

Categories: AlgorithmIndex | MDAlgorithms\Utility

Source

C++ header: PreprocessDetectorsToMD.h

C++ source: PreprocessDetectorsToMD.cpp