Newer
Older
.. relatedalgorithms::
Fits :math:`intensity` vs :math:`Q` with a straight line for each run
to obtain the mean square displacement for a given range of runs.
This algorithm operates on the :math:`Q` workspace (*_eq*) generated by
the :ref:`ElasticWindowMultiple <algm-ElasticWindowMultiple>` algorithm.
The model used for obtaining the mean squared displacement can be
selected. These models include 'Gaussian', 'Peters', 'Yi'.
Workflow
--------
.. diagram:: MSDFit-v1_wkflw.dot
Usage
-----
**Example - Performing MSDFit on simulated data.**
.. testcode:: ExGeneratedDataFit
# Create some data that is similar to the output of ElasticWindowMultiple
sample = CreateSampleWorkspace(Function='User Defined',
UserDefinedFunction='name=ExpDecay,Height=1,Lifetime=6',
NumBanks=1, BankPixelWidth=1, XUnit='momentum', XMin=0.0,
g_msd, g_param, g_fit = MSDFit(InputWorkspace=sample,
Model="Gauss",
XStart=0.0, XEnd=5.0,
SpecMin=0, SpecMax=0)
y_msd, y_param, y_fit = MSDFit(InputWorkspace=sample,
XStart=0.0, XEnd=5.0,
SpecMin=0, SpecMax=0)
print('Using Gauss Model')
print('A0: ' + str(g_msd.readY(0)))
print('A1: ' + str(g_msd.readY(1)))
print('Using Yi Model')
print('A0: ' + str(y_msd.readY(0)))
print('A1: ' + str(y_msd.readY(1)))
Output:
.. testoutput:: ExGeneratedDataFit
.. sourcelink::