SpectralMomentMD v1¶
Summary¶
Multiply MD events by DeltaE^n
Properties¶
Name |
Direction |
Type |
Default |
Description |
|---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
An input MDEventWorkspace. Must have an axis as DeltaE |
|
Moment |
Input |
number |
1 |
The integer exponent of energy transfer (default: 1) |
OutputWorkspace |
Output |
Mandatory |
The output MDEventWorkspace with events scaled by DeltaE^Moment |
Description¶
This algorithm is intended to be used in calculate spectral moments from multidimensional workspaces. The inspiration is given by the sum rules described in P. C. Hohenberg and W. F. Brinkman, Phys. Rev. B 10, 128 (1974).
One needs to calculate
The algorithm just multiply events by \(\Delta E^n\). Transforming to a multidimensional histogram and integrating are done in different steps.
Hohenberg and W. F. Brinkman, Phys. Rev. B 10, 128 (1974) doi: 10.1103/PhysRevB.10.128
Usage¶
Example - SpectralMomentMD
# Create a workspace with one event at each integer DeltaE, from -10 to 10
CreateMDWorkspace(EventType='MDEvent', Extents='-10,11', Names='DeltaE', Units='meV', OutputWorkspace='ws')
FakeMDEventData(InputWorkspace='ws', UniformParams='-21')
# Run the algorithm
SpectralMomentMD(InputWorkspace='ws', Moment=2, OutputWorkspace='mom2')
# Rebin
BinMD(InputWorkspace='mom2', AlignedDim0='DeltaE, -10.5,10.5, 21', OutputWorkspace='mom2_histo')
# Print the result
print(mtd['mom2_histo'].getSignalArray())
Output:
[100. 81. 64. 49. 36. 25. 16. 9. 4. 1. 0. 1. 4. 9.
16. 25. 36. 49. 64. 81. 100.]
Categories: AlgorithmIndex | MDAlgorithms
Source¶
C++ header: SpectralMomentMD.h
C++ source: SpectralMomentMD.cpp