\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MDEventWorkspace | Mandatory | An input MDEventWorkspace. Must be in Q_sample/Q_lab frame. Must have an axis as DeltaE |
PolarizationAngle | Input | number | 0 | An in-plane polarization angle, between -180 and 180 degrees |
Precision | Input | number | 1 | Precision (between 0 and 1). Any event whose absolute value of cosine of 2 of its schaf angle less than this precision will be ignored. |
OutputWorkspace | Output | MDEventWorkspace | Mandatory | The output MDEventWorkspace with polarization angle correction applied |
User inputs an in-plane polarization \(P_a\) angle between -180 and 180 degrees, and a precision (between 0 and 1). Then for every MD event, a polarization angle correction is applied as below.
Example - Run Applying Polarization Angle Correction
we1 = CreateSampleWorkspace(WorkspaceType='Event',
Function='Flat background',
BankPixelWidth=1,
XUnit='DeltaE',
XMin=-10,
XMax=19,
BinWidth=0.5)
AddSampleLog(Workspace=we1,LogName='Ei', LogText='20.', LogType='Number')
MoveInstrumentComponent(Workspace=we1, ComponentName='bank1', X=3, Z=3, RelativePosition=False)
MoveInstrumentComponent(Workspace=we1, ComponentName='bank2', X=-3, Z=-3, RelativePosition=False)
SetGoniometer(Workspace=we1, Axis0='30,0,1,0,1')
# Old way
we1c = HyspecScharpfCorrection(InputWorkspace=we1,
PolarizationAngle=-10,
Precision=0.2)
md1c_sample = ConvertToMD(InputWorkspace=we1c, QDimensions='Q3D', Q3DFrames='Q_sample')
# new way
md1sample = ConvertToMD(InputWorkspace=we1, QDimensions='Q3D')
mdpacMDsample = PolarizationAngleCorrectionMD(InputWorkspace=md1sample, PolarizationAngle=-10, Precision=0.2)
r = CompareMDWorkspaces(Workspace1=md1c_sample, Workspace2=mdpacMDsample, Tolerance=0.001, CheckEvents=True)
print('Number of MDEvents: {} == {}'.format(md1c_sample.getNEvents(), mdpacMDsample.getNEvents()))
print('MDEventWorkspaces are equal = {}. Results: {}'.format(r.Equals, r.Result))
Output:
Number of MDEvents: 1972 == 1972
MDEventWorkspaces are equal = True. Results: Success!
Categories: AlgorithmIndex | MDAlgorithms
C++ header: PolarizationAngleCorrectionMD.h (last modified: 2021-06-08)
C++ source: PolarizationAngleCorrectionMD.cpp (last modified: 2021-06-08)