ApplyDetailedBalanceMD v1¶
Summary¶
Apply detailed balance to MDEventWorkspace
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
An input MDEventWorkspace. Must be in Q_sample/Q_lab frame. Must have an axis as DeltaE |
|
Temperature |
Input |
string |
SampleLog variable name that contains the temperature or a number |
|
OutputWorkspace |
Output |
Mandatory |
The output MDEventWorkspace with detailed balance applied |
Description¶
The fluctuation dissipation theorem [1,2] relates the dynamic susceptibility to the scattering function
For the MD events, the detailed balance is calculated and applied as below.
where
[1] S. W. Lovesey - Theory of Neutron Scattering from Condensed Matter, vol 1
[2] I. A. Zaliznyak and S. H. Lee - Magnetic Neutron Scattering in “Modern techniques for characterizing magnetic materials”
Usage¶
Example - Run Applied Detailed Balance
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)
AddSampleLog(Workspace=we1,LogName='SampleTemp', LogText='25.0', LogType='Number Series')
SetGoniometer(Workspace=we1, Axis0='0,0,1,0,1')
# old way
weadb1 = ApplyDetailedBalance(InputWorkspace=we1, Temperature='SampleTemp')
mdabd1 = ConvertToMD(InputWorkspace=weadb1, QDimensions='Q3D')
# use algorithm ApplyDetailedBalanceMD
md1 = ConvertToMD(InputWorkspace=we1, QDimensions='Q3D')
test_db_md = ApplyDetailedBalanceMD(md1, 'SampleTemp')
r = CompareMDWorkspaces(test_db_md, mdabd1, CheckEvents=True, Tolerance=0.00001)
print('Number of MDEvents: {} == {}'.format(test_db_md.getNEvents(), mdabd1.getNEvents()))
print('Workspaces are {} equal'.format(r.Equals))
Output:
Number of MDEvents: 1972 == 1972
Workspaces are True equal
Categories: AlgorithmIndex | MDAlgorithms
Source¶
C++ header: ApplyDetailedBalanceMD.h
C++ source: ApplyDetailedBalanceMD.cpp