\(\renewcommand\AA{\unicode{x212B}}\)
FFTDerivative v1¶
Summary¶
Calculated derivatives of a spectra in the MatrixWorkspace using Fast Fourier Transform (FFT).
See Also¶
ExtractFFTSpectrum, FFT, MaxEnt, RealFFT, SassenaFFT, FFTSmooth
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
Input workspace for differentiation |
|
OutputWorkspace |
Output |
Mandatory |
Workspace with result derivatives |
|
Order |
Input |
number |
1 |
The order of the derivative |
Description¶
Calcuates the derivative of the specta in a workspace using FFT v1.
Usage¶
Example: Different Orders of Derivative
wsOriginal = CreateSampleWorkspace(XMax=20,BinWidth=0.2,BankPixelWidth=1,NumBanks=1)
wsOrder1 = FFTDerivative(wsOriginal,Order=1)
wsOrder2 = FFTDerivative(wsOriginal,Order=2)
wsOrder3 = FFTDerivative(wsOriginal,Order=3)
print("bin Orig 1st 2nd 3rd")
for i in range (41,67,5):
print("{} {:.2f} {:.2f} {:.2f} {:.2f}".format(i, wsOriginal.readY(0)[i], wsOrder1.readY(0)[i], wsOrder2.readY(0)[i], wsOrder3.readY(0)[i]))
Output:
bin Orig 1st 2nd 3rd
41 0.67 1.35 4.20 9.93
46 5.50 8.50 3.25 -29.37
51 9.90 -3.92 -17.99 23.34
56 2.60 -5.63 9.10 0.70
61 0.37 -0.32 1.30 -4.51
66 0.30 -0.00 0.01 -0.07
Example: Different Orders of Derivative
wsOriginal = CreateSampleWorkspace(XMax=20,BinWidth=0.2,BankPixelWidth=1,NumBanks=1)
wsOrder1 = FFTDerivative(wsOriginal,Order=1)
wsOrder2 = FFTDerivative(wsOriginal,Order=2)
wsOrder2Test = FFTDerivative(wsOrder1,Order=1)
print("The direct 2nd order derivative and the derivative of a derivative should match")
print(CompareWorkspaces(wsOrder2,wsOrder2Test,CheckAllData=True,Tolerance=1e10)[0])
Output:
The direct 2nd order derivative and the derivative of a derivative should match
True
Categories: AlgorithmIndex | Arithmetic\FFT
Source¶
C++ header: FFTDerivative.h
C++ source: FFTDerivative.cpp